Arduino DVM with LCD Display
A Digital Voltmeter (DVM) is one of the first things you need if you're building electronics projects. Most of us have one. But what if you need more than one?
Enter the Arduino. If you have an Arduino that can drive an LCD, you've got a multi-channel voltmeter!
The sketch uses my LCD I2C library; I'll publish that and the LCD board design in the next few days.
Enter the Arduino. If you have an Arduino that can drive an LCD, you've got a multi-channel voltmeter!
#include <lcdi2c.h>
#include <wire.h>
int ADDR = 0x21;
LCDI2C lcd = LCDI2C(ADDR);
float volts[4] = {0.0};
int pin;
void setup()
{
Wire.begin();
lcd.init();
lcd.print("4-ch Arduino DVM");
}
void loop()
{
lcd.cursorTo(2,0);
for (pin = 0; pin < 4; pin++) {
volts[pin] = (5.0 * analogRead(pin)) / 1023;
lcd.print(volts[pin], 1); lcd.print(" ");
delay(10);
}
}
The sketch above turns an Arduino with an I2C LCD display into a four-channel voltmeter. The Atmel ATMega328 on which the Arduino is based has six analog inputs but two of them are used by the chip's I2C support. That leaves four channels - plenty for most purposes.The sketch uses my LCD I2C library; I'll publish that and the LCD board design in the next few days.
i like that. Can i measure for exampe 4 cell lithium battery?
ReplyDeleteYes, but you may need to add some components to reduce the voltage to a range that the Arduino can cope with.
ReplyDeleteThis is perfect for measuring my multiple power supplies on my bench where do i find lcdi2c.h?
ReplyDeletedivemasterbill@cox.net
How would I add more channels? Is it possible to add more? Can I link a couple of these together?
ReplyDelete