void loop() int adcValue = analogRead(A0); float voltageAtSensor = (adcValue / 1023.0) * 5.0; float actualVoltage = voltageAtSensor * (25.0 / 5.0); // Scaling factor Serial.print("Measured Voltage: "); Serial.println(actualVoltage); delay(1000);

: [ V_out = V_in \times \fracR_2R_1 + R_2 ] For 25V→5V, choose ( R_1 = 20k\Omega, R_2 = 5k\Omega ).

void setup() Serial.begin(9600);

Leave a Comment