Beruflich Dokumente
Kultur Dokumente
In order to measure voltages greater than the 5 V reference voltage, you need to divide the input voltage so that
the voltage actually input to the Arduino is 5 V or less. in this experiment, we will use a 90.9 kohm resistor and a 10
kohm resistor to create a 10:1 divider. This will allow us to measure voltages up to 50 V.
Hardware Required
1x Arduino Mega2560
1x 10 kohm resistor
1x breadboard
female connector
jumper wires
Wiring Diagram
The circuit for this experiment is exactly the same as Experiment #1, except that we now have a voltage divider,
made up of a 90.9 kohm resistor and a 10 kohm resistor connected to the input. See the diagram below.
Program
The program for this experiment is nearly the same as for Experiment #1. The only difference is that now we have
to divide the calculated voltage by the ratio R2/(R1 + R2), which in this case is 10,000/(90,900 + 10,000) ≈ 0.1.
Code
#include "LiquidCrystal.h"
void setup()
{
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
lcd.begin(16, 2); //// set up the LCD's number of columns and rows:
lcd.print("DIGITAL VOLTMETER");
}
void loop()
{
//Conversion formula
int analog_value = analogRead(A0);
temp = (analog_value * 5.0) / 1024.0;
input_voltage = temp / (r2/(r1+r2));
void setup()
{
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
lcd.begin(16, 2); //// set up the LCD's number of columns and rows:
lcd.print("DIGITAL VOLTMETER");
}
void loop()
{
https://www.allaboutcircuits.com/projects/make-a-digital-voltmeter-using-the-arduino/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
a 1 2 . 1 5 1 2 . 1 5 1 2 . 1
b 1 2 . 1 5 1 2 . 1 5 1 2 . 1
V O L T M E T E R 6 P O R T
6 C H A N N E L D I
G I T A
A W A S P E R H A T
I A N
H A T I H A T I
C H 1 2 3 4 M A X 5 0 V
C H 5 6 > > M A X 2 5 0 V
g-the-arduino/
L