Using I2C to control relays

Hi,

I am attempting a project where I need to control 6 relays over I2C using two Arduino Uno's. The first UNO will be the input board where 6 digital inputs will control six digital outputs on the second UNO (the relays will be run via mosfets). Has anyone attempted a similar project? I have tried but cannot get it to work :frowning: . If anybody has a similar sketch could they post it please?

Why do you need two Arduinos?

I have tried but cannot get it to work

"It"? What is "it"? You have some unspecified wiring with some unspecified code that does some unspecified stuff. What it does is, apparently, not what you want. How can you realistically expect help when there are so many unknowns?

sorry, the code I wrote would basically be of no help, I was just wondering if someone had done something similar and got it to work. I am using two arduinos 1 for the input board and then over the i2c connection board number 2 which controls the relays.

Hi
Why two UNO's when one will do, without I2C?

What is the application?

Tom...... :slight_smile:

The application is for a underwater rov, I have limited cat5 pairs going to the rov from the surface. At the top I would like to have one arduino with the switches for control connected, at the rov end I want to use another board to receive the data from the first board and send it out to mosfets then into relays.

You could put this breakout board at the other end.
16 independent channels that can be used for lights, servos, relays etc. PWM or on/off.

One Cat-5 pair for clock and ground, second pair for data and +5volt.
Leo..

the code I wrote would basically be of no help

It would tell us whether you are using the right approach, or not.

lochienichols:
sorry, the code I wrote would basically be of no help, I was just wondering if someone had done something similar and got it to work. I am using two arduinos 1 for the input board and then over the i2c connection board number 2 which controls the relays.

Why I2C? the Serial communication will be much easier. You can also extend with a proper comman format

I did eventually give up on I2C and moved to serial which is working quite well.