Go Down

Topic: 16 Channel Relay Hook Up To Arduino Uno (Read 35741 times) previous topic - next topic

Knightriderguy

I picked up this 16 channel relay board from eBay:
http://www.ebay.com/itm/111642135626?_trksid=p2060353.m1438.l2648&ssPageName=STRK%3AMEBIDX%3AIT

It did not come with any kind of instructions so I'm wondering if anyone has hooked one of these up the the Arduino Uno and if so how they did it.

Thanks.
one Artist CAN make a difference.

johnwasser

The "low level inputs" hook to Arduino output pins.  The GND pin connects to Arduino ground.  The two screw terminals near the low level inputs provide 12V for the relay coils.  You will need a 12V supply and they don't bother to say how much current.  When the board arrives, search for the relay model number to find out how much current each coil draws and multiply by 16.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Knightriderguy

The "low level inputs" hook to Arduino output pins.  The GND pin connects to Arduino ground.  The two screw terminals near the low level inputs provide 12V for the relay coils.  You will need a 12V supply and they don't bother to say how much current.  When the board arrives, search for the relay model number to find out how much current each coil draws and multiply by 16.
Thanks johnwasser,
I was looking for something like a wiring diagram that showed all the pinouts and how they connect to the Arduino Uno.
one Artist CAN make a difference.

Wawa

Could be this one.
http://www.selloutsoon.com/albums/documents/20-018-103/16-relay.rar
Beware. 16-channel relay board with optos, but without opto isolation.
Leo..

billhowl




Quote
So here are some specifications that we can all use:

Overview:
1. The 12VDC input requires > 500mA.
2. The drive to each control input pin must "sink" 3mA when low (low = relay ON).


***** Input Power (12 VDC input)*****
- About 8 mA is required with all relays off.
- Each relay requires about 30 mA when on.
- So max supply current is 8 mA + (16 x 30 mA) = 488 mA (actual measured was 500 mA)
- Because one may use the board's +5 VDC output (2 pins) to power an Arduino/PIC circuit, use a 12V power supply that can provide MORE than 500mA (depending on your circuit's requirements).
- Note that the switching regulator on the Relay Board should somewhat efficiently (say 70%?) convert the board's 5V power usage to 12 V power input requirements. For example: 200mA at +5VDC (1 Watt) does NOT mean the +12V supply needs to supply an additional 200 mA also. This is because 1 W of power from the +12V supply only requires about 83 mA ( 12 V x 83 mA = 1 W ); however at say 70% efficiency of the 5 V regulator, this goes up to about 120 mA (83 mA / 0.7) but NOT the full 200 mA.

NOTE: The best way to discover what 12 V supply is needed (its max current rating) is to ACTUALLY MEASURE the 12 V input current while using a "test supply" that can more than handle worst case (with all relays ON) then buy the supply that meets your needs. Always use a modern "switching" supply (wall wart) because they are smaller, way more efficient, generate little heat, and normally use much less "vampire power".

- The baord's LM2576 (+5V) voltage regulator is rated at 3 Amps; however, one should not push it this hard. The circuits powered by the 5 V supply on the Relay Board appear to only be the LED side of the opto-isolators. Driving an input control line low turns on an opto-isolator LED ... turning on its relay. Each opto-isolator LED seems to require about 3 mA (for a total of 3 mA x 16 = 48 mA). This should leave you with at least many hundreds of mA available to power your circuits off of the relay board's 5V output pins (two of them on the connector).

***** Input control pins *****
- Grounding an input control pin (logic low) turns on the associated relay.
- The circuit driving the input control pin must be able to "sink" (drive logic low) about 3 mA of current (easy for most PIC/Arduino output pins).
*** CAUTION *** When a pin is NOT driven low, it "floats" to nearly the +5 V that drives the opto-isolators. This means that the driving circuit (Arduino/PIC) must either be also powered by +5V, or if powered by the now common 3.3V (or less!), its output pins must be "5 Volt Tolerant" (see your micro-controller pin specs). Another option is use of a "5V tolerant serial port expander" chip like an MCP23018 (I2C interface) or MCP23S18 (SPI interface) ... where just a few micro-controller pins give you 16 I/O pins. These can be powered by 3.3 V or 5 V. They are a bit complex, but a simple "software bit banged" I2C or SPI interface can be used to control them. Finally, one could use little signal transistors (2N3904) for this isolation from the 5 V (MCU pin -to- a say 2.7K resistor -to- transistor base, emitter to ground, collector to relay board input control pin).

Knightriderguy

Thanks guys, well ultimately the whole thing will be going in a car and powered by the 12V car battery, The relays if I'm understanding the way they are wired on the board I think I can just switch ground with the switch side of the relays.
The Arduino will be powered by a computer's USB port which also sends the signals or characters to the Arduino to set the pin states. I have a few that are set to generate a momentary pulse so that some of the pins will only be on for about half a second.

