Shop OBEX P1 Docs P2 Docs Learn Events
Connecting dc motor to Basic Stamp — Parallax Forums

Connecting dc motor to Basic Stamp

Joch119Joch119 Posts: 7
edited 2008-07-04 01:43 in BASIC Stamp
I was using the Board of Education with the Basic Stamp and was trying to have a small dc servo motor that runs on 5-6V operate using the I/O pins. This servo only has two wires (power, ground). I plugged the ground into the Vss on the board and the power into P0 in the I/O pins. I then ran a basic program in the Stamp Editor that has (HIGH 0) and the motor doesn't turn on. If I connect one end into Vdd and the other into Vss in the board, the motor works. I even checked the voltages in Vdd vs. I/O Pin 0 and they were the same at 4.9V. How can I get this motor to work using the I/O pins?

Thanks for the help

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-03 21:53
    Any motor will take way too much current. Stamp I/O pins, like most microcontroller I/O pins, are only designed to supply about 20mA. You need to use the I/O pin to turn on a switching transistor which, in turn, provides power to the motor. Go to the main Parallax web page, select the "Resources" tab, then choose "Downloads", then "Stamps in Class Downloads". You'll see a variety of excellent tutorials. Download the "Industrial Control" tutorial and look around page 86. There's a section on controlling relays and solenoids and small motors with a Stamp I/O pin using a switching transistor.

    A good junction transistor for loads up to 200 mA or so would be the 2N3604. Connect it as shown with a resistor in the base lead and a diode across the motor as shown.
  • Joch119Joch119 Posts: 7
    edited 2008-07-04 01:27
    OK. thank you! I got the motor working in one direction. But now how do I get it going in the opposite direction? I need to be able to control it going in either direction.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-04 01:35
    You will need what's called an H-bridge. Look up "wiki h-bridge" with an Internet search. The Wikipedia has some good articles on this. There are ICs that have a complete H-bridge on-chip. There's also some Nuts and Volts Columns on the subject. Start with #23 (go to the main Parallax web page, select the "Resources" tab, then choose the "Nuts and Volts Columns" tab.
  • Joch119Joch119 Posts: 7
    edited 2008-07-04 01:43
    alright thank you very much!!! You are a great help
Sign In or Register to comment.