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!

#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.

Comments

  1. i like that. Can i measure for exampe 4 cell lithium battery?

    ReplyDelete
  2. Yes, but you may need to add some components to reduce the voltage to a range that the Arduino can cope with.

    ReplyDelete
  3. This is perfect for measuring my multiple power supplies on my bench where do i find lcdi2c.h?



    divemasterbill@cox.net

    ReplyDelete
  4. How would I add more channels? Is it possible to add more? Can I link a couple of these together?

    ReplyDelete

Post a Comment

Popular posts from this blog

Controlling a Raspberry Pi Pico remotely using PySerial

Five steps to connect Jetson Nano and Arduino

Raspberry Pi Pico project 2 - MCP3008