Servo controllers serial need help.
Tomvn
Posts: 103
Can anyone help me with this ,i just got the servo controller· serial and some servo , anyone know· how to write code for it , like i have 4 servo i want to make each servo turn different direction ( forward and backward ) and each· servo delay different time or just basic sample code make the servo turn different time and direction. i am not sure PCS can do that or not
i am new to this . thanks for any help.
i am new to this . thanks for any help.
Comments
Download the Robotics with the Boe-Bot tutorial from Parallax (www.parallax.com/tabid/535/Default.aspx). There's a whole section on servos and how they work.
Servos require a source of power (4.2V to no more than 7.2V) and a control pulse which is +5V logic levels. This pulse must be repeated about every 20ms or the servo will turn itself off. The pulse width is roughly 1ms to 2ms with some servos accepting pulses from 0.5ms to 2.5ms. The width of the pulse determines the final position of the servo. The time it takes for the servo to move depends on the servo and the distance it has to move. These are what are called "standard servos". There's also a continuous motion servo which is a modified unit. On these, the midpoint pulse width (roughly 1.5ms) will cause the servo to remain motionless. The further the pulse width is from this setting, the faster the servo will move. Pulses shorter than this midpoint will cause motion in one direction while pulses longer than this will cause motion in the other direction.
The servo controller accepts a pulse width value and repeatedly outputs pulses of that width. You (or your program) have to provide a pulse width value corresponding to the motion that you want. It's pretty simple.
how can i write the code to make the servo run different time and direction , i mean all servo hook up on servo controller.
thanks.
The BS2 communicates with the PSC (Parallax Servo Controller) using a serial communications line using the SERIN and SEROUT statements.· This can be any I/O pin because the pin # is in the SERIN / SEROUT statement.· Part of the information sent to the PSC is a channel number which specifies which of 32 servos is to be controlled (16 servos per PSC if the PSCs are connected together and one is jumpered for servos 16-31).
When you send a command to the PSC, you specify the servo and the width of the control pulse for that servo.· As I already mentioned, that pulse determines the speed and direction of the continuous motion servo or the position of the standard servo.· Please read the Robotics with the Boe-Bot tutorial that I mentioned.· It will give you examples of servo control and more of a description of how servos work.· Try some of the examples in the PSC documentation.
Note that there is a ramp parameter in the command.· This specifies roughly the amount of time to take in changing the servo pulse from the current width to the width you specified.· For a standard servo, this specifies the amount of time to take moving from one position to another.· For a continuous motion servo, this specifies the amount of time to take to change speed and direction from the old setting to the new one.· It's not really what you are asking for.· You'll probably have to time your servo movement in the Stamp using a PAUSE statement by sending one pulse width setting to the PSC, then waiting for some number of milliseconds using a PAUSE statement, then sending another pulse width setting to the PSC.
Post Edited (Mike Green) : 4/24/2008 11:23:06 PM GMT