Objective
Learn how to measure voltage using a voltage sensor module and display the readings on the Arduino serial monitor.
Required Components
- Voltage Sensor Module
- Arduino Board (e.g., Arduino Uno)
- Jumper wires
- Breadboard
- Arduino IDE (for programming)
Working Principle
The voltage sensor module scales down the input voltage using a voltage divider, making it safe for the Arduino to read.
Circuit Diagram
Arduino Code
const int voltagePin = A0; // Voltage sensor connected to analog pin A0
float voltage = 0;
void setup() {
Serial.begin(9600); // Initialize serial communication
}
void loop() {
voltage = analogRead(voltagePin) * (5.0 / 1023.0); // Convert analog reading to voltage
Serial.print("Voltage: ");
Serial.print(voltage);
Serial.println(" V");
delay(1000); // Delay 1 second
}
Results
The Arduino serial monitor displays the voltage values measured by the sensor.
Applications
- Battery monitoring
- Power supply testing
- Voltage regulation circuits
Conclusion
Voltage sensor modules are ideal for measuring voltage in electronic circuits and projects.