Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help on driving 15 relays using PIC16f876

Status
Not open for further replies.

fuzzzy

Full Member level 3
Joined
Oct 2, 2004
Messages
156
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,298
Location
ITALY
Activity points
1,650
pic16f876

Hi,

I'm making a control board. It is a keyboard that has to drive 15 different 12V automotive relays.

I used Pic 16f876 as MCU for this board. because of few pins free i'd like to drive relays using a General purpose I/O expander controlled by I2c Bus(PCA9555).

Pwer supply for MCU and I/O expander is a common lm7805 (1A)

PCA9555 has got 16 cmos output 20mA per Pin(max 200mA).
I decide to interface it by ULN2003(7 darlington array) using classic relay NPN configuration.(uln2003 output switches relay's coil to GND). Relays aren't driven by 7805 but directly from car battery.

This circuit works fine for singular relays but when I try to switch on more than five arrays it gives me a lot of problems. It looks like there isn't enough current to drive ULN2003, some relays switch off, other are out of control, uln2003 and PCA9555 gets warmer.

What would you suggest me to do? is there a better way to interface I/O expander to relays?

thanks for your help
 

i2c i/o relay

Salam,

I think you r using so complicated method

Why not just use a 74LS673 16 bit serial in parallel out shift registers for expanding the I/O?

You can take the output of the 74LS673 or your I/O expander to switching transistors or whatever , don't use 7805 use a power regulator this can source a high current

Hope that helps
 

deriving relay using uln2003

For test purposes use LEDs instead of relays. Maybe switching relays cause spikes and thus mulfuncion of the PIC microcontroller.
Try this and see how it goes..
Regards,
IanP
 

driving a relay with a pic

I think IanP is on the right track. I have had problems like this myself. Electrically you seem to have it right, but probably the layout is wrong. Relays do generate a great deal of noise. On pcb all grounds should go back to a common point. Pic should be decoupled even after the regulator. You could try having the relays on a separate board and optocouple them. I am afraid that it could well be a case of trial and error. Also make sure that you are not exceeding the total dissapation of the uln2003.
 

uln2003 driving relay

on the same board I use another I/O expander to drive to drive 1 led for each kay. and it works fine.

Would you please suggest me some useful optocoupler capable to drive led or to be interfaced by ULN or transitor?

I found also ULN2068, do you think it would be better?

Thanks for your time.
 

drive a relay using pic micro

Hello

If you need to expand I/O pins, the easiest way is to use a decoder, for example, you can use three pins from the PIC, and a 3-8 lines decoder, will do the job, more easily than I2C method.

Regards
 

relay controller board using pic mcu

If you recon the LED expander works fine why the relay expander can't do the same?
That was the reason behind the suggestion that you first try the other expander with LEDs, and, if this works fine, then the next step would be to install ≈0.1 to 1mH inductor at the input pin of the7805 voltage regulatoer and ≈10-100µH inductor followed by 100nF (ceramic)+10µF(tantalum) at the output (as close as possible to PIC).
Regards,
IanP
 

74ls673 pic

You should connect COM (pin 9) of the ULN2003 to the battery voltage, as a rule.
You had it floating in the drawing in your other topic on the same subject.

In your other topic I also asked about your PCB layout because I once ran
into problems when relays were mounted close to each other. The magnetic
fields from adjacent relays interfered with each other so that they didn't "pull"
enough. The minimum distance between two relays should be specified in the
relay datasheet.

Just some suggestions...

/Rambo
 

pic16f output expander

Try this,

Leave your circuit as it is for the time being with I2C devices, if you use say 3 line to 8 decoders, you will only be able to drive one relay at once. There are of course ways round this, but for the moment leave as is.

Try having all your relays away on a separate board, say at least a few inches away prom the Pic. Now the important bit, take the 0 (ground) lead from each board back to a common 0 point, with no other possible ground returns. via chassis etc. I had the same problem trying to control several machines with a Micro, they were all earthed at their respective supply connections, The Micro was going crazy with erratic operation. Removing the grounds and then taking them back to a sing point completely cured the problem.

If this does not cure it, I think you need to look at further supression methods as well.
 

driving relays

Thanks a lot for your help!!

I finally found my problem. It was a ground problem for uln2003. now my layout works very fine. it hasn't got any other problem. But I think I'd better use an inductor in 7805 input, wouldn't I ?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top