Shop OBEX P1 Docs P2 Docs Learn Events
Ampliflying a I/O pin signal — Parallax Forums

Ampliflying a I/O pin signal

Dan TaylorDan Taylor Posts: 207
edited 2009-02-17 18:07 in General Discussion
I have some DC motors that usually run on 9v. Can someone show me a circuit that I can amplify the 5v signal from the output pin to 9v so it can drive the motor? Or is that possible?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-02-15 01:43
    Transistors and MOSFETs will do what you want. There are examples around here doing it with a stamp and Google will bring you more info than you can digest.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-02-15 01:50
    Dan, the circuit is simple, really. For an NPN transistor, connect the output to a 1k resistor(or about that), and the other end of the resistor to the BASE of the transistor. Then, connect the EMITTER of the transistor to ground, and the COLLECTOR to one terminal of the motor, and the other end of the motor to your power source(+). That should be it for simple motor control.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-15 01:51
    I am kinda at loss on which one to use and will do what I need it to do. Could you post a circuit maybe?

    I have some random transistors and·a Operational Amplifier IC 324.

    By the way thanks for posting!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-15 01:53
    Sorry Philldapill... I didn't see your post.
    I will try that and get back to you on how it goes.
    Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • Carl HayesCarl Hayes Posts: 841
    edited 2009-02-15 02:07
    Phil's suggestion is good, except that for highly inductive loads like motors you need a "kick" diode across the load to avoid destruction of the transistor when it tries to shut off the current through the inductive load.· Here's a schematic to follow.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
    1000 x 739 - 9K
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-15 02:09
    OK... I tried it and I am still having some trouble...

    I forgot to mention that I am only using one motor for the back wheels. You apply voltage and it goes forward and reverse the voltage and it goes backward. The front wheels turn so that the car can turn...

    The front motor is the same, apply voltage to one of the wires and the wheels turn one way. Reverse the voltage and the wheels turn the other way.

    So I can't apply one of the wires of the motor to positive or negative cause I need them both and have to apply positive to both wires at different times quite frequently.

    In my bs2 program I am just sending low to one of the wires and high to the other to go forward and backward.

    But again the positive 5v from the output pin is not powerful enough to drive the motors.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-02-15 04:10
    Ew, in that case, Dan, you'll need something called an H-bridge circuit. It's a little more complex, involving 4 transistors instead of 1. An H-bridge is used to reverse the current through a load. In your case, it is a motor which will go in reverse and forward. How much current are you talking about pulling? If it's less than 2A per motor, you can use a nice little Dual H-bridge chip that has, well, two h-bridges. The chip is L298 and is rather pricey. I'm in a Printed Circuit Board making mood... If you tell me what exactly you need your circuit to do, I think I can whip a board up, and sell it to you for cheap [noparse]:)[/noparse]
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-15 05:25
    An H-bridge circuit like the one shown: http://www.electronicsteacher.com/robotics/images/hbridge.gif

    I am not sure how many Amps the motors can run on. They don't say,

    I am also not sure how the H-Bridge circuit works, so I don't think I am ready for a circuit board yet. Thank you though! I may take you up on that. But is that one of the only ways? Is there any other options?

    Thanks for the info!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • LeonLeon Posts: 7,620
    edited 2009-02-15 10:50
    Why don't you measure the current taken by the motors?

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-02-15 18:58
    Wikipedia has a pretty good page on the H-bridge circuit here:
    http://en.wikipedia.org/wiki/H-bridge

    It's basically just a circuit that switches the polarity of the motor leads. And yes, measure the current.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-15 23:14
    I actually don't know how to measure the current. Would I do it with a ammeter?

    Couldn't I use relays instead of the H-Bridge Circuit?



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-15 23:28
    Yes, you can use relays instead of an H-Bridge. You would still need to know the amperage of the motors so you'd know what relays to use. You need to know the average current under a typical load and the peak current under heavy load or when the motor is stalled under excessive load. Yes, you'd measure this with an ammeter.

    Relays are relatively slow. You don't want them to have to switch full current because that's harder on the relay contacts than switching them when the current is off not to mention that the current when you reverse a motor is pretty high.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-15 23:41
    Ok... This might sound really dumb... but. I don't know how to measure the Current of a motor. shakehead.gif
    Could you explain how?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • SRLMSRLM Posts: 5,045
    edited 2009-02-15 23:47
    The easiest way is to use a power supply that will allow you to set the voltage and show how much current you're drawing. If you don't have access to one, then you could use a multimeter. Hook the multimeter in series with the motor and your source of power, and turn it on. A couple of things to consider: make sure that your multimeter is set on current, make sure that it can handle the amount of current that you expect to measure, and make sure that you don't provide high current for longer than it can handle. As an example, my multimeter can measure up to 10 amps, but it can only measure for up to about 15 seconds every 15 minutes, unfused.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-16 00:19
    I did that and the result was 0.64A for the back motor and 0.32A for the front motor.

    Is that abnormal?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-02-16 02:55
    Dan, try measuring the current when you stall the motor. Hook everything up like normal, but grab the shaft with something and try to make it stop. THIS current reading is the one you really need, since it's the worst case scenario. If it's under 2A, an L298 would do fine.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-16 06:47
    My results after holding both the motors while testing them was 1.95A for the back motors and 0.23A for the front one. So they are both under 2A!

    So what do you call expensive for the L298 chip?

    Cause I don't have much room for a circuit board. Though I probably could fit it.
    Or maybe I could just build it on the breadboard.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor

    Post Edited (Dan Taylor) : 2/16/2009 5:17:14 PM GMT
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-17 00:09
    I found it at a lot of places on the web selling the L298 chip for $4.99.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-17 18:07
    Which one is the right one? http://www.alliedelec.com/Search/SearchResults.aspx?N=0&Ntk=Primary&Ntt=L298&sid=11F84245FFDE

    There is L298N, L298PN... Not sure which one is the one that would work for what I am doing...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
Sign In or Register to comment.