Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp micro bot. — Parallax Forums

Basic Stamp micro bot.

AwesomeCronkAwesomeCronk Posts: 1,055
edited 2018-04-28 22:20 in BASIC Stamp
Hello, I have a robot that I am making, small enough to fit in the palm of my hand.
I have run into an issue. My DC motors need at least 9v to operate, and I have no room to instal relays or drivers. I do not havee transisters at the time and do not have time to go get them. My Stamp is on a small 10x17 breadboard.42ed6594e8b0880f947fcd4d4eb4fc.pngtinybot.png
The triangle on the right of the image is a piece of cardboard to keep it off the ground.

How do I drive these motors?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2018-04-28 23:01
    You can't do it. You'll destroy the Basic Stamp if you try to switch any voltage above 5V and the Stamp I/O pins can't handle more than about 20mA ... way too low for the motors you have. You will have to use driver transistors and you'll have to figure out where to keep the batteries that'll have to supply the voltage that the motors need at the current level needed for movement. That's what ? 12V? The current level is probably in the 100s of mA. The size and weight of the batteries will determine how much space they will take up and roughly determine how long they might last. 4 coin Lithium cells in series can supply 12-13V for a little while for example, maybe 100mA for 2 hours of intermittent use.

    You really need to know how much current the motors take and the minimum voltage for them to operate reliably. General purpose NPN switching transistors rated for the current and voltage needed are what you will need for drivers and Nuts and Volts Column #6 shows how to connect them. You also need a reverse connected flyback diode to prevent damage to the transistor and the Stamp from voltage spikes from the motor. The Nuts and Volts column shows that as well.

    There are small DC motors that only need on the order of 3V. SparkFun has one of those. Given that the Stamp needs about 6V for Vin, a 6V motor might be best and a small one might draw 200mA.
  • So if I set pin 0 low and connect the motor to p0 and Vin under 7.5v(7.5 will drive these, but that is the absolute minimum), I will ruin my BS2.
  • AwesomeCronkAwesomeCronk Posts: 1,055
    edited 2018-04-29 01:03
    Got it. I may just glue a breadboard to two servos.
  • Mike GreenMike Green Posts: 23,101
    edited 2018-04-29 04:13
    "So if I set ... ruin my BS2" Probably

    The motor has a relatively low resistance. If you were to connect it between Vin and ground, it would probably conduct 100mA or more. By connecting it between Vin and I/O pin 0, it will "try" to conduct the same amount of current into pin 0. The little gold wires connecting the package pins to the chip pads can't carry that amount of current and will melt unless the connections on the chip itself melt first.

    Also, the chip is not made to withstand voltages greater than about 5.5V and, before the program on the chip has a chance to initialize and set pin 0 to output mode low, pin 0 will be setup as an input (by default) that you've connected to Vin through the motor. This will place maybe 7.5V on pin 0 which will destroy some portions of the logic around pin 0 and possibly other portions of the chip as well.

    Using servos is a good idea. The servos have built-in drivers and the control signal works with 5V (and usually 3.3V) logic parts. There are some pretty small servo motors available. Make sure you have what are called "continuous motion" servos that have been modified to move continually (through 360 degrees) with the control signal indicating the speed and direction of the motor. Regular servos use the control signal to indicate the position desired for the motor and the motor moves only through about 270 degrees.
  • Yeah, the CR Servos are a favorite of mine and have been for a while.
  • Good to know a little bit more about the capacity of the BS2, thanks.
  • The best way to learn this stuff is to learn how to read the datasheet for the devices you commonly use. The BS2 is based on Microchip's PIC16F57. The datasheet has a table of absolute maximum values (page 58). Any single I/O pin can provide up to 25mA. Any group of 8 I/O pins (0-7 or 8-15) can provide up to 100mA total. The power pins can handle up to 200mA total. Maximum voltage on any I/O pin is 5.6V (with a 5V supply from the regulator built into the BS2 module).
  • Thank you.
Sign In or Register to comment.