Real Time control of multiple servos...
Wow I haven't been here in ages! I gotta catch up on some of the current projects going on. Now I have a question about controlling multiple servos in real time using a Parallax Servo Controller. I saw the price and read the features and like what I see. But can it handle real time controlling of multiple servos from multiple signals?
The controller in question is this one:
http://www.robotstore.com/store/product.asp?pid=676&catid=1563
Basically I am constructing a number of sensors. Each sensor controls a servo. The idea is that if you move your hand near a sensor, the servo that is linked to the sensor will move according to how close your hand is. The faster or slower you move your hand, the faster or slower the servo moves! I have already made a circuit that does the job. The problem is if I put all those circuits together, it would make a rather big circuit board! It is a neat concept. I just want to be able to do it on a single chip. Now I can't code for the life of me. So the easier it is to make a program that works the better. If this board is not what I should be using, any ideas as to what will work? Keep in mind that I will need to have the board linked directly to the sensors and not a PC. I don't want to have to haul a PC tower and monitor around just to use it.
The controller in question is this one:
http://www.robotstore.com/store/product.asp?pid=676&catid=1563
Basically I am constructing a number of sensors. Each sensor controls a servo. The idea is that if you move your hand near a sensor, the servo that is linked to the sensor will move according to how close your hand is. The faster or slower you move your hand, the faster or slower the servo moves! I have already made a circuit that does the job. The problem is if I put all those circuits together, it would make a rather big circuit board! It is a neat concept. I just want to be able to do it on a single chip. Now I can't code for the life of me. So the easier it is to make a program that works the better. If this board is not what I should be using, any ideas as to what will work? Keep in mind that I will need to have the board linked directly to the sensors and not a PC. I don't want to have to haul a PC tower and monitor around just to use it.
Comments
This board is made to connect to either a PC (via USB) or to some kind of microcontroller (like a Stamp via a logic level serial port). It responds to short commands sent in serial form that tell it to position a particular servo to a position given in the command. It's not programmable. Its control program is fixed.
So, how many sensors do you have? What kind of outputs do they have? You're going to need to do some kind of programming to manage the sensors and transmit commands to the Parallax Servo Controller. If you have 8 or fewer servos and the sensors are easy to handle, you may be able to dispense with the Servo Controller entirely and control everything with a Stamp.
The sensors in question are light sensors. Otherwise knows as photoresistors. The circuit I made takes a timer circuit and uses the input from the light sensor to adjust the servo position. The idea is that if I position the light sensors in such a way, moving your hand over a spot on the floor will cause the leaves on a rigged plant to move out of your way. So moving your hand close to the plant will start to obstruct 1 sensor and the first leaf will move out of the way. Then the second and third servo will begin doing the same thing as you move closer and block more of the light hitting the sensors. Eventually all the sensors to the right and left of you will be blocked and all of the servos will pull all the leaves out of the way so you can go through. If you are wondering why I want to use multiple servos instead of just 2 beefy ones, it is because it will seem more alive with each leaf acting on its own. The planned number of servos is about 10 to 12.
As for linking that many sensors to the servo controller... I would like to use some kind of a logic device that samples each light sensor and transmits the data to the controller itself. I'm thinking a multiplexer or some other device that can stream data through a usb port. Then the only thing I would have to do is configure the controller to update the servos based on this continuous stream of data. Does that make more sense?
Jax
2) There are a variety of ways to measure the resistance of photoresistors. You can use them to control a timer. You can use them to produce a variable voltage that you can measure with an analog to digital converter, some of which have as many as 8 inputs or more. You can use them to charge or discharge a capacitor and measure the time it takes. This last technique is similar to the use of a timer, but doesn't need the timer.
3) You could certainly use something like a Stamp to measure the resistance of the photoresistors. One of the faster stamps (like the BS2px) could do the job using the RCTIME statement. You'd need a small capacitor and one I/O pin for each photoresistor. One I/O pin could transmit control information (servo position for each servo) to a Parallax Servo Controller using a logic level serial connection (not USB). There would be small delays since it takes some time to charge or discharge the capacitor through the photoresistor and to transmit new position information for the corresponding servo. Since there are 10-12 sensor/servo pairs, it would take 10-12 times the basic cycle to process all the sensor/servo pairs.
I've measured LDR's via the use of a timer circuit. My goal was to avoid using multiple timer circuits and use a single chip to handle all the measurements and timing. The BS2px looks like something which will work very well for my application. I will probably get it and have a dozen I/O ports used just for sensors. Then interface it with the servo controller so that it will work together. But that would be something I will have to save up for. My goal was to do it in under 60 bucks with just 1 board. To use this and the servo controller will be a bit more expensive. Still, where space is concerned, this is wayyyy better than using multiple timer boards. While I can deal with some slight delays, too slow a response time will start to cause problems. But I might be able to compensate if I can figure out how to smooth out the servo speeds using one of the two boards.
I have decided (for now anyways) that I will make alot of timer circuits and just make them as compact as possible. However I am still planning on making all those servos work off of 1 or 2 control boards. So I'll eventually give the BS2 a try. Besides I still want to learn how to do some coding. And those stamps seem perfect for helping me learn how to do so. Thank you all for your help
Jax
So, what we need to do is characterize the latency, and determine how much latency you can tolerate. A BS2 with an external 'tick' generator can be extremely reliable with a 50 millisecond 'tick'. But 50 milliseconds can be a 'long time'.
The SX boards made by Parallax ($10 board, $150 development system) run at about 50 MIPS, with latency around 20 to 50 nanoseconds. Now THAT'S "real time". You program them using the Parallax SX-Key and IDE, using the SX/Basic compiled language.
Frankly, the BS2 family has a MUCH simpler programming language and is easier to use, but the SX-48 board give you MUCH greater performance.
That $60 price point is a problem. Usually you can trade off money for experience, so if I had as little experience as you think you do, I'd first buy a BS2-BOE based solution ($150 or so), and try it out. If that works, you're good. If that doesn't work (as your timing requirements seem to imply) you may have to go to the SX-48 board (another $150). The good thing with the SX-48 is that the SX can be its OWN Servo-Controller.
??
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
execuse me, i am a new member for this forum, my name is agus,i need your help, i want to design a six leg robot, where each leg contain 2 servo, i need i mechanical design , and a tutorial how to build it, thank u som much
my email is :bagus081@gmail.com
best regards,
agus
Zoot, good point. http://www.parallax.com/Store/Microcontrollers/SXProgrammingKits/tabid/140/ProductID/364/List/1/Default.aspx?SortField=ProductName,ProductName
That's $89, and a very good deal. While the "cost of raw hardware" is $60, it's still nice to have a 'proven' prototype board, which the $89 kit gives you. Add the $10 SX board, some time to read the manual, some prototyping time, and you're good to go.
Perhaps you can download the manual, and so you could do it with just the board and SX-key and downloads.