Remote control via I2C

Hi Guys,

A bit long winded but please bear with me. I need a bit of help and I am rapidly running out of time. The last time I did any work with micro controllers was 20 years ago and that was on a Z80.

I have a control unit on my motorbike that controls the LED emergency lights and strobe pole. It is a two part unit with a switch box on the handlebars and the brains with the relays are under the seat and they are connected via 3 core cable. This faithful unit has decided that it no longer wants to work. It is a discontinued item and the chips are no longer available. So I decided to rebuild it and with the ATmega328 chips much smaller.

I have done a lot of reading and experimenting over the last few weeks and I have drawn a blank. With more time I would probably get there but I need to replace this unit within the next few weeks.

What I am trying to achieve is if digital pin 2 for example goes high then the corresponding pin on the slave goes high. If pin 2 goes low then then pin 2 on the slave goes low. You get the idea. With the ATmega328 having 13 digital inputs and outputs I can also control things like does my 2way radio output through my helmet headset or an external speaker.

There are loads of tutorial out there but they all seem to revolve around sending data back to the pc. I have had some success with on tutorial where I can type a character on the terminal window it turns an led on or off but I don’t have the space for a pc on the bike lol ?.

Can anyone help? In my head I have the idea of a list of variable sw1 – sw10 and op1- op10. The will just code just riffle through i.e. if sw1 = high then op1 = high. It is then getting that to be sent down the wire. If I casually think about it, it seems simple enough but when I look at code examples and try to implement it I realise it is a bit beyond me at the moment.

Just an FYI, I don’t use my bike for business purposes. I am a volunteer motorcycle escort and safety Marshall. I provide safety cover and rolling road closures for fun runs, marathons and charity cycle rides. This all comes out of my pocket so paying the £500 + for a replacement commercial unit is not an option. To see what we do have a look at http://bikemarshals.co.uk/

Sorry for the long post.