I am trying to step down 40V dc supply using voltage divider circuit to 5 volts proportionally and the output voltage is to displayed on 16X2 lcd. I am always getting 0.0 on lcd, though i think my program is perfect.
I tried a lot but can not figure out what is the error in this circuit.
Please help me out.
Thanks in advance..
Here is my circuit
And here is my arduino code:
Code:
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.print("ADC value");
}
void loop()
{
lcd.setCursor(0,1);
float value = analogRead(A0)*5.0/1024.0;
lcd.print(value);
}
I've never used an Arduino and I can't read the MCU type in your diagram but I suspect you are not following it's manufacturers guidelines about the impedance at the ADC input. Possibly the board also has a resistor to ground/supply on it as well which would effectively be in parallel with your series resistor chain.
Most MCU require an input impedance of < 10K to give accurate results. The solution is to use a buffer amplifier to provide more output current to the ADC input.
Another thought: does the "lcd.print()" function accept floating point numbers as input or do you have to convert to text first?