// Voltage Sensor // Board: Arduino UNO // Typical module ratio is often 5:1. Verify your actual module before use. const int VOLTAGE_PIN = A0; const float ADC_REF = 5.0; const float DIVIDER_RATIO = 5.0; void setup() { Serial.begin(9600); } void loop() { int raw = analogRead(VOLTAGE_PIN); float vout = raw * (ADC_REF / 1023.0); float vin = vout * DIVIDER_RATIO; Serial.print("Raw: "); Serial.print(raw); Serial.print(" | Voltage: "); Serial.print(vin, 2); Serial.println(" V"); delay(500); }