## Introduction: Measuring DC Voltage With Arduino and Node-RED

There are a lot of tutorials DC voltage measurement with Arduino, in this case I found a tutorial that I consider the best functional method to measure DC without requiring input values of resistance, only requires some resistance and a multimeter, In next tutorials we will start with solar panels and we need to measure VDC over long periods.

The code was taken from startingelectronics.org of the article Measuring DC Voltage using Arduino thanks for the great contribution.

We made some modifications but added a visualization and the result was very good !!
Our arduino measures the voltage in the battery and transmits via serial to Node-RED.

Tutorial PDAControl

English Versión

Measuring DC Voltage with Arduino and Node-RED

http://pdacontrolen.com/measuring-dc-voltage-with-...

Español Versión

Midiendo Voltaje DC con Arduino y Node-RED

http://pdacontroles.com/midiendo-voltaje-dc-con-ar...

Install Node-RED

http://pdacontrolen.com/installation-node-red-plat...

## Step 1: Materials

Materials

1 Resistance 1MOhm, I recommend to 1% tolerance.

1 Resistance 100K or 2 of 200K in parallel, I recommend to 1% tolerance.

1 Multimeter

1 Arduino Mega 2560 R3 - Very cheaps!!!

## Step 2: ​Functioning & Connections

Functioning

Based on the method of measurement of the multimeter, which uses a great resistance to measure voltage and that the measuring instrument does not affect the measurement in the circuit.

Since the ADC of Arduino Mega 2560 R3 in this case allows maximum 5v, has been used voltage divider between 1MOhm and 100k.

Recommendation: In this case I used 5% tolerance and the result was good but if better measurement or pressure is required use resistance 1% tolerance.

## Step 3: Node-RED & Node-RED Dashboard

Node-RED & Node-RED Dashboard

Since this time we will perform a test at the local network, the platform par excellence for testing in "real time" and view Node-Red data, dragging nodes and connecting will have a fast monitoring application,

We will use the Nodes:

Node Serial ports, these will allow point-to-point communication via serial Arduino PC (Node-RED).

Node-RED Nodes Dashboard, Allows a variety of Widget nodes to create spectacular views.

## Step 4: Install Node-RED

Install Node-RED

For a long time I had wanted to try this platform called Node-red created by IBM, it was developed in nodejs, Node-RED is developed by Nick O’Leary and Dave Conway-Jones thanks for your contributions.

But what is Node-Red?

It is an open source graphic tool based on connection of nodes that contain API’S and / or services for the communication and / or connection of devices for the Internetof things, has a friendly web interface, contains a variety of basic and complex IoT functions, there is also an online version of Node-RED called IBM Bluemix .

There are a variety of tutorials to install Node-RED on a local server, but these tutorials, although very complete, did not work correctly for me, I have decided to compile the steps to install Node-RED on Linux, in this case Lubuntu ( (Ubuntu) I hope it will be Your liking this guide.

Node-RED

https://nodered.org

## Step 5: Calibration

Calibration

For the measurement to be correct it is recommended to perform the calibration using a multimeter and take the following measurements and modify the values in the Arduino IDE code.

Complete explanation of calibration method

## Step 6: Battery 6v Measurement

Battery 6v Measurement

In this case we will perform the measurement of an acid battery from 6v to 12Ah

I have created a Dashboard in the Emoncmsplatform with measurements in DC.
You can see the dashboard in real time here

## Step 7: Another Application 10w Solar Panel Measurement

10w solar panel measurement

A few months ago I bought a solar panel from 10W to 22VDC max, with Arduino I made safe measurements without fear of burning the ADC

## Step 8: Conclusions and Recommendations

They would say that it is impossible but for a long time look for a tutorial to measure DC Voltage in an efficient and better manner supported in code and especially functional thanks to startingelectronics.org for this contribution.

In most tutorials, you need to enter the value of the resistors, and their versions are not very useful for measurements in slightly more realistic applications or in real projects.

Since in future tutorials we will use a solar panel 10w this measurement application is perfect for those cases. I consider that one of the advantages this method will not affect the measurement given the high impedance similar to the multimeters.

Tutorial PDAControl

English Versión

Measuring DC Voltage with Arduino and Node-RED

http://pdacontrolen.com/measuring-dc-voltage-with...

Español Versión

Midiendo Voltaje DC con Arduino y Node-RED

http://pdacontroles.com/midiendo-voltaje-dc-con-a...

Participated in the
Arduino Contest 2017