Arduino Forum

Topics => Product Design => Topic started by: codlink on Apr 14, 2013, 07:57 pm

Title: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 14, 2013, 07:57 pm
I have drawn up an 8 channel relay board from a couple of different schematics and wanted another set of eyes to proofread it for me.  It is an opto-isolated system that will be controlling 24V max.  

I have never used a relay with an Arduino and I would rather design my own ckt than to just buy one.  As I am aware, this should be an active-low layout.  Are my assumptions correct?
The IN1-IN8 are the Arduino inputs and +5V will come from a Power supply.  VCC will come from Arduino's supply.

Any advice or constructive criticism is welcome.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Apr 14, 2013, 08:38 pm
Design looks ok. Use a picture hosting side without so much spam. Or just attach the pictures to your post:
Click "Additional Options", browse to your attachment.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 14, 2013, 09:01 pm
I guess I'm blind today.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 14, 2013, 09:33 pm

Design looks ok. Use a picture hosting side without so much spam. Or just attach the pictures to your post:
Click "Additional Options", browse to your attachment.


I apologize CrossRoads.  I have been using postimg for years now and never had any spam on my screen.  Of course, I use FireFox with around 5 anti-spam/pop-up/ads extensions.  I am one person that hates ads and pop-ups.  I turned off the blockers and reloaded the page and didn't see anything.  But, I am sorry.

I don't like use the attachment feature when I need to upload large pics as I hate to scroll all over it to see it.

Also, thanks for the extra set of eyes. +1


I guess I'm blind today.


Looking at what?
Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Apr 14, 2013, 09:48 pm
How is scrolling all over an external website any different than scrolling all over in here? In both cases it's too big. Export the picture in eagle so that it comes out ~ 800 pixels wide.  You can modify your post to remove the external pic, and attach the smaller schematic.  I've gone back & "Modify"'d lots of my posts that came out a lot bigger than I thought.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 14, 2013, 09:59 pm




I guess I'm blind today.


Looking at what?


It looks like the schematic is incomplete around the opto-isolator.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Apr 14, 2013, 10:04 pm
I don't think so -  just uses names on the nets vs drawing lines all over the place. Easy to follow.
The IN and VCC/5V headers could have been drawn on the left side of the page to show signal flow a little better, is the only change I would have made.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 14, 2013, 11:31 pm
I hadn't thought about everyone having the same size screen as I.

Original post modified with updated schematic.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Apr 15, 2013, 01:52 am
That turned out well.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 02:03 am
Curious, what is pin 6 on the opto used for?  Should I leave it floating?
Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Apr 15, 2013, 02:14 am
Leave it floating.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 02:15 am

Curious, what is pin 6 on the opto used for?  Should I leave it floating?


You can use it to bias the BE junction by placing a resistor from the base to the emitter and reduce the sensitivity to low level LED light and hence produce a sharper switching action. Normally it is left unconnected.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 02:42 am

I don't think so -  just uses names on the nets vs drawing lines all over the place. Easy to follow.
The IN and VCC/5V headers could have been drawn on the left side of the page to show signal flow a little better, is the only change I would have made.


It's not clear to me how any current ever flows in the collector of the phototransistor. It looks like there is a missing resistor.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: retrolefty on Apr 15, 2013, 02:45 am


I don't think so -  just uses names on the nets vs drawing lines all over the place. Easy to follow.
The IN and VCC/5V headers could have been drawn on the left side of the page to show signal flow a little better, is the only change I would have made.


It's not clear to me how any current ever flows in the collector of the phototransistor. It looks like there is a missing resistor.



Yep, no current source to be seen for the opto collector to relay npn base connection. That dog won't bark.

Lefty
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 02:51 am



I don't think so -  just uses names on the nets vs drawing lines all over the place. Easy to follow.
The IN and VCC/5V headers could have been drawn on the left side of the page to show signal flow a little better, is the only change I would have made.


It's not clear to me how any current ever flows in the collector of the phototransistor. It looks like there is a missing resistor.



Yep, no current source to be seen for the opto collector to relay npn base connection. That dog won't bark.

Lefty


I was hoping OP would catch it. I gave a couple of hints. It's better when you figure it out for yourself, I think.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Apr 15, 2013, 03:00 am
Yes, resistors from Tx to +5 are needed. That would turn on relays all the time (to the NO position) until the INx signals go Low to turn on the Opto and turn off the NPNs.
Can the Opto's  drive the relay coils directly & skip the level of inversion?
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 03:04 am
Hmmm.  Ok CrossRoads you lost me at Tx..  I feel retarded but what Tx are you talking about?
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 03:10 am

Hmmm.  Ok CrossRoads you lost me at Tx..  I feel retarded but what Tx are you talking about?


Your node names, T1-T8.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: retrolefty on Apr 15, 2013, 03:12 am

Yes, resistors from Tx to +5 are needed. That would turn on relays all the time (to the NO position) until the INx signals go Low to turn on the Opto and turn off the NPNs.
Can the Opto's  drive the relay coils directly & skip the level of inversion?


