How to get electric voltage in arduino

in #technology7 years ago
data and voltageIn this post I will give a way of measuring the input voltage on a sensor so that we easily make sensor calibration with mathematical equations, at this time I will use Lm 35 DZ and Wemos D1 Mini with output voltage 3.3 volts

At Lm35 DZ has a reference voltage of + 10mv / Celcius, meaning that every increase of 1 degree celcius changes its signal 10 mv. This I got from Datasheet LM35DZ. If want more clear about LM35DZ can Read this article.

Wemos D1 Mini has two first voltage outputs that is +5 volts and 3.3 volts. On this occasion I will use 3.3 volt output voltage to measure the input into the input A0 on Wemos D1 Mini.


Before we measure the voltage at input A0. First we have to string the circuit first, circuit is below

circuit


Second we make the program on the computer / laptop that has been installed arduino, then we can type the program below.

// Free Tutorial Arduino
// www.ioisalman.com 

#include <esp8266wifi .h="">
float voltage=0
int data;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
data=analogRead(A0);
voltage = data*3300/1023;// Note: for arduino we use the output on arduino 5 Volt and formula above 3300 in replace with 5000.
Serial.print("Voltage : ");
Serial.print(voltage);
Serial.print(" Volt\n");
Serial.print(" Data: ");
Serial.print(data);

delay(1000);
}

}



Third we upload the program to wemos d1 mini



To see the result we can see it in serial monitor

Serial Monitor

Serial Monitor



After that, we can create a mathematical equation to calibrate the LM35DZ sensor

and I forgot the love of tau in the above program can be used to arduino of any type, and also there is the input data, the data is read on a mini d1 Wemos, Wemos Data faucet mini d1 only until 1023 bits.

 Note: for arduino we use the output on arduino 5 Volt and formula above 3300 in replace with 5000.

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.029
BTC 76491.95
ETH 2940.27
USDT 1.00
SBD 2.64