ULN 2803 and a 12V Relay that wont do.

I have started learning arduino and electronics just a couple of months ago. The plus size is that the small business i work with has a good supply of materials, as there is a guy that fixes and rebuild old analogic boards we use. The other factor is that the company hired a guy to develop a better board for our application (driving 12V DC motors for water pumps), but he abandoned the project. So one day i started to take a look in this stuff and saw it was arduino based. The rest of the history is easy to guess.

Well, before making my way into the already designed and printed boards (that were never used) i decided to buy an arduino Uno and start to play around. I´have done some stuff related to what i need: mostly control relays with timing. Also made some studying to understand the basics of each component.

My problem now is: i learned how to control a 5V relay with the 2803, but only a 5V relay. Whenever i apply the 12V power to the 2803 my system stops working and the 2803 starts heating slowly. Also the 12V relay does nothing. It is a working relay as i have tested several times (have a box of them).

I have tried many different options, but i'm almost sure that my connections are right. (trying different ways i even fried one 2803)

My schematic goes as follow:

http://postimg.org/image/4g6kenmwj/

or

http://postimg.org/image/l91tqtoz7/

My code:
void setup() {
// put your setup code here, to run once:
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);

}void loop() {
digitalWrite(8,HIGH);
delay(1500);
digitalWrite(8,LOW);
delay(1500);
digitalWrite(9,HIGH);
delay(1500);
digitalWrite(9,LOW);
delay(1500);

}

I'm really not sure what´s wrong here. It´s supposed to work like this.

If someone could enlighten me i would be very grateful.

What do you mean 12v relay? Are you referring to a relay with a 12v trigger? This could be your problem. What you want is a relay that can relay 12v+ with a 5V trigger. You're looking for something like this: Arduino Compatible Relay
I just googled "5v relay arduino" and many like this came up. It's about $2 and can handle up to 220VAC.

i cannot see a wire between the gnd of the Arduino and gnd of the proto board.

Weedpharma

What do you need the ULN2803A for? It doesn't seem to do anything. :confused:

Grounds aren't connected, unless they're connected through the power supply or something (you should never rely on that). Connect the grounds so the two can talk.

