6
Labs free energy Q&A quizzes Comments Submit article Contact Register Login Arduino 555 Alarms Audio Basic DIY Hobby Lights Measure Power supply Radio Solar Tested Theory V arious » Tools »  Arduino Digital Voltmeter  This circuit was tested and worked properly! Posted by T.K. Hareendran in Arduino, Tested  with 3 comments 1  Tweet  Arduino Digital Voltmeter http://www .electroschemati cs.com/9351/arduino-d igital-voltmet er/ 1 of 6 9/16/2014 9:47 PM  Print to PDF without this message by purchasing novaPDF ( http://www.novapdf.com/ )

redparrot3001us
• Category

## Documents

• view

165

5

description

sdgf

### Transcript of Arduino Digital Voltmeter

Arduino Digital Voltmeter This circuit was tested and worked properly!

Posted by T.K. Hareendran in Arduino, Tested with 3 comments1 Tweet

Arduino Digital Voltmeter http://www.electroschematics.com/9351/arduino-digital-voltmeter/

1 of 6 9/16/2014 9:47 PMPrint to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

• Here is a useful circuit for Arduino lovers and experimenters. It is a simple digital voltmeter, which can safely measureinput dc voltages in 0 to 30V range. The Arduino board can be powered from a standard 9V battery pack, as usual.

As you may well know, Arduinos analog inputs can be used to measure DC voltage between 0 and 5V (when using thestandard 5V analog reference voltage) and this range can be increased by using two resistors to create a voltage divider.The voltage divider decreases the voltage being measured to within the range of the Arduino analog inputs. Code in theArduino sketch is then used to compute the actual voltage being measured.

The analog sensor on the Arduino board senses the voltage on the analog pin and converts it into a digital format that canbe processed by the microcontroller. Here, we are feeding the input voltage to the analog pin (A0) using a simple voltagedivider circuit comprising resistors R1 (100K) and R2 (10K). With the values used in the voltage divider it is possible tofeed voltage from 0V to 55V into the Arduino board. The junction on the voltage divider network connected to the theArduino analog pin is equivalent to the input voltage divided by 11, so 55V 11 = 5V. In other words, when measuring55V, the Arduino analog pin will be at its maximum voltage of 5V. So, in practice, it is better to label this voltmeter as0-30V DVM to add a safety margin!

Arduino Digital Voltmeter http://www.electroschematics.com/9351/arduino-digital-voltmeter/

2 of 6 9/16/2014 9:47 PMPrint to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

• Notes

If the display reading didnt match when comparing with your lab DVM, use a precision DMM to find the actualresistance of R1 and R2, and replace R1=100000.0 and R2=10000.0 in the code with that values. Next check the5V supply with the lab DVM at GND and 5V pins on the Arduino board. It might give you less (for instance4.95V), replace the value into the code vout = (value * 5.0) / 1024.0 (ie replace the 5.0 value to the actual Vreading, in this case 4.95V). Further,always try to use precision 1% tolerance resistors for R1 and R2.The resistor values (R1&R2) in the circuit diagram provide some over-voltage protection then measuring lowvoltages. Keep it in mind that any input voltage higher than about 55V could fry the Arduino. No other protection(for voltage spikes, reverse voltages or higher voltages) is incorporated in this circuit!

Arduino Digital Voltmeter Sketch

/*1. DC Voltmeter 2. An Arduino DVM based on voltage divider concept3. T.K.Hareendran4. */5. #include 6. LiquidCrystal lcd(7, 8, 9, 10, 11, 12);7. int analogInput = 0;8. float vout = 0.0;9. float vin = 0.0;10. float R1 = 100000.0; // resistance of R1 (100K) -see text!11. float R2 = 10000.0; // resistance of R2 (10K) - see text!12. int value = 0;13. void setup(){14. pinMode(analogInput, INPUT);15. lcd.begin(16, 2);16. lcd.print("DC VOLTMETER");17. }18. void loop(){19. // read the value at analog input20. value = analogRead(analogInput);21. vout = (value * 5.0) / 1024.0; // see text22. vin = vout / (R2/(R1+R2)); 23. if (vin

• lcd.print("INPUT V= ");28. lcd.print(vin);29. delay(500);30. }31.

Schematic of the Arduino DVM Circuit

Parts

Arduino Uno Board100K Resistor10K Resistor100R Resistor10K Preset Pot162 Parallel LCD ( Hitachi HD44780 driver compatible)

1 Tweet 2

Arduino RoomTemperature

Arduino DuePinout

Arduino EthernetPinout

The LEDBrightness or Fan

3 Responses to "Arduino Digital Voltmeter"

Mohan says: on March 28, 2014 at 2:39 pmreply

Great Job!

1.

Arduino Digital Voltmeter http://www.electroschematics.com/9351/arduino-digital-voltmeter/

4 of 6 9/16/2014 9:47 PMPrint to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

• I was wondering if this can be modified to use to measure car Fuel level and display it in digital format. I am notsure if there would be any risk in connecting this to the car battery and the fuel guage or fuel sender unit.

What do you think?

Thanks,

Mohan

Almako says: on May 22, 2014 at 8:09 pmreply

Hi

Thanks for your work, its useful, I used this code for a project, but I had to correct it on line 23:vin = vout * (R2/(R1+R2));And I must changed (R2/(R1+R2)) with a constant because arduino(1.0.5) returned an error.

Thanks,

Almako

2.

Jose E says: on July 30, 2014 at 7:19 amreply

Ok.. what do you propose wvoltage range is low but current is dangerously high?

3.

Name (required)

Mail (will not be published) (required)

You may add a picture too No file selected.

Check this checkbox to get notifications of followup comments via e-mail. You can also subscribe withoutcommenting.

electroschematics partners

Arduino Digital Voltmeter http://www.electroschematics.com/9351/arduino-digital-voltmeter/

5 of 6 9/16/2014 9:47 PMPrint to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

Remember Me

Recent Questions

how do I "declare serial" ?What type of Arduino Board use for the arduino water level indicator + controller project?I need a replacement for CA 3130, my circuit is a sound level meter.