Probably not but datasheet would tell if collector is rated at or above coil current required.

The circuit really should be designed to default to all relays off when there is no opto input signal.
Look towards the end of this e-bay listing for a typical schematic wiring design that should be used.
http://www.ebay.com/itm/4-Channel-5V-Relay-Module-With-Optocoupler-For-Arduino-DSP-AVR-PIC-ARM-/221200546982?pt=LH_DefaultDomain_0&hash=item3380947ca6

Lefty
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 03:18 am
Sorry, but I don't see any difference in the Ebay ckt to mine.  The only thing that I see is that I have a LED and a resistor for the LED on the relay.

Also I don't see (nor have I ever seen) pull-up resisitors on the Inputs.

Not trying negative but I would like to understand.

I attached the opto I am using.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 03:24 am
According to the datasheets:

4N37S has 100mA collector current
The relay needs 150mA
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 03:28 am

Sorry, but I don't see any difference in the Ebay ckt to mine.  The only thing that I see is that I have a LED and a resistor for the LED on the relay.

Also I don't see (nor have I ever seen) pull-up resisitors on the Inputs.

Not trying negative but I would like to understand.

I attached the opto I am using.


The circuit is pretty hard to see for me and I think there is a mistake in it anyway. It looks like the wire shorting out the relay coil shouldn't be there. Notice where the collector of the phototransistor goes and notice that the emitter is not grounded.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Apr 15, 2013, 03:29 am
The e-bay circuit has the opto collecto connected to +5, and the emitter driving the base of the NPN transistor. Opto LED on = current flowing into the NPN Base.  Your design had Otpo LED on turning the NPN base off (low) with nothing to bring it high.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: retrolefty on Apr 15, 2013, 03:31 am
This listing has a clearer picture:

http://www.ebay.com/itm/8-Channel-DC-5V-Relay-Module-for-Arduino-PIC-ARM-DSP-AVR-MSP430-TTL-Logic-/271188081780?pt=LH_DefaultDomain_0&hash=item3f2411bc74

Lefty
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 03:33 am

This listing has a clearer picture:

http://www.ebay.com/itm/8-Channel-DC-5V-Relay-Module-for-Arduino-PIC-ARM-DSP-AVR-MSP430-TTL-Logic-/271188081780?pt=LH_DefaultDomain_0&hash=item3f2411bc74

Lefty


Ah, much better. No short circuit either.  :)
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 03:43 am


Sorry, but I don't see any difference in the Ebay ckt to mine.  The only thing that I see is that I have a LED and a resistor for the LED on the relay.

Also I don't see (nor have I ever seen) pull-up resisitors on the Inputs.

Not trying negative but I would like to understand.

I attached the opto I am using.


The circuit is pretty hard to see for me and I think there is a mistake in it anyway. It looks like the wire shorting out the relay coil shouldn't be there. Notice where the collector of the phototransistor goes and notice that the emitter is not grounded.

Edited: Sorry, that was poorly worded. I meant notice how the collector on the ebay circuit is wired to 5 V and their emitter goes to the base of the driver transistor as opposed to the way your circuit is wired.


Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 03:48 am
So, for example R16 (T16) needs to be pulled high?


The circuit is pretty hard to see for me and I think there is a mistake in it anyway. It looks like the wire shorting out the relay coil shouldn't be there. Notice where the collector of the phototransistor goes and notice that the emitter is not grounded.

Edited: Sorry, that was poorly worded. I meant notice how the collector on the ebay circuit is wired to 5 V and their emitter goes to the base of the driver transistor as opposed to the way your circuit is wired.


Ah, I understand now.  I attached a schematic of which I was basing mine off of.

Now my first sentence on this post would rectify the situation, pulling (T16 for example) high?  Since you can't see (lol), the wire going from the collector to the base of the relay transistor.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 03:58 am
I see how you got confused. Notice they are biasing the phototransistor to switch faster rather than act more linearly. I don't know what the purpose of the Olimex circuit is. It's an optically coupled OR-gate that resets the processor for whatever reason I don't know. :)
Title: Re: 8 Channel Relay Board - Proofreading
Post by: retrolefty on Apr 15, 2013, 04:05 am

I see how you got confused. Notice they are biasing the phototransistor to switch faster rather than act more linearly. I don't know what the purpose of the Olimex circuit is. It's an optically coupled OR-gate that resets the processor for whatever reason I don't know. :)


Not quite. It's poorly drawn. Note that each opto collector has a I1, I2, I3, or I4 label. These wire over to digital input pins on the processor chip.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 04:08 am
How do you say it's poorly drawn?
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 04:09 am


I see how you got confused. Notice they are biasing the phototransistor to switch faster rather than act more linearly. I don't know what the purpose of the Olimex circuit is. It's an optically coupled OR-gate that resets the processor for whatever reason I don't know. :)


Not quite. It's poorly drawn. Note that each opto collector has a I1, I2, I3, or I4 label. These wire over to digital input pins on the processor chip.


