Precision voltmeter using ADC

Solving Approach:

How do you plan to solve it?

 

 

Code

/*Paste yourvoid setup() {
  Serial.begin(115200);
}

void loop() {

  // --- Step 1: Measure using 1.1V internal reference ---
  analogReference(INTERNAL);         // Use 1.1V reference
  delay(5);                          // Let reference stabilize

  int raw1 = analogRead(A0);

  // If ADC has NOT saturated → voltage is within 0–1.1V range
  if (raw1 < 1023) {
    float voltage_low = raw1 * (1.1 / 1023.0);
    Serial.print("Range: 0–1.1V  |  Resolution ~1mV  |  Voltage = ");
    Serial.println(voltage_low, 4);
  }
  else {
    // --- Voltage is higher than 1.1V: switch to 5V reference ---
    analogReference(DEFAULT);        // Use 5V reference (AVcc)
    delay(5);

    int raw5 = analogRead(A0);
    float voltage_high = raw5 * (5.0 / 1023.0);

    Serial.print("Range: 1.1–5V  |  Resolution 4.88mV  |  Voltage = ");
    Serial.println(voltage_high, 4);
  }

  delay(200);
}
 code here*/



 

Output

Video

Add video of output (know more)

 

 

 

 

 

Photo of Output

Add a photo of your hardware showing the output.

 

 

 

 

Upvote
Downvote

Submit Your Solution

Note: Once submitted, your solution goes public, helping others learn from your approach!