trying to flip relay but servos move?
thebucketmouse
Posts: 20
So I have 2 servos, one on P7 and one on P13 with a BS2 board of education. Also, I have a reed relay with the coil·tied on one end to P1 and on the other end to VSS. I'm trying to get the stamp to flip the relay using HIGH 1, PAUSE 200, LOW 1 but whenever it does this the relay does not switch, but my two servos both move clockwise??? How is this even possible? The only way they are attached is where they come together at VSS.. other than that the servos have no contact with the reed relay. Please help me understand what I'm doing wrong.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
·Also if you don't refresh them every 20ms they loose interest and motivation in keeping still.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Post Edited (Franklin) : 5/17/2009 8:35:14 PM GMT
You could post a picture...
Add some code to the beginning of your program that makes a sound or lights up a LED, that way if the Stamp is resetting you will get an audio or visual indication. The BoeBot manual , page 105, describes how to do this - they call it a brownout detector.
Rich H
Post Edited (W9GFO) : 5/17/2009 11:40:00 PM GMT
and at W9GFO, could you expound on that a little bit about the brownout detector? I would put the buzzer in my code before attempting to flip the relay, and then what?
A reverse biased diode across the relay coil is a must to prevent back EMF entering into the Stamp. Connect the Anode of the diode to Vss, and the Cathode of the diode to the I/O pin.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Then if you hear the buzzer go off, you know the stamp reset itself and began running the code from the beginning again.
You can post your picture inline if you do the following;
Use square brackets"[noparse][[/noparse]" instead of the "(" though.
Rich H
Post Edited (W9GFO) : 5/18/2009 2:38:31 PM GMT
So the diode would be in parallel with the coil? How would that stop the EMF from traveling through the coil??
The principle of Back EMF is used to advantage in a car where the coil is energised and de energised rapidly by the points, the high voltage pulse is output from the coil to produce a spark at the sparkplugs, now imagine this energy being discharged into your stamp, get the picture?
this time I made a video if that helps outline the problem any better
www.youtube.com/watch?v=Un1PWeY5GXs
Post Edited (thebucketmouse) : 5/18/2009 11:15:34 PM GMT
Rich H
Usually servos only move when they get a certain pulse signal, and since both servos move to the exact same position they are getting the same signal at the same time.
I've tried this, and I'm pretty sure it did the same thing.
As I drew in the diagram, the servos are only connected to an I/O pin, VSS and VIN.
I think it could be something to do with this back-EMF pulse they were talking about a couple posts back, because the relay circuit and servo circuits are totally separated. There's no way the relay would affect the servos unless the basic stamp itself freaked out because of the back-EMF. Unfortunately, the parallel diode didn't help stop it...
Another thing confusing me is that the servos don't go crazy when the external battery pack is switched off (this is shown in the video), but I can't see how the battery pack would affect me sending the HIGH signal through the relay coils.
Post Edited (thebucketmouse) : 5/19/2009 12:17:46 AM GMT
You will want to have the servos drawing power separately from the stamp. That could be a source of trouble now but certainly will be once you get the gun and ping servos moving.
As an experiment, create a repeat loop that keeps the servos centered. Pull the jumper out of P1. Then with that running touch the jumper to vdd to simulate the pin going hi and see what the servos do.
Wait a minute, VIN for the servos? That is unregulated - 9 volts! Servos don't like more than 6.
Rich H
From page 1 of the Homework board manual...
Wiring the servos to VIN would be fine if you were using a battery pack of 4 or 5 cells instead of the 9 volt battery to power the stamp.
Rich H
Post Edited (W9GFO) : 5/19/2009 1:50:33 AM GMT
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Rich H
The schematic below lowers the I/O current requirement down to about 4.4mA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Have you ruled out brownout 100%? If so how?
Have you tried Franklin's suggestion?
I have been there - suggestions come in that I don't think will help. Much of the time they don't correct the problem but I do them anyway so that I can check them off the list and move on. Way back when I first started with the BoeBot I had a problem that I was sure wasn't brownout related. I spent a great deal of time trying to track down the cause. I skipped over the boring suggestion of checking the battery because I was sure that something mysterious and interesting was going on. Nope, I finally got to the point where I would try anything and checked the battery which was new just a short time ago...
It's a hollow victory solving such a basic problem after so many hours of work.
Rich H
Rich H
I made a script to first light the LED to check against brownout, then it moves the servo to a certain position, flashes the LED again to indicate thats done then fires the gun. And the servos don't move anywhere. That's great... I'm gonna program it some more tonight and include the script for the PING rangefinder and such, but it looks like we've solved the problem. Thank you so much everyone, especially you W9GFO