All submissions

Simple voltmeter using ADC

Solving Approach:

How do you plan to solve it?

 

 

Code

/*Paste your code here*/
// Pin for analog input
const int analogPin = A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  // Read the raw ADC value (10-bit resolution: 0 to 1023)
  int adcValue = analogRead(analogPin);
  
  // Convert the ADC value to voltage
  // 5V reference, voltage = (adcValue * 5.0) / 1023
  float voltage = adcValue * (5.0 / 1023.0);

  // Print the ADC value and corresponding voltage
  Serial.print("ADC Value: ");
  Serial.print(adcValue);
  Serial.print(" | Voltage: ");
  Serial.print(voltage);
  Serial.println(" V");
  
  // Wait for a short time before taking another reading
  delay(500);  // 500ms delay
}



 

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!