Shop OBEX P1 Docs P2 Docs Learn Events
standard motor run by the MicroController? — Parallax Forums

standard motor run by the MicroController?

willthiswork89willthiswork89 Posts: 359
edited 2006-06-23 20:00 in BASIC Stamp
i have a standard motor such as one used for rc cars and air planes. 1.5 volts, can it be run by the micro controller? i tried but it wont move it and i assured it worked by using a AAA battery on it. i was using the HIGH command with one side hooked to the VSS and one hooked to a 470 ohm resistor then to the p15..

p15->~470->wire to motor- wire to motor <-VSS

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-06-22 00:45
    The Stamp cannot provide enough current to run the motor. It probably requires 100ma or more which is way beyond the capabilities of most chips that are not specifically designed for this use like the ULN2003A (used in the Prop-1). You can use a power transistor or power MOSFET to switch the motor. Look through the Nuts and Volts articles and other application notes on the Parallax website for ideas and to learn about controlling motors of different kinds and other devices with the Stamp.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-22 00:50
    ok the only equipment i have is the qeuipment supplied by the WAM book but im sure i could somthing like that at radioshack. thanks for the info!
  • bennettdanbennettdan Posts: 614
    edited 2006-06-22 01:34
    Hey look at this forum http://forums.parallax.com/forums/default.aspx?f=10&m=129182&p=1
    You can buy IR511 mosfets from radioshack be sure to get a heatsink and follow the curcuit Beau gave as an attachment then use the PWM command to get it to very speed or send a high on low off to the pin you are using
  • Mike GreenMike Green Posts: 23,101
    edited 2006-06-22 01:46
    A typical toy motor like you describe should not require you to use a heatsink on the IR511.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-22 03:30
    should i get it for saftey or just forget it?
  • Mike GreenMike Green Posts: 23,101
    edited 2006-06-22 04:04
    Worst thing that can happen is that the IRF511 will get warm and stop working. MOSFETs have the endearing quality of not destroying themselves promptly when they get overheated. Heatsinks are very cheap (be sure to get a little tube of heatsink compound and apply a thin film of it between the tab of the transistor and the heatsink before you fasten them together with a screw) so it won't add much to your bill. Even without a heatsink, the TO220 package can dissipate a couple of hundred milliwatts and you're unlikely to get anywhere near that much using the IRF511 as an on/off switch with currents of a couple of hundred milliamps. If you were trying to switch several amperes with supply voltages more like 12V, that would be a different story.
  • bennettdanbennettdan Posts: 614
    edited 2006-06-22 07:14
    I agree with Mike I use heatsinks because I switch bigger loads.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-22 16:26
    okay i am having trouble understanding the schematic... im a little new to is so im now sure about ow this is connected?
  • bennettdanbennettdan Posts: 614
    edited 2006-06-22 17:31
    Well their is a picture on the back of the IR511 package that will tell you what pin is what or you can download the datasheet off the web. you will connect the basic stamp pin to a 220 ohm resistor then connect the resistor to the gate of the IR511 mosfet then connect a V-ground wire to the source pin on the IR511 then connect a wire from the drain pin on the Ir511 to one of the motors terminals then the other motor terminal to V+also get a couple of 4001 diodes and connect it across the motor leads to protect the mosfet, connect the banded end (cathode) to the V+ side and the other end to the motor terminal from the mosfet. I hope this will help you out.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-22 17:44
    ok i did what you said and then im doing

    do
    pwm 15,255,255
    loop

    and its not doing anything.... so im a little confused?
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-22 17:48
    i take that back the motor is clicking but not moving.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-06-22 18:13
    First make sure the circuit works with something like:
    FOR I = 1 TO 10
    HIGH 15 : PAUSE 1000 : LOW 15 : PAUSE 1000
    NEXT

    Usually the problem with the PWM statement is that it's based on very short pulses that average out to the voltage you want. They may be too short for the motor to respond properly. You may have to use a PULSOUT statement in a loop instead, varying the width of the high pulse and repeating the PULSOUT roughly 50-100 times a second. Alternatively, you could put a capacitor across the motor leads and a small resistor in series (between the IRF511 and the motor/capacitor) to act as a filter. 20-50uF would probably work with a 10-22 ohm resistor. I'd try the PULSOUT loop first.
  • bennettdanbennettdan Posts: 614
    edited 2006-06-22 21:58
    Yes I agree with Mike just turn it on first. make sure your connections are right. You can also take the resistor that is going to the output pin on the stamp and connect it to the 5v+ you have on your board to see if it stays full on. Tells us how you have the curcuit wired up now.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-23 03:19
    okay i tried everything you guys say and nothing worked... i have a 221 ohm resistor in 15 that goes to the gate then i have the source going to the vss or the v+ on the bs2 homework board... then i have the drain going to one of the motor leads and the other motor lead going to the vdd... then i was doing high 15 and nothing... then i tried pulsout and nothing...
  • bennettdanbennettdan Posts: 614
    edited 2006-06-23 03:49
    Like this PIN15->220ohm resistor -> gate(left pin looking at the writing), then connect Vss to the source (right pin), then connect the drain( middle pin) to the a motor connector, then the other side of the motor connector to Vin not Vdd and make sure you are using a 9v battery and not a small ac adapter. If you connect it to the Vdd it may be causing the stamp to shutdown due to current draw make sure the green LED stays on when you run the program. Also because you said you hooked it up wrong try to light an LED up with the same Pin to make sure the pins is working if it is not try a different pin.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-23 04:24
    ha it works it just needed to be in the vin, whas the difference? also i have a rubber band on the motor to run a wheel and its not exerting enough force from the motor.. is it the resitor? or the mosfet
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-23 04:40
    never mind it was just a dead battery.... now that i know the thing works how can i reverse the polarity so that it goes forwards and backwards? also is there a book o sending and receiving infrared signals? i bought a 38kHz IR Receiver Module and a High output 5MM infrared ledwith a 940nm wave length... these will work together correct? this radio shack was shutting down and had these things for like 30 cents!
  • bennettdanbennettdan Posts: 614
    edited 2006-06-23 05:46
    Well to reverse your motor you can use a DPDT relay to switch the polarity to your motor or you can use an H-Bridge curcuit that uses 4 mosfets to change the direction check out this forum.
    http://forums.parallax.com/forums/default.aspx?f=10&m=131650

    Also to get you started with your IR receiver this PDF might help.
    http://www.parallax.com/dl/docs/prod/sic/IRRemoteforBoebot.pdf
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-06-23 20:00
    alright guys thanks for all the help.. this is the last question and ill be on my way. when i do high 15tongue.gifause 1000:low 15tongue.gifause 1000 is doesnt ever stop? the motor keeps going never stopping? is this normal? how can i fix it.. oh yea and the ir receiver i have doesnt look like the one in the pdf and im not sure if it works with that requency? thanks for all the help guyst
Sign In or Register to comment.