is this a right layout for controlling the motor ? and i want to use input 1 and 2 to trigger the on/off and forward/reverse. can it be done? thanks in advance for help.
An H-Bridge would make more sense, but depends on the application (high power relays are probably cheaper than high power transistors above a certain rating). I think that will theoretically work, but you will definitely need to make sure you turn the motor off before switching directions or you may risk shorting out your power supply. And do not try to PWM the motor. Relays and PWM don't mix.
sorry if im a bit slow. so, can i still triggered it by using the high/low status from arduino with delay before changing direction? in my scenario, im using 2 ir sensor as inputs to trigger those circuit as outputs. or maybe a better suggestion? because i cant afford to include more device as my coding is a bit slow.
Yes, by using the ULN2003, you can turn on a relay by setting the input pin high and off by setting it low. However, I would be very careful to turn off the motor (Pin 1) wait to make sure your relay has settled to off, THEN switch your direction, wait for the relay to settle, then turn the motor back on. Otherwise you might accidentally manage a short your power-supply if things don't switch consistently.
That all being said, an H-Bridge circuit is usually more appropriate for this type of thing.
and another question, is it better to separate the Digital IR or make it both assigned as same input pin? in case of ease of coding.
mirith:
wait to make sure your relay has settled to off, THEN switch your direction, wait for the relay to settle, then turn the motor back on. Otherwise you might accidentally manage a short your power-supply if things don't switch consistently.
Sorry, that did not make sense to me. If the direction relay is a double pole double throw then no amount of turning relays on/off wil make a short (unless the relay is very cheap crap) Where you thinking of arcing or back EMF of the motor?'
Maybe the OP (ohandl) should tell us the power/voltage ofthe motor - it may not be significant.
Msquare:
mirith:
wait to make sure your relay has settled to off, THEN switch your direction, wait for the relay to settle, then turn the motor back on. Otherwise you might accidentally manage a short your power-supply if things don't switch consistently.Sorry, that did not make sense to me. If the direction relay is a double pole double throw then no amount of turning relays on/off wil make a short (unless the relay is very cheap crap) Where you thinking of arcing or back EMF of the motor?'
Maybe the OP (ohandl) should tell us the power/voltage ofthe motor - it may not be significant.
@MSquare
There is no guarantee that both actuators on a relay will switch at the same time, and there is always some bouncing, as well as arcing/back emf from an inductive load. Basically, relays don't really switch cleanly, though 99% of the time, it will be perfectly fine.
@ohand1
Unless you want both IR sensors doing the exact same thing, then you want to hook them up as separate pins.
I'm looking at a datasheet here for the ULN2003A:
Page 12 shows some sample app schematics. If you look at the output side of figure 19 or 22, you'll see a couple of differences to your schematic.
First - the high-side of your coil isn't connected to the ULN2003A common. Also, your ULN2003A ground - pin 8 - isn't connected (actually, pin 8 isn't even on the diagram?). Finally, you probably won't need the flyback diode across the coil, if connected as in the sample application schematics (the schematics don't show one).
I would also second the suggestion of going with a "true" h-bridge design using two SPDT relays instead.
If you need the ability of free-wheeling, a third SPST relay can be put in-line with the low-side ground to enable that ability (otherwise, you always have "brake" with the dual SPDT design). If you instead want speed control (while still having a relay h-bridge), you could put an n-channel mosfet driver on the low-side before the ground, and PWM that (make sure to pick a proper mosfet with the appropriate current handling - and don't PWM the speed while switching the relays, unless you want to weld your contacts).
ohand1:
is this a right layout for controlling the motor ?
other people have suggested H bridge, for which many components (and even a controller board) exists.
Check out Adafruit's motor shield for ideas
it uses a MOSFET driver for the motor. You can purchase power MOSFET drivers for H bridges from digikey that exceed the current limits on this board, if you need more current. This board's design might give you ideas on how to build your own, though.
Why ARE you using a magnetic relay, anyway? It has been my observation that power MOSFETS and H-bridges are probably a lot cheaper, when you take all things into consideration. Often these bridges will have 'kickback' diodes already on them, so you don't have to worry about arcing or adding your own protection diodes.
Anyway, don't forget that motors are inductors, and suddenly breaking current flow on an inductor results in a potentially damaging spark unless you do something to make it NOT happen (such as 'kickback' protection diodes, arc chutes on a contactor relay, etc.)
cr0sh:
I'm looking at a datasheet here for the ULN2003A:http://www.ti.com/lit/ds/symlink/uln2003a.pdf
Page 12 shows some sample app schematics. If you look at the output side of figure 19 or 22, you'll see a couple of differences to your schematic.
First - the high-side of your coil isn't connected to the ULN2003A common. Also, your ULN2003A ground - pin 8 - isn't connected (actually, pin 8 isn't even on the diagram?). Finally, you probably won't need the flyback diode across the coil, if connected as in the sample application schematics (the schematics don't show one).
Glad you caught that, I completely missed it. It is important.
