Arduino controlled lighting in a car.

Hi folks,
I have a 1990 Corvette that I have completely re-wired. All of the switches (signals, brake, marker, etc) have been changed from positive in, to ground in because I did not want to have to lower the voltage of every input to the Arduino, so I used grounds for the inputs. I kept all the original light sockets, in the car, except the taillights, but replaced all the bulbs with LED’s. I built custom taillights using WS2812b LED’s.
I have included a basic diagram of the wiring to the Arduino. The LM2596 and the 16 channel relay board are prefab units off eBay. I installed everything in the car and when the car is turned off, everything works perfect. When the car is running, I get lights flashing that are not switched on. It seems to have a pattern of L turn twice, then right turn twice, then a pause for a few seconds. I thought it was a programming issue, but it ONLY happens when the car is running. I know basic electronics but that’s about it. I believe it may be coming through the inputs, from the switches but I do not know how to filter it out. Any help would be appreciated. If you need more info, just ask.
Thanks in advance!
Rick

You could use lower value pullup resistors (down to 1K minimum) to provide a stronger pullup and you could put a 0.1uF ceramic cap across each switch to act as low pass filters (pass noise to ground).

The V-in pin is the input of the Mega's build-in 5volt regulator.
It must be >=6.5volt for a stable 5volt for the processor.

Set that buck converter to 7volt, and leave it on the V-in pin,
or... leave it at 5volt, and connect to the 5volt pin.

The pull up resistors should be powered from the 5volt pin.
Leo..

Thanks guys! I will try both of those.

groundFungus:
You could use lower value pullup resistors (down to 1K minimum) to provide a stronger pullup and you could put a 0.1uF ceramic cap across each switch to act as low pass filters (pass noise to ground).

The switches are providing a ground, when active, so do I need to tie the caps to 12V or 5V on the other side? Also, will the caps pull the noise out of the lines or push noise from the positive side into them?

diablorick:
The switches are providing a ground, when active, so do I need to tie the caps to 12V or 5V on the other side? Also, will the caps pull the noise out of the lines or push noise from the positive side into them?

The current is still limited by the pull up resistor so this circuit can not cause huge spikes in either the ground or the supply. It's easiest and most straightforward to connect the capacitors to ground. However, as a low pass filter, it actually makes no difference whether the cap is connected to Vcc or ground. During a release, the cap will be discharging if it's connected to Vcc, and charging if it's connected to ground. This will happen at the same rate, because the RC time constant is the same for both methods.

aarg:
The current is still limited by the pull up resistor so this circuit can not cause huge spikes in either the ground or the supply. It’s easiest and most straightforward to connect the capacitors to ground. However, as a low pass filter, it actually makes no difference whether the cap is connected to Vcc or ground. During a release, the cap will be discharging if it’s connected to Vcc, and charging if it’s connected to ground. This will happen at the same rate, because the RC time constant is the same for both methods.

However, if the capacitor is attached across the switch to ground, it will tend to suppress any sparks across the opening switch. This will help prevent any corrosion on the electrical contacts and make the switches last longer. (see capacitor on old points type ignition)

Attaching the capacitor to Vcc will actually increase any sparks across the opening switch’s electrical contacts causing accelerated wear. (although possibly not significant until thousands of cycles)