@prescottjoule
ULN2803 allows you to switch a load of a couple hundred mA with an Arduino pin, while the pin could only directly drive 5-20mA load, and allows you to switch higher voltages (it's an array of NPN transistors)

You have the 2803 going to the contacts of the relay.
It should be going to the relay coil.

PrescottJoule:
What do you mean 12v relay? Are you referring to a relay with a 12v trigger? This could be your problem. What you want is a relay that can relay 12v+ with a 5V trigger. You're looking for something like this: Arduino Compatible Relay
I just googled "5v relay arduino" and many like this came up. It's about $2 and can handle up to 220VAC.

This config works witha 5v trigger. I want to trigger a 12v relay. That should be no problem as the 2803 can operate voltages up to50v.

DrAzzy:
Grounds aren't connected, unless they're connected through the power supply or something (you should never rely on that). Connect the grounds so the two can talk.

@prescottjoule
ULN2803 allows you to switch a load of a couple hundred mA with an Arduino pin, while the pin could only directly drive 5-20mA load, and allows you to switch higher voltages (it's an array of NPN transistors)

Hi DrAzzy.

The ground GND goes in the proto board comes from a 12v 5a font. It is connected to the 10 pin of the 2803. The VCC goes from the board to the 9 pin and to one end of the relay. I have not used Com until i can switch the relay.

Do you mean the ground for the arduino board?

PS: I have tried another font also. One with diode bridge, but as the current was unstable i changed to a rectified font.

LarryD:
You have the 2803 going to the contacts of the relay.
It should be going to the relay coil.

I´m pretty sure that´s the coil. I have tested it with direct 12v from the font and that's the way to go.

In the picture is possible to see this small relay module with a diode for protection. It works directly trough the font, but not with 2803 operating with 12v.

weedpharma:
i cannot see a wire between the gnd of the Arduino and gnd of the proto board.

Weedpharma

Will try, but i´m not shure if a 12v vcc and a 5v gnd is safe.

Thank you all for the comments. :smiley:

Your drawing is wrong, turn the relay 180'

LarryD:
Your drawing is wrong, turn the relay 180'

O yes, i see that now.

Thanks.

Okay, i pluged the GND from the 12v font to the GND in arduino. I got the first response from the 12v relay. It opened. But then it did not close. Plus the ULN 2803 started to heat and almost smoked. Maybe some resistor fried inside so i lost one more leg. Hopefully i have not burned the atmega.

Still, it´s not working. Maybe i need to filter the current? Add a capacitor in the Input font.

Open to suggestions.

Cant see any reverse emf protection on that relay... And if it takes long route throw 2803 and power supply wires, it makes it even worse since wires has their own inductance.

My bet is back emf from relay coil has killed your 2803.

Yes, 2803 is supposed to have protection diodes built in, but i would not trust those for moment. Always bad idea when integrated protection needs to activate. On my own designs i treat in built protection diodes as last resort when my own protection has failed..

Easy solution: add reverse diode in parallel with relays coil. And use proper high voltage diode on this.. signal diodes will be screaming mercy when reverse emf spike hits... And relay coils do make those because inductance they have.

What is the relay coil resistance, use a DVM.
Time to throw the 2803 away and get a new one. (sounds like you should have several on hand)
If the 2803 gets hot, you do not have the relay connect properly to it.
I've "never" experienced a problem with the internal kickback diode if it is connected properly. (I have used thousands of them with relays)

The COM pin of the ULN2803 must be connected directly to the relay winding supply, or you'll trash
the chip immediately. It can't hurt to add a second diode directly across the winding for backup,
but the on-chip diodes will work. Add some decoupling to the supply.

Thank you guys!!!

@LarryD
@lapm
@DrAzzy
@weedpharma
@MarkT

Yes, it worked. I wasn´t plugging GND to arduino and after i plugged my 2803 was dead. So i changed it and the relay worked as charm. Also i used the Diode to protect the surge from the inductance of the coil and avoid the coil to lock (it happened one or two times).

Also, i have tested the coil resistance, i thought it was high, like 130, but the 5v relay had almost the same. So i don't know if i made a right measurement, or if it is normal amount. (have to learn ohm law...)

Well, i´m not really good with sketchs, but i think it is the final sketch of what have worked, hopefully it will help others.:
[![[/url]

PS: now i will enter the world of programming. First the LCD and then buttons to set manually different times for each relay. Will post updates in project section ^^.

](http://s10.postimg.org/yafjjjqat/Arduino_ULN_2803_Relay_Vicente.jpg "[/url]

PS: now i will enter the world of programming. First the LCD and then buttons to set manually different times for each relay. Will post updates in project section ^^.

")](http://postimg.org/image/yafjjjqat/)

Congratulations!

you don't need the relay if you are using 2803.

doughboy:
you don’t need the relay if you are using 2803.

Depends how big a load he’s switching and whether it’s AC or DC, whether he needs isolation, etc. The 2803 is great for driving relays, though.

The 2803 is actually pretty crap for driving any sort of load - you can only put maybe 200mA tops, before the voltage drop becomes problematic.

DrAzzy:
Depends how big a load he's switching and whether it's AC or DC, whether he needs isolation, etc. The 2803 is great for driving relays, though.

The 2803 is actually pretty crap for driving any sort of load - you can only put maybe 200mA tops, before the voltage drop becomes problematic.

If you looked at the diagram, it is DC, it is not isolated, hence it is not needed. :slight_smile:

if it is used to drive relay, then the diode across the relay is not needed/redundant as the 2803 already has that diode built in when using COM pin.

doughboy:
If you looked at the diagram, it is DC, it is not isolated, hence it is not needed. :slight_smile:

if it is used to drive relay, then the diode across the relay is not needed/redundant as the 2803 already has that diode.

We still don't know how much current the motor needs - it could very easily use too much current to drive directly with the '2803.

Yeah - the diode is unnecessary, but it's not doing any harm either. He absolutely should have a diode across the motor though to clamp the back EMF, though. If you don't do that, you get more of a spark when the relay opens and closes, which reduces the life of the relay.