I hope that kind of helps describe my intended use. But I'm not totally sure I fully understand that schematic, it looks a little complicated to me.
one Artist CAN make a difference.

dave-in-nj

the key to the schematic is the columns of blue opto-isolators.

the relays you see, the blue cubes, have a coil and a set of contracts.   the coil it isolated from the relay and is only in the same housing.  the coil creates an electromagnet and that effect the contacts.
so, you can have 5v on the coil and 230VAC on the contacts and they are completely isolated.

but.... what you have is a second layer of isolation.
a relay coil is the same as a motor coil, is the same as a solenoid coil, is the same as an electromagnet coil... etc.

you feed it power and it converts power into an electromagnetic field. the bit in the center of the coil does something.
for an electromagnet, it, well, makes a magnetic field.

if you look at any of the relay 'how to' diagrams, they show power on the coil, then a transistor on the other side of the coil and then the transistor connects to ground.   in this application, it is like a switch.  you use the Arduino to turn the transistor on and off and that charges the coil.

but, what you have is an opto-isolator.  one half is an LED.  yup, your ordinary, light it everyday LED.  the LED energizes the transistor and the transistor acts as above.

the bottom line is that your arduino pin is only lighting an LED, you need to pass about 5 to 20mA on that circuit. not sure if you need to source that to the LED, or if you need to sink that from the LED that gets power elsewhere.

Since you are using a store bought 8 channel board, there is no provision for you to do anything about diodes and such on the coil and there is no risk of the coil burning out your pins on the arduino.

you can burn out a channel if you pass more power than the LED can take, but the opto can be replaced too.


the notes on post #4 say the LED is driven with 3ma and you must sink that, or bring that to ground.

the link on post #1 was to a 12v relay board, see if the relay board already has resistors.  I cannot tell, but it does not look like they exist on the board.  just add a 3.9k resistor and bring the channel to ground. if the board has one, the channel will not work.  if the channel works, then just add them in series between the channel and your pins.
you bring the pin low to activate.





dave-in-nj

Beware. 16-channel relay board with optos, but without opto isolation.
Leo..

this is a common complaint. why bother putting in opto's if you have to tie the grounds together.
generally speaking, when the grounds are tied together and you use the 12V power supply as the source and you sink the power to light the LED, the opto is really just a fancy transistor, in your circuit.
however, with the 3.9k resistor, the amount of power that would pass through the arduino is so minimal, there is little risk

Wawa

The Arduino will be powered by a computer's USB port...
Nope.
This relay board is hardwired to Arduino's 5volt rail.
Depending on which Arduno, it could backfeed your computer's USB port.
Leo..

 

Knightriderguy

Nope.
This relay board is hardwired to Arduino's 5volt rail.
Depending on which Arduno, it could backfeed your computer's USB port.
Leo..

 
So that all being said how should I best approach this given that I need to send dat to the Arduino from my computer / eventually a small computer for the car?
one Artist CAN make a difference.

Wawa

Too many unknown factors.
Which Arduino. Which computer. How are they supplied/grounded.
How/where is the relay board grounded/supplied.
Problem is that 16-channel relay boards do not have the option to separate relay supply from Arduino supply.
8-channel relay boards do.
What will happen if you power-up the relay board before the computer, backfeeding 5volt in the USB connector.
Dunno. I'm sure you will find out.
Leo..

dave-in-nj

So that all being said how should I best approach this given that I need to send dat to the Arduino from my computer / eventually a small computer for the car?
the answer is easy.
un-solder those opto's and put then on a separate board.  or find the common ground or common power and actually isolate them from the relay power supply.   this should not take too long and would be pretty straight forward.
it is very odd that the relay board designers did not bother to offer two power options, one from on-board and one from off-board.

Knightriderguy

the answer is easy.
un-solder those opto's and put then on a separate board.  or find the common ground or common power and actually isolate them from the relay power supply.   this should not take too long and would be pretty straight forward.
it is very odd that the relay board designers did not bother to offer two power options, one from on-board and one from off-board.
So would a different 16 channel relay board be a better and safer option then?
one Artist CAN make a difference.

dave-in-nj

Wawa offered that the 8 channel can come with isolated inputs, but the 16 channel does not.
it would be easier to buy a board that has them, unless you were good with the soldering iron.

Wawa

Three options
1) Plug and pray.
2) Buy two 12volt 8-channel relay boards with JD-VCC jumpers (you could stack/sandwich the boards with long spacers).
3) Mod the 16-channel board you have so it's opto isolated (need some soldering experience).
    I/we can talk you through it (if the board layout is the same as the Sainsmart board).
Leo..

Go Up