Using an array of buttons for 12v relays

Hello all. My question here is to use a custom array of momentary push buttons to toggle on and off respective relays and report back to an attached I2c LCD display.

My array of buttons need to be no less than 12 and same for the relays. The relays I need to use have a 12vdc coil in them, so I know that the arduino cannot handle that on its own, so I know I will need something like a ULN2003 or simular to drive them. The arduino of choice here is a NANO. I have already managed to get the I2c display working with a test sketch.

Before it is asked, no I'm not using one of those membrane button matrix pads. I will be making the button array from scratch and all the rest of the electronics from scratch. No break out boards here except the I2c backpack for the lcd... any input would be appreciated.

Since you already have an i2c device, you might consider using an I/O expansion chip that has an i2c interface. Something like the MCP23017 will give you 16 pins. Wire one up for the buttons, wire a second one up with a different address and use it for the relays.

I think with 12 buttons your code should multiplex the buttons, less wiring,, then use a driver IC to latch the relays.. Don't forget relays produce noise in power supply that could reset microprocessors..

Don_Warr:
I think with 12 buttons your code should multiplex the buttons, less wiring,, then use a driver IC to latch the relays.. Don't forget relays produce noise in power supply that could reset microprocessors..

I'm well aware of this. I usually use a diode reversed biased a crossed the relay coil and sometimes a bipolar cap as well. Is there any other tried and true method to elite the noise that I don't know of? If there is, please let me know because I use relays all the time and I have had a few times where my methods didn't get rid of the electromagnetic drop out... cheers!

blh64:
Since you already have an i2c device, you might consider using an I/O expansion chip that has an i2c interface. Something like the MCP23017 will give you 16 pins. Wire one up for the buttons, wire a second one up with a different address and use it for the relays.

How would I get it to report back to the lcd display of what button was last pressed and so on?

hydrolisk1792:
How would I get it to report back to the lcd display of what button was last pressed and so on?

That's the job of your code (which you haven't posted).

gfvalvo:
That's the job of your code (which you haven't posted).

I have no code, that is why I'm here. I need some pointers into the right direction because I don't even know where to start besides that test sketch for the I2c display...

these are common drivers. Adafruit has a library for it that comes with examples. That should get you started in the right direction