Arduino 25v DC Voltage Sensor
In arduino the input voltage limited to 5v DC voltage. If your want to measure higher voltage though arduino, then we will need to use voltage divider method.
This voltage sensor is use the method of voltage divider rule from which we can measure the voltage up to 25v. It is fundamentally a voltage divider using 30k and 7k ohm resistor.
This sensor is restricted to 25v DC voltage. For measure more than 25v we have to create another sensor by using voltage divider rule.
Basic Senor Diagram:
Inputs
- GND – This is where you connect the low side of the voltage you are measuring. Caution! : This is the same electrical point as your Arduino ground. Or to connect GND to GND r negative of supply.
- VCC: The is where you connect the high side of the voltage you are measuring. Or to connect VCC to the positive terminal or point of supply.
Outputs
- S: This connects to your Arduino analog input. E.g a0, a1, a2 ( a series of ardiuno)
- – (or minus): This connects to your Arduino ground.
- +: This is not connected. It does absolutely nothing.
Facebook: https://web.facebook.com/electronic.enginer
Mail: electronicengineerads@gmail.com
Mail: electronicengineerads@gmail.com
Schematic
The schematic of this voltage sensor is quite so easy as it mentioned that it is the combination of two resistor for using voltage divider rule.
The Connections
Connect any DC voltage source which is not more than 25v. Here, we use 9v battery source connect to GND and VCC and arduino is connected to S and -(minus) as show in figure
The Sketch
The following code upload in the arduino and you can see the measured voltage at Arduino serial monitoring.
/*
DC Voltmeter Using a Voltage Divider
*/
int analogInput = A1;
float vout = 0.0;
float vin = 0.0;
float R1 = 30000.0; //
float R2 = 7500.0; //
int value = 0;
void setup(){
pinMode(analogInput, INPUT);
Serial.begin(9600);
Serial.print("DC VOLTMETER");
}
void loop(){
// read the value at analog input
value = analogRead(analogInput);
vout = (value * 5.0) / 1024.0; // see text
vin = vout / (R2/(R1+R2));
Serial.print("INPUT V= ");
Serial.println(vin,2);
delay(500);
}
0 comments:
Post a Comment