Shop OBEX P1 Docs P2 Docs Learn Events
Stamp resets when relay is energized to drive dc motor...help — Parallax Forums

Stamp resets when relay is energized to drive dc motor...help

SarekSarek Posts: 3
edited 2011-03-10 10:10 in BASIC Stamp
I purchased a stamp II about 10 years ago and before i even opened the package I decided to drop the project I was going to use it on. So, this week I wanted to use it for a simple task. I wanted the Stamp to have an input that would be used as a start button and an output to drive a small 9vdc motor (Toy).
My output circuit is as follows. The output goes through a 390 ohm resister to the base of a 2n2222 transistor. The emitter goes to ground and the collector goes to a one side of a coil of a relay. The other side of the relay goes to +Vdc which is 9 volts (There is a diode across the relay coil). The relay contacts switch 9Vdc (seperate battery source) to the small 9vdc motor.
The program uses a loop to watch the status of the input via a Button command. When the button is pressed, it jumps to code that makes the output go high, then a pause command for 10 seconds and then a Low command to stop the output. It then goes back to the loop to wait for a button press.
I can run this all day without any problems if i don't hook the motor to the relay. The relay will click on at button press and then turn off 10 seconds later.
The problem is when i hook the motor in. What happens is randomely but very often, when the relay is pulled in, the Stamp will reboot. I tried to isolate the signals a little more by having the first relay drive a second relay, but the same thing happens.
What am i doing wrong or what can i add to the circuit to not allow the stamp to reset.
Any help would be appriciated.
Joe

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-10 07:12
    What you describe should work. You're using separate power supplies. You've got the motor isolated. You have the diode across the relay coil. There's something about your setup that isn't what you think it should be. Thoughts:

    1) Your 9V power supply for the Stamp is marginal and sometimes, the extra drain of the relay coil causes the supply voltage to the Stamp to drop too low.

    2) You've got a ground loop and noise from the motor is coupling to the Stamp supply voltage. If everything has a common ground, try separating the motor's ground from the rest of the circuit.

    3) The motor's wiring runs parallel to some wiring in the Stamp side of the circuit and noise is coupling there. Try separating that. Use a twisted pair to connect the motor to the relay and the motor to its power source.
  • SarekSarek Posts: 3
    edited 2011-03-10 07:22
    Thanks Mike for the rapid response. Let me tell you what i had alread done with regards to your suggestions.
    1. At some point during my fustrations, i replaced all batteries with new ones. Same thing continued to happen.
    2. I believe it is a ground loop and noise problem but everything i tried did not help. I rewired the circuit so many times. I tried common grounds and seperate grounds... no help.
    3. I thought the same thing, that is why i added a second relay which was isolated (not on circuit board) from the other relays and the power for the motor was not wired near the board as well. I did not use a Twisted pair....something for me to try!!!! Thanks.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-10 07:40
    Again, what you've described should work. To get useful help here, you're going to have to post more information. Specifically, post a schematic of exactly what you have. Don't just post what you think you have. Actually go over the device itself and draw the schematic from that. It would also help to provide some close-up photos (you still need the schematic!)
  • SarekSarek Posts: 3
    edited 2011-03-10 07:42
    Thanks, I will do that.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-10 09:12
    I'm suspecting some kind of inductive pickup could also be at work here. How long are the leads to your motor? Are they twisted together?

    -Phil
  • ercoerco Posts: 20,256
    edited 2011-03-10 09:43
    How big is your motor, how much current is flowing, and how close is your motor to your Stamp?

    Do you have any filter caps on your motor?

    Post a photo of your setup if possible.
  • PublisonPublison Posts: 12,366
    edited 2011-03-10 10:10
    I agree with erco. Brushed motors need some capacitors to cut down the interference. The capacitors should be soldered from each motor terminal to the motor case. For extra security against interference you can also fit a third capacitor between the 2 motor terminals. .047uF is a good value.
Sign In or Register to comment.