PDA

View Full Version : Basic Stamp 2 and Servos



Mikelele
11-22-2006, 06:00 PM
Hi,

I'm quite new to the forums and to microcontrollers in general so please bear with my questions. Also pardon me please if there is a thread somewhere that has laready dealt with this topic.

So to start, I have some background in programing languages and electronics. However I want to·organize my information so I have purchased a BasicStamp2 Discovery Kit from Parallax. I also purchased two standard servos to play with.

Ultimately the objective is to·master PBasic and·to learn·how to control servos. My question is: Will I need a Serial Servo Controller like the Prop1 at EFX-TEK to drive my servos or can I hook 'em up to the Discovery Kit directly?

I'd appreciate any info anyone might have or could direct me to regarding this.

Thank you =)

·

Zoot
11-22-2006, 10:02 PM
No, you do not *need* a Servo Controller, but they can be nice if you have a lot of servos to manage and want to free up your Stamp for other tasks.

That said, to run servos from your Stamp, you can check out Robotics with the Boe-Bot from Parallax for lots of wiring and code examples (see the downloads section of the Parallax site or www.parallax.com/dl/docs/books/edu/Roboticsv2_2.pdf (http://www.parallax.com/dl/docs/books/edu/Roboticsv2_2.pdf)).

The key for your servos is to make sure that the black/red wires of the servo (motor +/-) are hooked up directly to battery power, not the Stamp itself. The yellow (signal) wire of a servo goes to a pin on your Stamp. Servos like regular pulses of 1ms-2ms duration (or so -- the Parallax continous rotation servos uses a slightly narrower range of pulsewidths). Every 20ms or so, you need to send a pulse to the servo(s) so that it keeps doing whatever it is you wanted done. Commonly, coders will set up their main program so it loops through all the code every 20ms or so, each time "refreshing" the pulse to the servos.

In a sense, all servos have their own built-in motor controller that accepts pulse widths to tell the motor what to do.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

Mikelele
11-22-2006, 10:53 PM
Hey Zoot,

Thanks for the reply. Yes, I get what you mean about handling more than one servo! I will eventually need an SSC then won't I? It's just a matter of time he he he.

And yes, I understand about the power supply and the signal wire.

Actually, the Discovery kit does come with a servo and I'm sure it'll have enough mini-projects using it to answer these fundamental questions. I'm just a little eager and can't wait.

Again, thanks for the reply and the link!

Zoot
11-22-2006, 11:17 PM
Somebody said...
I will eventually need an SSC then won't I? It's just a matter of time he he he.


It really depends -- if you have 6 servos then you're down to 10 pins on your Stamp. A potentially bigger issue than available pins is the time it takes your main program loop to run through it's steps -- if it takes 50ms-100ms to run through, then you won't be able to refresh the servos fast enough. I've also seen where the serial traffic involved in managing, say, 10 servos can add up pretty quickly. If you are just writing to the servo controller the hit isn't so bad, but if you are writing and reading from the controller for lots of servos every time through your loop, the data transfer time itself starts to add up too. It's always a balancing act.....

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

Chris Savage
11-24-2006, 01:52 AM
And if you should end up needing a serial controller we have one at the following link…Take care.

http://www.parallax.com/html_pages/products/motorcontrol/motor_control.asp

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

Mikelele
11-24-2006, 09:49 AM
Thanks Chris!

That's the one I'm going to get soon as soon as I devour my Discovery Kit. =)