Need some guidance!!!

Hey guys so I have to replace my dash cluster in my truck, and while I’m at it I want to add some nifty bells and whistles, my current help topic is how to use the Arduino mega as a light reader. Basically the idea is if a light such as the check engine light comes on I would like the board to sense that state as being on or off in real time that way I can translate that information to the digital dash solution I created. All the lights are 12 volt as this is a 1992 vehicle and it’s really as simple as stepping the power down to 5v with resistors, which I have never done, then how do I write the code to where it can send that information to the Arduino I am using in place of a Speeduino. If anyone could help I would be very Appreciative!

Please read the forum guide in the sticky post, we can tell you haven't!

Yes in theory you just need a couple of resistors to make a voltage divider to reduce 12V down to 5V. Then you can attach to an arduino digital pin and read it with digitalRead().

In practice, the electrical systems in vehicles are quite hostile places for electronics. The voltage can be 14V or so when the engine is running, and there can be very high voltage spikes induced by the ignition system. So it's wise to have more protection than a simple voltage divider. You could use an opto-isolator, for example.

Essentially you want inputs to the arduino and the simplest are buttons so look up the coding for these and how they fit into projects. You could use optoisolators to detect your 12v signal from the warning lights and convert to logic level signal (5v). You could wire multiple to one analog pin using resistors. Look up multiple buttons tutorials.

When you can detect the state of your inputs then is the time to start thinking about how to code your outputs.

If you can code to accept a button press and turn on an led at the appropriate time then you have the bones of your program. Just make sure and code in nice distinct functions from the start. Then your button function can be very simply adjusted to be your warning light detection function and your LED function can be your display function
Break your project down into distinct parts. Prototype on a breadboard. You don’t need the actual parts to prototype just an arduino, some buttons and LEDs. You mock up inputs and outputs to simulate what you are trying to do. Look at the tutorials in the stickies above in particular on planning a project, millis, state machines, doing multiple things at once.

PaulRB is quite right about high voltage when you start to engine, i'm doing some hobby projects for my car too and according to my experiences when key is on the battery mode voltage arround 12.3/12.5V but when i start the engine then voltage goes to 14.7V so i burnt couple of arduino nano before i start to use LM2596 :slight_smile:

For reading light status there are so many ways, you can use input_pullup method(which basicly tells if connection is short or not), or you can use voltage sensor Voltage detection module Voltage Sensor Module for Arduino NEW | eBay this sensor simply measure the voltage between + & - and sends signal to arduino if there is any voltage captured.

If you can dismount your dash of your car and solder two cables to light's + & - and connect to the this sensor's + & - then you can code your arduino to turn on buzzer when light is on, i used same method for my car to make auto roll up windows when i lock the car.

I'm just sharing my idea with you but remember that i am a ROOKIE, most of the guys are here professionals and their ideas much more valuable, cars have really high voltages specially when you start your engine, be very very carefull. Allways measure your ignition on/off voltage and using an LM2596 to keep voltage as 12V is allways a good idea on cars.

Some guidance...
It is a sticky post ar the top of every forum and it discusses things like how to make a subject line that will be useful.

Also how to post code so it displays in a box.