Hi all! I created a benchtop power supply with an ATMega328 as the voltage monitor that outputs to a LCD panel. The worklog can be found here:
http://www.thebestcasescenario.com/forum/showthread.php?t=25018I've been sing it more and more lately and I've noticed that the readings on the LCD drop when the temp goes up, and vice-versa. Currently the 3.3V is reading the same, the 5V is reading ~4.4 and the 12V is reading ~10. When the weather cools off the readings go back up to near normal. Is there some kind of temperature compensation I can work into the code to correct this? Here's the code I'm running:
/*Arduino Controlled Voltage Monitor
Code by Will Lyon 2/28/2011
Code for project Power House on TBCS
http://www.thebestcasescenario.com*/
#include <LiquidCrystal.h>
//Initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup()
{
lcd.begin(16, 2); //Set up the LCD's number of columns and rows
lcd.print(" POWER HOUSE"); //First line opening message
lcd.setCursor(0, 1);
lcd.print("Desktop Pwr Unit"); //Second line opening message
delay(5000);
lcd.setCursor(0, 1); //Clear bottom line
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print(" 3v 5v 12v"); //Update top line readout
}
void loop()
{
lcd.setCursor(0, 1);
float f = analogRead(0) * 4.92 / 1023; // 3.3 => 9.9
lcd.print(f, 2); // print float with two decimals
lcd.setCursor(6, 1);
float g = analogRead(5) * 8.05 / 1023; // 5.0 => 9.9
lcd.print(g, 2);
lcd.setCursor(11, 1);
float h = analogRead(4) * 20.88 / 1023; // 12.0 => 25.0
lcd.print(h, 2);
delay(1000);
}