Using SERIN to passively listen for Servo Commands
jongarr
Posts: 11
Hi,
·· I·have my Basic Stamp I set up with two servos and an LED light.· The Basic Stamp has one pin connected to my PC to receive Serial data.· I have it working with simple serin commands and I have been able to control the servos from the stamp, so I know it is set up properly.
·· What I want to do is have the servos move to a certain location based on two numbers that will occassionally be sent from the pc and then stay in that position until the next command is received from the PC.· It appears that SERIN waits until it receives data, which doesn' work because the servo control loop can't continue.·
·· Any help would be greatly appreciated.
Thank You,
Jon
·
·· I·have my Basic Stamp I set up with two servos and an LED light.· The Basic Stamp has one pin connected to my PC to receive Serial data.· I have it working with simple serin commands and I have been able to control the servos from the stamp, so I know it is set up properly.
·· What I want to do is have the servos move to a certain location based on two numbers that will occassionally be sent from the pc and then stay in that position until the next command is received from the PC.· It appears that SERIN waits until it receives data, which doesn' work because the servo control loop can't continue.·
·· Any help would be greatly appreciated.
Thank You,
Jon
·
Comments
Parallax sells just such a device.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Knight Designs
324 West Main Street
P.O. Box 97
Montour Falls, NY 14865
(607) 535-6777
Business Page:·· http://www.knightdesigns.com
Personal Page:··· http://www.lightlink.com/dream/chris
Designs Page:··· http://www.lightlink.com/dream/designs
·
I searched for Servo Co-Processor and SSC on parallax's site and didn't find anything.· Do you have a link?· Also, are there advantages (price/function) of using what you suggest over a digital potentiometer (like the DS1267) connected to a 555 timer to generate the consistent pulses?
-Jon
Here is a link to the Parallax Servo Controller (PSC):
http://www.parallax.com/detail.asp?product_id=28023
With it you can individually control up to 16 R/C servos with one board. Multpile boards can be "networked" for up to 32 R/C servos if needed.
Regards,
Bruce Bates
That looks like a great solution, but I'm looking for the cheapest possible means of controlling just two servos. I'm thinking that for the price, the best solution is to use a serial controlled potentiometer with a 555 timer ic. I think that will cost about 7 or 8 dollars to control two servos. Can anyone suggest a better solution for the price?
-Jon
So, all you have to do is add a time-out value to the SERIN loop of 20 mSec, then *don't* put an additional pause in.
So it looks like:
Serv1Pin CON 6
Serv2Pin CON 7
Byte1 VAR BYTE
Byte2 VAR BYTE
Serv1Val VAR WORD
Serv2Val VAR WORD
Main:
PULSOUT Serv1Pin, Serv1Val
PULSOUT Serv2Pin, Serv2Val
SERIN 16, MyBaud, 20, SerTimeout, [noparse][[/noparse]Byte1, Byte2]
FallThrough: ' Here when data recieved
' Do stuff here to update Serv1Val, Serv2Val
PAUSE 20 ' Because may have returned immediately
GOTO MAIN
SerTimeout:
GOTO MAIN ' Because 20 mSec already waited for.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Knight Designs
324 West Main Street
P.O. Box 97
Montour Falls, NY 14865
(607) 535-6777
Business Page:·· http://www.knightdesigns.com
Personal Page:··· http://www.lightlink.com/dream/chris
Designs Page:··· http://www.lightlink.com/dream/designs
·
It'll probably take a bit of experimenting, though.
Larry
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
In the end, I found several ways to solve this problem, including one that didn't involve buying extra equipment:
1.· Buy a serial potentiometer and use a 555 timer ic to send the pulses to the servos, while the BS1 waits for input
2.· Buy a pwm ic and do basically the same thing
3.· Buy a serial servo controller
4.··Free Solution:·(but may only be a good solution in my application)
···· Wait for serial in, when you get it send enough pulses that you think the servos are in the correct position, and then wait for serial input again.· The servos aren't going anywhere once they are aimed (unless an outside force acts on them).· This works very well for what I am doing, but wouldn't be a good solution in many applications.
Thanks,
Jon