DC motor and basic stamp 2
Ntelos
Posts: 21
Hello there.
I use basic stamp 2 (5 Volt ) and i have a dc motor (6 volts). I would like to connect the motor to the controller.
I was told that the simplest way is to use a 6V relay (with two inputs) and connect the motor and the controller and it should work fine.
Another solution is to use H-bridge but i don't know which solution is the safest for the controller.
Does anyone know if the relay - solution will work?
If not, where i could find a circuit with h-bridge, so i can use one for the project?
Thanks in advance
I use basic stamp 2 (5 Volt ) and i have a dc motor (6 volts). I would like to connect the motor to the controller.
I was told that the simplest way is to use a 6V relay (with two inputs) and connect the motor and the controller and it should work fine.
Another solution is to use H-bridge but i don't know which solution is the safest for the controller.
Does anyone know if the relay - solution will work?
If not, where i could find a circuit with h-bridge, so i can use one for the project?
Thanks in advance
Comments
Do a web search for "wiki h-bridge". You'll find a nice article explaining how an H-bridge works and links to examples including circuits. The StampWorks Manual also has some examples since the PDB (Professional Development Board) has an L293D H-bridge IC. See under "Downloads & Resources" here:
www.parallax.com/StoreSearchResults/tabid/768/txtSearch/stampworks/List/0/SortField/4/ProductID/144/Default.aspx
Just wanted you to look over both options.
Best of luck on your endeavors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious
If it works, i will post the solution. Otherwise i will try the circuit you posted!
Thank you a lot anyway!
Let me know how it goes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious
Guess I should leave ya be now...
GOOD LUCK
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious
Post Edited (EverQurious) : 6/2/2009 12:40:13 AM GMT
It also works with steppers
________$WMc%______
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
That means that if i disconnect the wire going from the controller to the 390 Ω resistor, then the motor still works. Is there any mistake in the wiring or what?
Thank you in advance!
2) Unless you have a very small motor, it's best to power the motor directly from a 6V supply instead of the regulated +5V supply.
I change the diode as you said.
The program is something like that:
OUTPUT 10
OUT10=1
PAUSE 3000
OUT10=0
PAUSE 2000
so i can test the function of the motor.
When i changed the direction of the diode:
1)At first, the motor tries to start and then i listen a 'tick' sound from the relay. This happens 3-4 times.
2)Then, the relay starts working for 3 seconds and then it stops for w seconds and this function repeats 2-3 times.
3)Then, the step 1) happens again but the motor does not start. It tries to start and i hear the 'tick' from the relay, without starting working.
When i closed the main switch and opened it again, the motor started to work continuously like before. Is there any possibility to be relay's fault? What 'tick' sound from relay is for?
In the project i am working to, i cannot connect the motor directly to power supply, because i want to connect the motor function with something else. (i.e.: if the photoresistor works, the motor works - something like that. So i need to guide the motor through the controller).
And something else...
If i want to reduce the speed that the motor turns, am i going to use just a trimmer?
Thank you in advance
Post Edited (Ntelos) : 6/8/2009 9:10:13 PM GMT
I think Your using a normally closed contact were you wanted a normally open set on the relay. This would explain why the motor runs continuously when you disconect the base lead from the stamp.Heres A little code short cut.You can use HIGH and LOW instead of OUTPUT and OUT
HIGH 10
PAUSE 3000
LOW 10
PAUSE 2000
is the same as
OUTPUT10
OUT10 = 1
PAUSE 3000
OUTPUT10
OUT10 = 0
PAUSE 2000
______________$WMc%_________
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
If i disconnect the lead from the controller, the motor works continuously.If i connect the lead then i hear the 'tick' from the relay.
I changed the duration from 3 seconds to 6 seconds and i noticed that, when i turn on the main switch then i hear the 'tick' from the relay the motor starts but it stops.
Its like it takes an amount of current for a millisecond and then it stops. (like you give it a turn nothing more). Then it stops for 6 seconds and the same again.
I just wanted to make a demonstration of how a relay can work (university project).
Thanks for you time all of you!
I would read up a little more on relays before I posted anything on a University Project!!!
___________$WMc%_______
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
For this project - assignment i have done quire a lot, so if the relay doesn't work because i have to find one that draws less current, it doesn't matter that much!
Thanks anyway!
Also It would be nice to see the internal wiring of the relay you are using to see what it is actually switching.
I don't know how you tend to employ this circuit but remember if you want bi-directional control you will need to duplicate the circuit.
This can be done two ways. the first involves 2 lines one controlling direction and the other controls the motors run / no run status.
The second method that I used in my controller above also uses 2 lines but the controls motor activity and direction together.
I personally like this method better because if you send it no signal, nothing happens, a high on line one runs forward and a high on line two runs bacwards.
The other advantage is if you accidentally send a high to BOTH lines the motor will also not run. ( FOOL PROOF )
I used the 5 volt mini 10 amp relays available at your local Radio Shack. ( which has the full internal connection drawing on the package. )
At any rate see if you are using a NC or NO relay and try to provide an internal wiring / pinout on your relay.
let me me know if this helped at all. And if you got her going.
Good luck. and feel free to message me if I can help anymore.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious
You are right about reading. I read how it works but there is so much to do for lots of projects (not really projects - more like assignments), so many times you cannot handle all of it.
For this project - assignment i have done quire a lot, so if the relay doesn't work because i have to find one that draws less current, it doesn't matter that much!
Thanks anyway!"
Have You checked the current draw with a meter? I think Mr Green may be on to something. The best way to tell is with a current meter.
One last thing. If it doesn't matter that much!...Don't PM Me!!!
___________$WMc%__________
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
Post Edited ($WMc%) : 6/12/2009 1:36:04 AM GMT
Now, i am going to try the EvenQurious's solution with the two relays for the bi-polarized function of the motor. All i need is a second 5V power supply.
Any suggestions?
Do i need two power supplies or i can do it with one 5V DC?
Let me know how it goes
PS. One power supply is all you need just DO NOT try to drive the relays ( or motors ) directly from the BS2 lines or supply. It will fry the I/O s.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious
Post Edited (EverQurious) : 6/11/2009 6:52:39 PM GMT
The two coils of the relays are connected each other and then to the ground.
The other side of the coils is connected to each emitter of the 2N2222A npn transistor.
The bases of the transistor are connected through the resistors to the two outputs of the controller and the two collectors are connected to 5V DC.
The two n.o. are connected to each other and then to 5V DC.
The two n.c. are connected to each other and then to ground.
The two wires of the motor are connected to the two common pins of the two relays. The circuit you sent me doesn't show any connection of the motor to the ground.
This is how i understood the circuit you sent me. If is anything wrong with it, i understood something wrong.
Otherwise, perhaps i didn't understand where the common, n.o. and n.c. pins are on the relay.
From the schematic of the relay (it is shown at the picture attached at the left - bottom), i understood that common are pins 8 and 9 (the first column). 11 and 6 are n.c. pins and 4 and 13 are n.o. pins. Is this correct or i understood the wrong way?
Try these changes and include where your motor (load) is in the circuit if you post it again.
Note that my design uses 2 power sources ( one for the relay control circuit and one to power the motor/s ). For my application this proved beneficial, however both circuits will work just fine with only one battery/power supply. just tie both positive power lines together and both negative power lines together and omit one battery.
also insure the circuit and the BS2 share a common ground.
Hope this helps. Let me know.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious
Post Edited (EverQurious) : 6/13/2009 2:38:11 AM GMT
When i do this, when i try to load the program to bs2, the program does not recognize any basic stamps.
If i disconnect the cables that connect the two breadboards, then the program recognizes the bs2.
So, i will try to transfer the motor circuit to one breadboard
Hope this helps and keep me posted.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious
I have found the RadioShack mini 10 amp contact relays rated at 5 volts and this circuit as a whole will run on anything from 5 to 9 VDC.
Best of luck
OH. Please excuse the typo on my drawings. The transistors are 2N2222 NOT 2N222. I'm sure everyone caught that boo boo.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious
Thank you for your time!
It really helpped!
Thanks again!
Post Edited (AMPED) : 8/26/2009 6:41:21 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EverQurious