Project Idea: Arduino Voltmeter
Introduction
In this project idea, we will create a simple voltmeter by taking advantage of the Arduino’s analog to digital converter. The problem is it can only measure up to 5V, if you exceeded this limit the Arduino could be damage. The workaround is to use a voltage divider circuit.
In light of that, let us review some basic theory behind it.
So what is voltmeter? Voltmeter is a device use for measuring the voltage across a specific component or electronics circuit.
With that, let us create it using the following materials:
- Arduino Uno board or any compatible board
- 16×2 LCD for the display
- A breadboard
- A potentiometer for the LCD contrast control
- Some resistor values in R1 = 10 x R2 such as
R1 = 100K and R2 = 10K
R1 = 10K and R2 = 1K
R1 = 560 and R2 = 56, since this are the resistor values we use, please modify the sketch source code according to your R1 and R2 resistor values. - Some jumper wires.
Circuit Diagram
Hardware Instruction
- Connect the LCD pin 1 VSS to the Arduino GND
- Connect the LCD pin 2 VDD to the Arduino 5V
- Connect the potentiometer pin 1 and pin 3 to Arduino 5V and GND respectively, and the potentiometer center pin 2 to LCD pin 3 VEE/Vo
- Connect the LCD pin 4 RS to the Arduino digital pin 13
5j. Connect the LCD pin 5 RW to the Arduino GND because we only need to write to the LCD (no reading required) - Connect the LCD pin 6 En to the Arduino digital pin 12
- Leave the LCD pin 7 D0 to pin 10 D3 not connected because we will use 4-bit mode of the LCD.
- Connect the LCD pin 11 D4 to the Arduino digital pin 11
- Connect the LCD pin 12 D5 to the Arduino digital pin 10
- Connect the LCD pin 13 D6 to the Arduino digital pin 9
- Connect the LCD pin 14 D7 to the Arduino digital pin 8
- Connect the LCD pin 15 Anode to the Arduino 5V via current limiting resistor (220 ohms).
- Connect the LCD pin 16 Cathode to the Arduino GND
- Attach the voltage divider circuit accordingly (verify it according to the circuit diagram) or if in doubt ask for some help.
- Upload the provided sketch.
Video Demonstration
Call To Action
If you find this tutorial as helpful, please give me THUMBS UP and SHARE this to your friends.
Comment your question and suggestion in the comment box. And please SUBSCRIBE.
Thank you and have a good day.
Happy tinkering.
Source Code
1#include "LiquidCrystal.h"
2
3// Pin definitions here:
4#define VMETER A5
5
6LiquidCrystal lcd (13, 12, 11, 10, 9, 8);
7
8int raw_voltage = 0;
9float vout = 0.0;
10float vin = 0.0;
11float R1 = 560.0;
12float R2 = 56.0;
13
14void setup() {
15 lcd.begin(16,2);
16 lcd.print("Raw data : ");
17 lcd.setCursor(0,1);
18 lcd.print("Voltmeter: ");
19 pinMode(VMETER, INPUT);
20}
21
22void loop() {
23 raw_voltage = analogRead(VMETER);
24 vout = ((float)(raw_voltage+1) * 5.0) / 1024.0;
25 vin = vout / (R2/(R1+R2));
26 lcd.setCursor(11,0);
27 if (raw_voltage < 10) {
28 lcd.print(" ");
29 } else if (raw_voltage < 100) {
30 lcd.print(" ");
31 } else if (raw_voltage < 1000) {
32 lcd.print(" ");
33 }
34 lcd.print(raw_voltage);
35
36 lcd.setCursor(11,1);
37 if (vin < 10.0) {
38 lcd.print(" ");
39 }
40 lcd.print(vin);
41
42 delay(500);
43}
Posts in this series
- How to Get Started with ATTiny85 in Arduino IDE
- Tutorial: How to use MFRC522 RFID module using Arduino
- SOS Flasher Using Millis Function with Enable Switch
- Tutorial: How to use DS3231 RTC in Arduino
- Tutorial: How to use 0.96 OLED - a small and cute display
- Tutorial: Getting Started with the NRF24L01 | How to use | Arduino
- Tutorial: How to use SIM800L GSM Module for Controlling Anything | Arduino
- Tutorial: How to use Keypad | Text Entry Mode | Arduino
- Tutorial: How to use 4x4 Keypad | Arduino
- Project Idea: Door Lock Security | Arduino
- Multitasking with Arduino | Relay Timer Controller | using millis
- Tutorial Understanding Blink Without Delay | How to millis
- Arduino Simple LCD Menu
- How to use SIM800L GSM Module using Arduino | Make or Answer Voice Calls
- Tutorial: How to Use Arduino Uno as HID | Part 2: Arduino Mouse Emulation
- Tutorial: How to Use Arduino Uno as HID | Part 1: Arduino Keyboard Emulation
- Tutorial: How to use SIM800L DTMF to Control Anything | Arduino
- Tutorial: Arduino EEPROM
- How to use SIM800L GSM Module | Arduino | Send and Receive SMS
- 16x2 LCD Menu for Arduino
- Tutorial: Arduino GPIO | How to use Arduino Pins
- MIT App Inventor for Arduino
- RC Car using L298N, HC-06, and Arduino Uno
- How to Use LCD Keypad Shield for Arduino
- How to Use Arduino Interrupts
- Project: Automatic Alcohol Dispenser
- TUTORIAL: How to use HC-SR04 Ultrasonic Sensor with Arduino
- Source Code: Astronomia Meme and Funeral Dance | melodies the Arduino way
- How to Get Started with L293D Motor Driver Shield with Arduino
- How to Get Started with L298N Motor Driver module using Arduino
- Part 2: Wav Music Player with Lyrics Using Arduino and SD Card
- Interfacing Infrared to Arduino Uno
- Part 1: Wav Music Player Using Arduino Uno and SD Card
- How to Interface Stepper Motor to Arduino Uno
- How To Play MP3 Files on Arduino from SD Card
- What is Arduino Software Serial
- How to Interface SD card to Arduino (without SD card shield)?
- Playing Melodies Using Arduino
- 8 Degrees Of Freedom (DOF) Robot Using Arduino Uno
- How to Interface PS2 Controller to Arduino Uno
- Part 3: DF Player Mini Tinkering with Arduino Nano and LCD
- How to Interface HC-06 to Arduino
- How to make a Remote Control RC car using Arduino and HC-06 bluetooth module
- Part 2: DF Player Mini Tinkering with Arduino Nano
- Part 1: DF Player Mini - a mini cheap mp3 player
No comments yet!