lol, no I mean the schematic posted with reply #26.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 04:15 am
so, my question in reply 26, will it work?
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 04:18 am

so, my question in reply 26, will it work?


Is you intent still to energize the relay with a LOW on INx?
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 04:43 am


so, my question in reply 26, will it work?


Is you intent still to energize the relay with a LOW on INx?


If so, you will use a circuit like http://www.ebay.com/itm/8-Channel-DC-5V-Relay-Module-for-Arduino-PIC-ARM-DSP-AVR-MSP430-TTL-Logic-/271188081780?pt=LH_DefaultDomain_0&hash=item3f2411bc74&autorefresh=true (http://www.ebay.com/itm/8-Channel-DC-5V-Relay-Module-for-Arduino-PIC-ARM-DSP-AVR-MSP430-TTL-Logic-/271188081780?pt=LH_DefaultDomain_0&hash=item3f2411bc74&autorefresh=true).
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 05:02 am
To make this easy, I attached just one of my relay circuits.  This schematic, from what I can see, is the same as in the link that Papa posted, except for adding a LED (w/resistor) between GND and +5V.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 15, 2013, 05:44 am

To make this easy, I attached just one of my relay circuits.  This schematic, from what I can see, is the same as in the link that Papa posted, except for adding a LED (w/resistor) between GND and +5V.


No, more like this.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: retrolefty on Apr 15, 2013, 09:07 pm


To make this easy, I attached just one of my relay circuits.  This schematic, from what I can see, is the same as in the link that Papa posted, except for adding a LED (w/resistor) between GND and +5V.


No, more like this.


Yes, that is a proper interface from opto to relay switching transistor. I would not bother with having two visual leds performing the same function, I would eliminate the opto input led indicator and adjust it's series resistor to compensate for it's elimination.

Lefty
Title: Re: 8 Channel Relay Board - Proofreading
Post by: AlxDroidDev on Apr 15, 2013, 09:35 pm
Instead of using 8 Arduino pins to drive your board, why no use one a single 74HC595 between the arduino and the optocouplers?

This way you'll use only 3 arduino pins, instead of 8, and the complexity added to your design will be minimal (and a 595 is pretty cheap).
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Apr 15, 2013, 09:45 pm

Yes, that is a proper interface from opto to relay switching transistor. I would not bother with having two visual leds performing the same function, I would eliminate the opto input led indicator and adjust it's series resistor to compensate for it's elimination.

Lefty


Wow, I just noticed the LEDs..  You're right.  I will have to change my design for the relay LED.  I wanted the LED to light when the relay has power (Not switched on).  The LED on the opto would light when the relay switched on.  It's not really a necessity to have either LED, but I like seeing the lights.  Besides, I have hundreds of 1206 LEDs in a variety of colors..

Thanks Retro and Papa.  Just to let you know Papa, I knew how transistors worked, but the symbols stumped me for some reason.  Last night (late), it finally sunk in.  So, +1 to ya both.


Instead of using 8 Arduino pins to drive your board, why no use one a single 74HC595 between the arduino and the optocouplers?

This way you'll use only 3 arduino pins, instead of 8, and the complexity added to your design will be minimal (and a 595 is pretty cheap).


Good idea, have quite a few of those in SMD that I have been wanting to use.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: Papa G on Apr 16, 2013, 12:10 am
Quote
Thanks Retro and Papa.  Just to let you know Papa, I knew how transistors worked, but the symbols stumped me for some reason.  Last night (late), it finally sunk in.  So, +1 to ya both.


Thanks, codlink, I knew you'd get it if you thought about it long enough.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Jul 27, 2013, 12:16 am
Well, I finally got around to assembling the relay board and guess what?  It doesn't work..  No LEDs, nothing.  When the 24V is connected I am getting ~21V on the Arduino input pins..

If anyone could take a look at my Eagle files, would appreciate any insight.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Jul 27, 2013, 12:35 am
What is Vcc connected to?
What do IN1-IN5 connect to?
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Jul 27, 2013, 12:55 am

What is Vcc connected to?


Vcc is 24V supply.  Now that I am looking closer, do I have Vcc and +5V backwards?

Quote
What do IN1-IN5 connect to?


IN1-8 are Arduino inputs to activate the optos. 

Title: Re: 8 Channel Relay Board - Proofreading
Post by: CrossRoads on Jul 27, 2013, 02:10 am
From the marking on the relays, they appear to have 5V coils also.
Maybe 5V on both sides.
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Jul 27, 2013, 03:06 am
I see your point.  It's getting late here so I will try tomorrow doing some more troubleshooting.

Thanks Crossroads.  +1
Title: Re: 8 Channel Relay Board - Proofreading
Post by: codlink on Jul 29, 2013, 03:04 am
Did some more testing and you're right.  After I hooked it up the right way it worked..  But now I have a problem with relays 4, 6, 7, and 8.  They do nothing.  Going to check my soldering tomorrow.

I do have some revisions for the board to make it easier to assemble though, but really only cosmetic..

Thanks to everyone