ac voltage measurement using arduio


This is my first post ever and I am new to electrical engineering but I a little bit understand the basics.

I have connected direct  ac from 230volt - to - 5volt output of transformer to arduino uno analog  pin A0 and we are varying the voltage using ac dimmer.

have used following code for testing. Code compiles and uploads properly to Arduino. Arduino serial monitor shows 239 as value for 4 volt input ac.


Kindly help.

// EmonLibrary examples, Licence GNU GPL V3 
#include "EmonLib.h" // Include Emon Library 
EnergyMonitor emon1; // Create an instance 

void setup() 
  emon1.voltage(2, 234.26, 1.7); // Voltage: input pin, calibration, phase_shift 

void loop() 
  emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
  emon1.serialprint(); // Print out all variables (realpower, apparent power, 
                           Vrms, Irms, power factor) 
  float supplyVoltage = emon1.Vrms; //extract Vrms into Variable 
Robert Wall's picture

Re: ac voltage measurement using arduio

How are you connecting the transformer to the Arduino?

You need a circuit like this one.

(C1 = 10 μF)

When you have connected the transformer like that, you must calibrate it WITHOUT the dimmer. Adjust the voltage calibration (234.26) so that the Arduino reads the same as your meter. Then you should read the correct value for the rms voltage with the dimmer.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.