Arduino as voltmeater


I’m building a CV/CC adjustable power supply with two independent outputs, with voltage from 0-30v and i would like to use Arduino with LCD as voltmeter and current meter.

I have figured out a way to measure the current individually with ACS712 modules, but haven’t figured a way to measure voltage independent. Have searched the internet but with no luck. Any ideas would be appreciated.

Try this.

  0 - ~30volt voltmeter for 3.3volt and 5volt Arduinos
  uses the stable internal 1.1volt reference
  3k3 resistor from A0 to ground, and 100k resistor from A0 to +supply
  100n capacitor from A0 to ground for stable readings
  (100k + 3k3) / 3k3 = 31.30303 | used in formula
float Aref = 1.075; // ***calibrate here*** | change this to the actual Aref voltage of ---YOUR--- Arduino
unsigned int total; // can hold max 64 readings
float voltage; // converted to volt

void setup() {
  analogReference(INTERNAL); // use the internal ~1.1volt reference  | change (INTERNAL) to (INTERNAL1V1) for a Mega
  Serial.begin(9600); // set serial monitor to this value

void loop() {
  for (int x = 0; x < 64; x++) { // multiple analogue readings for averaging
    total = total + analogRead(A0); // add each value to a total
  voltage = (total / 64) * 31.30303 * Aref / 1024 ; // convert readings to volt
  // print to serial monitor
  if (total == (1023 * 64)) { // if overflow
    Serial.print("voltage too high");
  else {
    Serial.print("The supply is ");
    Serial.println(" volt");
  total = 0; // reset value
  delay(1000); // one second between measurements

Tnx, i see that this is a complicated voltage divider. And in order for it to work i have to connect to ground for both power supply outputs, and then those are not independent any more.

Why a complicated voltage divider.
It’s just two resistors, like any other voltage divider.
The values have to be right if you want the maximum resolution from the A/D and have over voltage protection.
The (optional) cap to ground is for added readout stability.

Yes, you always have to share grounds for voltage measurements.
There is no easy way around that.