Convert multiple car 12 V inputs to 5 V and MCP23008

Hey forum,

I’m working on a custom fog light setup for my car using 6 high power LED’s in each fog light. They are triggered by a MCP23008 and a ULN2803 with a seperate 7805 5V regulator per 3 LED’s and a seperate 5V regulator for just the MCP23008’s.

I will be using the car’s existing wiring for parking lights, turn signals, and low beam as inputs to control the brightness level of the LED’s as well as the sequential blinking of the LED’s.

Output wise it works great using pull up resistors to set the address of the two MCP23008’s. This is where the question start:

  • Do I need pulldown resistors on the unused address pins?

  • Do I need pullup resistors on the SCL and SDA lines form an Arduino Uno? If so do I need one on each MCP23008 or just the first one.

  • Is there any harm in bypassing the Arduino Uno’s DC input jack and connecting directly to Vin and GND on the header since I am using my own 3A diodes on the input line?

  • What is the best way to convert four 12 V (11.5 V - 13.8 V) signals to 5V as inputs to the MCP23008’s?

For that last question, the simplest solution is hooking up the input signals to each of their own 7805’s but that seems like a waste of four regulators. I could do a resistor network, but my initial attempts required that the input to the MCP23008 be above 4.6 V but I’m not sure what the max the MCP23008 can handle as the resister network would have some swing to it with the car voltage varying from 12 V when off to 13.8 V when on. Also I’m limited to the standard size resistors that come in Sparkfun’s resistor book, well without putting in an order to digikey or somewhere.

I’ve come up with using a 3300 and 4700 ohm resistor as a voltage divider which give 4.75 - 5.775 V (11.5 Vin - 14 Vin) at 0.245 W which is on the very edge of the resistors power rating. Since these are for two constant inputs that could be on for long road trips and on a PCB mounted in free air under my steering column area, keeping components relatively cool is a requirement.

For the address pins, tie them directly to ground for 0, or via pullup to 5V for a 1.

You only need one pair of pull-ups on the I2C line. The actual value depends on total device capacitance, speed, and a few others. 4.7K is a common starting point.

Since you’re using the 12V lines from the other lamps as a “signal”, a simple voltage divider and perhaps a small capacitor to filter noise spikes will be adequate. Input for the GPIO pins is .8 x Vdd, or 4V for a 5V system. Since a 3:1 divider might drop below the minimum threshold, you could use a lower divider ratio and a 5V zener as a clamp. Keep the top resistor high (10K or so) to limit the power dissipated. Try 10K and 6.8K.

Thanks for te pull-up/down clarification, I’ve bene using 10k 1/6 W resistors for that purpose. I’ll throw some 4.7k resistors on the I2C lines too, does it matter if I put them near the Arduino or near the MCP23008? It’s only a 4" wire between the two and once I design a PCB, it will be within a couple inches.

Hmm, maybe I’ll stick a diode in front of the the Vdd connection to drop it slightly and therefore drop the GPIO requirement. The values of 6.8k and 10k you stated would give 4.65 V - 5.65 V on the GPIO pin. I’ll have to order some zener diodes though, that’s the one thing I don’t have in my parts boxes. Do you know off hand the voltage maximum on a GPIO pin?

The I2C pull ups can go anywhere on the bus. GPIO maximum input should be in the data sheet.

Dave Mueller:
The I2C pull ups can go anywhere on the bus. GPIO maximum input should be in the data sheet.

Thanks Dave, it seems the GPIO pin input range is 0.8 VDD to VDD + 0.6. I might have to come up with a slightly more intricate resistor divider network to drop the lower and upper range down of the reduced voltage to fit within those values.