All submissions

Precision voltmeter using ADC

Solving Approach:

How do you plan to solve it?

 

 

Code

/*Paste your code here*/


const int analogPin = A0;

void setup() 
{
  Serial.begin(9600);
  analogReference(DEFAULT); 
  delay(100);
}

void loop() 
{
 
  int rawValue = analogRead(analogPin);
  float testVoltage = (rawValue * 5.0) / 1024.0;
  
  if (testVoltage <= 1.1) 
  {
   
    analogReference(INTERNAL);
    delay(10); 
    
    rawValue = analogRead(analogPin);
    float voltage = (rawValue * 1.1) / 1024.0;
    
    Serial.print("High Res | ");
    Serial.print(voltage, 3); 
    Serial.println("V");
    
  } 
  else 
  {
    
    analogReference(DEFAULT);
    delay(10); 
    
    rawValue = analogRead(analogPin);
    float voltage = (rawValue * 5.0) / 1024.0;
    
    Serial.print("Std Res  | ");
    Serial.print(voltage, 2); 
    Serial.println("V");
  }
  
  delay(500);
  }
 

Output

Video

Add video of output (know more)

 

 

 

 

Photo of Output

Add a photo of your hardware showing the output.

 

 

 

 

 

Submit Your Solution

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