

The Sensor Tegangan by ESP32 is a voltage sensor designed to detect and measure voltage levels in a circuit. It provides an output signal proportional to the input voltage, making it ideal for monitoring or control applications. This sensor is commonly used in systems requiring voltage measurement, such as battery monitoring, power supply diagnostics, and energy management systems.








The Sensor Tegangan is designed to work seamlessly with microcontrollers like the ESP32 and Arduino. Below are its key technical details:
| Parameter | Value |
|---|---|
| Input Voltage Range | 0V to 25V |
| Output Voltage Range | 0V to 3.3V (ESP32 compatible) |
| Voltage Divider Ratio | 5:1 |
| Accuracy | ±1% |
| Operating Temperature | -40°C to 85°C |
| Dimensions | 30mm x 20mm x 10mm |
The Sensor Tegangan has a simple pinout for easy integration into circuits. Below is the pin configuration:
| Pin Name | Description |
|---|---|
| VCC | Power supply input (3.3V or 5V) |
| GND | Ground connection |
| OUT | Analog output signal proportional to voltage |
VCC pin to a 3.3V or 5V power source, depending on your microcontroller.GND pin to the ground of your circuit.OUT pin to an analog input pin on your microcontroller (e.g., A0 on Arduino or GPIO36 on ESP32).Below is an example of how to use the Sensor Tegangan with an ESP32 to measure voltage:
// Include necessary libraries
// No additional libraries are required for basic analog reading
// Define the analog pin connected to the sensor
const int sensorPin = 36; // GPIO36 (VP) on ESP32
// Define the voltage divider ratio
const float voltageDividerRatio = 5.0;
// Define the reference voltage of the ESP32 ADC
const float referenceVoltage = 3.3;
void setup() {
// Initialize serial communication for debugging
Serial.begin(115200);
}
void loop() {
// Read the analog value from the sensor
int analogValue = analogRead(sensorPin);
// Convert the analog value to a voltage
float sensorVoltage = (analogValue / 4095.0) * referenceVoltage;
// Calculate the input voltage using the voltage divider ratio
float inputVoltage = sensorVoltage * voltageDividerRatio;
// Print the measured voltage to the Serial Monitor
Serial.print("Input Voltage: ");
Serial.print(inputVoltage);
Serial.println(" V");
// Wait for 1 second before the next reading
delay(1000);
}
voltageDividerRatio if using a custom voltage divider circuit.Incorrect Voltage Readings:
No Output Signal:
ESP32 ADC Saturation:
Q: Can I use this sensor with a 5V microcontroller like Arduino UNO?
A: Yes, the sensor is compatible with 5V systems. However, ensure the output voltage does not exceed the ADC input range of your microcontroller.
Q: How do I improve measurement accuracy?
A: Use a stable power supply, calibrate the sensor, and average multiple readings to reduce noise.
Q: What happens if the input voltage exceeds 25V?
A: Exceeding 25V can damage the sensor. Use a higher-rated voltage divider if higher input voltages need to be measured.
By following this documentation, you can effectively integrate the Sensor Tegangan into your projects for accurate voltage measurement and monitoring.