Shop OBEX P1 Docs P2 Docs Learn Events
Simple Push Button Issue — Parallax Forums

Simple Push Button Issue

NWUpgradesNWUpgrades Posts: 292
edited 2012-06-28 21:34 in General Discussion
OK, So I am obviously having a brain fart on this one. In looking at the Push Button example on page 73 of WAM, I am trying to figure out how to do the same thing with a 3 V DC motor. When I connect power the motor spins and stops spinning when button is pressed. I know it is something simple but that illudes me right now. I have 1k resistor to power then to top of button. Then bottom of button to ground. Any help is greatly appreciated.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-06-28 20:11
    You can't do the same thing with a 3V motor. A motor draws a lot more current than an LED which might draw 10mA. Which version of WAM are you looking at? I have V3.0 and page 73 finishes Activity #3 and starts Activity #4.

    How do you have the motor hooked up?
  • NWUpgradesNWUpgrades Posts: 292
    edited 2012-06-28 20:21
    Version is 2.2. I have the motor connected to top pin of PB, then to a 1k resistor then to pos. I have ground to bottom pin of PB. Basically, the circuit is reversed in that applying power spins the motor and pressing the PB stops it.

    I do not think it is a power issue. The motor is small enough that even a coin battery will turn it.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-06-28 20:27
    The way you've described the connections, it can't work the way you've described it. A DC motor has two connections. Where are they connected? Maybe you could draw a schematic.
  • NWUpgradesNWUpgrades Posts: 292
    edited 2012-06-28 20:32
    Will try to explain as my drawing is not too great. Positive of motor is connected to top pin of push button, that in turn goes to a 1k resistor and then to positive power source. Negative of motor goes to bottom pin of push button and that in turn is connected to ground of the power source.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-06-28 21:16
    So, the pushbutton shorts the motor. The current through either the motor or the closed pushbutton is limited by the 1K resistor. Say you're running the whole thing off 6V. The 1K resistor will limit the current through it to at most 6mA (= 6V / 1K by Ohms Law). Say you're running it off 3V. That's 3mA. If you tried to run it off a car battery at 12-14V, that would be 12-14mA. In any case, it's not enough current to operate the motor with any kind of mechanical load on it.

    If you want to operate the motor when the button is pushed, you connect one end of the motor to ground, the other end of the motor to one terminal of the pushbutton, then you connect the other end of the pushbutton to +3V. That's it. The motor itself will limit the amount of current drawn by producing a "back EMF" that opposes the supply voltage. LEDs don't do that so you have to have a separate current limiting resistor. If you use the diagram in WAM for a pushbutton that provides a signal for a Stamp I/O pin, the 1K resistor limits the current through the pushbutton to some reasonable amount (= 5mA = 5V / 1K) otherwise the pushbutton would act like a short circuit across the power supply.
  • NWUpgradesNWUpgrades Posts: 292
    edited 2012-06-28 21:31
    Thank you. Problem solved.
  • BitsBits Posts: 414
    edited 2012-06-28 21:34
    Mike

    love the way you describe the back EMF a motor creates that in turn keeps the motors current limit in check. Frankly I never heard it describe so elegantly before and now I can see what it is that use to be foggy.

    That said, could a circuit be developed to control the current through a motor by employing a variable inductor in series with the motor? Just asking to clarify, or support. my new found understanding of back EMF.
Sign In or Register to comment.