Trouble reading voltages on analog input

Hi all

I’m using my Arduino Uno to read voltages between 0-12v using the analog inputs. This is set up in a vehicle. I’m using a regulator to supply 12v to the arduino Vin

I check my source with a multimeter and i’m reading 5v but the arduino is not reading any value.
I have tried using the AREF and i’m reading 4.5-5v no problem.
Any ideas?

The signal Gnd must be connected to the Arduino Gnd.

If you divide the 12V signal down to about 1V you can/should use the 1.1V ADC reference voltage.

Your program?

You can use a resistor divider to bring the voltage into range, 0-5 volts. To start determine the highest voltage you will see under fault conditions. Use this as your input voltage for calculation purposes. Then use the resistor divider to calculate the resistors. http://www.ohmslawcalculator.com/voltage-divider-calculator I like to use something in the 2.2K range for the lower end and a 5.1K for the upper end. You can read the internal references and Pseudo calibrate your A/D converter on a regular basis, to compensate for the drift of the 5V regulator if you are worried about drift. If this is more then a test you need to delve into the problems you will encounter with automotive power systems.

DrDiettrich:
The signal Gnd must be connected to the Arduino Gnd.

If you divide the 12V signal down to about 1V you can/should use the 1.1V ADC reference voltage.

I’ve connected the signal gnd to the Arduino gnd (not show in my shcematic) and still reading 0v

JCA34F:
Your program?

int analogInput = 1;
float vout = 0.0;
float vin = 0.0;
float R1 = 10000.0; // resistance of R1 (100K) -see text!
float R2 = 1000.0; // resistance of R2 (10K) - see text!
int value = 0;


void setup() {
  //start serial connection
  Serial.begin(9600);
  //configure pin 2 as an input and enable the internal pull-up resistor

}

void loop(){
   // read the value at analog input
   value = analogRead(analogInput);
   vout = (value * 5.0) / 1024.0; // see text
   vin = vout / (R2/(R1+R2)); 
   if (vin<0.09) {
   vin=0.0;//statement to quash undesired reading !
} 
  Serial.println(vin);

delay(500);
}

gilshultz:
You can use a resistor divider to bring the voltage into range, 0-5 volts. To start determine the highest voltage you will see under fault conditions. Use this as your input voltage for calculation purposes. Then use the resistor divider to calculate the resistors. http://www.ohmslawcalculator.com/voltage-divider-calculator I like to use something in the 2.2K range for the lower end and a 5.1K for the upper end. You can read the internal references and Pseudo calibrate your A/D converter on a regular basis, to compensate for the drift of the 5V regulator if you are worried about drift. If this is more then a test you need to delve into the problems you will encounter with automotive power systems.

I’ve built a voltage divider as per my schematic (attached), but i’m still reading 0v

I’m guessing this is all a gnd issue but i can’t figure out exactly where

DrDiettrich:
The signal Gnd must be connected to the Arduino Gnd.

If you divide the 12V signal down to about 1V you can/should use the 1.1V ADC reference voltage.

Which pin supplies 1.1 reference voltage?

Use analogReference() to switch the reference voltage

Use any DVM to measure the voltage on the voltage divider and analog input.

F

DrDiettrich:
Use analogReference() to switch the reference voltage

Use any DVM to measure the voltage on the voltage divider and analog input.

Fixed! Thanks