HI all
I am fairly new to the world of arduino, although i have tinkered with it a bit, multiwii, ardupilot, etc,
i have decided to undertake my own project,
a voltage meter , thermometer and pwm output with all data shown on lcd screen
the plan is to have a 15v battery pack with a voltage divider hooked to the arduino, the voltage divider will divide 15V to 5V thus making scaling of the real and visible voltages easy to do.
the thermometer is using an lm35.
the pwm will be used to control fan speed.
I have successfully coded all of the parts seperately. i have displayed the required data to the lcd in seperate projects.
BUT here is the conundrum which i need help with. When i try to combine the volt reading and the temp reading, the volt reading affects the temp reading. When the voltage input goes higher, the error on the temp seems to jump up, and if i set the voltage to zero the temp works fine.
does anyone have any ideas to help me ?
the code im using is the following:
#include <LiquidCrystal.h>
LiquidCrystal lcd(11, 12, 7, 8, 9,10);
float tempC;
int tempPin = A1;
int voltpin = A0;
float volt = 0.0;
void setup()
{
lcd.begin(16, 2);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
}
void loop()
{
lcd.clear();
tempC = analogRead(tempPin);
tempC = (5.0 * tempC * 100.0)/1024.0;
volt = analogRead(voltpin);
lcd.setCursor(0, 1);
lcd.print((float)tempC,1);
lcd.setCursor(0, 0);
lcd.print((float)volt,1);
delay(750);
}