Hi, I'm a noobie and have a Mega2560 on order. I want to control some AC and DC motors, among other things. There are a bunch of Relay Boards with 8 relays, made in China, on eBay. Does anyone have any experience with these? Good? Bad? The specs I can find say they require about 15-20ma to activate the coil. Will the 2560 handle this? Thanks for any help/advice. George B
I use this http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=310735757385 one with a MEGA and it works fine
TrainMan:
Hi, I'm a noobie and have a Mega2560 on order. I want to control some AC and DC motors, among other things. There are a bunch of Relay Boards with 8 relays, made in China, on eBay. Does anyone have any experience with these? Good? Bad? The specs I can find say they require about 15-20ma to activate the coil. Will the 2560 handle this? Thanks for any help/advice. George B
You didn't post a link so I am going to link in a typical board:
There are three currents you need to think about: Signal strength from the Arduino to the optocoupler needed to activate the optocoupler. Current from the optocoupler to the relay needed to activate the relay. Current passing through the relay needed to operate some real world device.
I think the figure you are quoting is the amount of current the relay itself pulls when it is activated The amount of signal current that the Arduino needs to provide to the optocoupler is small and you don't have to worry about it. It's about the amount needed to light a really small LED. The relay board has a VCC and GND pins which provide the current used to actuate the relays. You can run this off your Arduino but you can also supply it yourself off of any 5V regulated supply. If it really only takes 20mA then the pull on the Arduino is 160mA for all channels activated. The Uno can get 500mA from USB and I think more if it is using external power so I think you would be OK. If you wanted to power more than one board, I would go with some external power supply.
Experiences: good. You will have no trouble with this, it's easy to use. These parts are cheap and reliable. (enough so for a hobbyist.) Be careful about mains voltages if you are going to use that, of course. Try the low voltage DC motors first.
Luxxtek and JoeN, Thank you both for your replies. Yes. These are the relay boards I'm talking about. So the Arduino doesn't drive the relay coil itself? It connects to an optocoupler or transistor on the relay board and THEY activate the relay coil? Sounds like they work fine together then. And yes,I will be powering the relay board and quite possibly the 2560 with external supplies. And there will be a separate supply for the devices that the replay will activate. George
The board I use does not have optocouplers, only transistors to keep the arduino output current low.
Optocouplers were not required for my application
What are the advantages/disadvantages to using a board with transistors or optocouplers? Does one or the other draw less current from the Arduino? And, when would optocouplers be required, or not? I just want to make sure I buy the correct board. I'm going to be using the relays to turn small AC and DC motors on and off. Thanks.
I think the reason that some boards have optocouplers, is because they were designed by someone which isn't really good at electronics.
The isolation on the PCB itself is often not good enough to warrant an optocoupler.
// Per.
What are the advantages/disadvantages to using a board with transistors or optocouplers?
The optocouplers will keep your arduino electrically isolated from the relay electronics on the relay board. If there isn't much price or performance difference, I'd probably go with the optocoupler board.
zoomkat:
The optocouplers will keep your arduino electrically isolated from the relay electronics on the relay board. If there isn't much price or performance difference, I'd probably go with the optocoupler board.
$7.50 delivered. They make buying these an easy decision!
Electrically isolated sounds good to me. Another question.....how far from the Arduino board can I mount the Relay board? And a related question.....I'm going to be hooking up some HO scale traffic lights straight to the Arduino outputs. The LEDS draw about 5ma @ 5VDC. Could I place the lights a 2-3 feet away? Thanks.
TrainMan:
Electrically isolated sounds good to me. Another question.....how far from the Arduino board can I mount the Relay board? And a related question.....I'm going to be hooking up some HO scale traffic lights straight to the Arduino outputs. The LEDS draw about 5ma @ 5VDC. Could I place the lights a 2-3 feet away? Thanks.
Distance issues usually come into play for high speed signals. Since you only turning these on and off at such very low frequencies it sounds like they are not really frequencies at all, it doesn't really matter, Long wires act like low value resistors (extremely long wires can act like higher value resistors, of course) so you can calculate the voltage drop across the wire if you want (or just measure it) but I think any length that remains inside your house on reasonably thick wire is never going to cause a problem for the application you describe.
According to this, 10 feet of 24 gauge wire is 0.257 ohms. Not much to worry about.
Thanks. I can't wait to get my2560 and start learning about it!
TrainMan:
What are the advantages/disadvantages to using a board with transistors or optocouplers? Does one or the other draw less current from the Arduino? And, when would optocouplers be required, or not? I just want to make sure I buy the correct board. I'm going to be using the relays to turn small AC and DC motors on and off. Thanks.
If you want to control your locos with the Mega, you could use a motor shield instead of relays. That way, you can use PWM to accurately control their speed and direction. PWM overcomes the 'sticktion' in DC motors, giving you scale slow speed starts and stops, unlike plain DC, which gives a very unrealistic 'startled rabbit' start.
Also Google "traffic lights Arduino" to see how others have programmed them. No need to re-invent the wheel. ![]()
I still use plain old DC for my locos. The focus of my layout is more on the buildings and details. The motors I want to control are for my Carnival rides. Some are 12 volt DC and some are 16 volt AC. But it sounds like a motor shield might be a better way to go. I'll look into it once the rides are built.
TrainMan:
I still use plain old DC for my locos. The focus of my layout is more on the buildings and details. The motors I want to control are for my Carnival rides. Some are 12 volt DC and some are 16 volt AC. But it sounds like a motor shield might be a better way to go. I'll look into it once the rides are built.
You can only use PWM on your DC motors. I'd be interested in seeing the rides working. Maybe you could put a video on YouTube when they're completed.
Yep to PWM on DC only. Might be a year (or more) before the rides are built and running. I still need to finish Main
Street and then start work on the rest of the town. Another plan for the town is to use a light sensor and have the Arduino slowly bring up the town and building lights as the train room gets darker. Not enough time in the day :>)
JoeN:
The Uno can get 500mA from USB and I think more if it is using external power so I think you would be OK.
UNO spec says don't pull more than 200mA through the board. See 5V drop to 4.5 or maybe less.
TrainMan:
Another plan for the town is to use a light sensor and have the Arduino slowly bring up the town and building lights as the train room gets darker. Not enough time in the day :>)
You can put a photoresistor directly in the power line to those lights if there's not too much current, otherwise a resistor and transistor or a relay would be needed as well. That can save you code and wiring.
There is a lot of direct automation you can do with just TTL logic gates. If you want to add Arduino control then just slip an AND gate it to make it only work when enabled by the controller or an OR gate to make it run on command. If you have 100's of pieces that should only need dozens of signals then that might help reduce the number of pins required a lot.