int x;// initialise variable x
float y;//initialise variable y
void setup()
{
pinMode(A0,INPUT); // set pin a0 as input pin
Serial.begin(9600);// begin serial communication between arduino and pc
}
void loop()
{
x=analogRead(A0);// read analog values from pin A0 across capacitor
y=(x*.380156);// converts analog value(x) into input ac supply value using this formula ( explained in woeking section)
Serial.print(" analaog input " ) ; // specify name to the corresponding value to be printed
Serial.print(x) ; // print input analog value on serial monitor
Serial.print(" ac voltage ") ; // specify name to the corresponding value to be printed
Serial.print(y) ; // prints the ac value on Serial monitor
Serial.println();
}
then I do not know from where get calculation of this formula value y=(x*.380156);
by the way, I tested code on proteus set amplitude as 311 = 220V then value on serial output is 217.45
I used exactly same schematic of proteus to arduino uno
I connect arduino uno then value on serial output is 345V
@Eleckits , what are you aiming on measuring? Mains voltage?
Between what wires?
Are you aware that that circuit can be at full mains potential if wired wrong or there is a component failure.
The authors qualifications;
About Swagatam
I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials.
If you have any circuit related query, you may interact through comments, I'll be most happy to help!
All there is is this;
It should have just about every paragraph a warning .
As previously stated, irresponsible use of a protoboard and care about life.
If I was you, ditch the project and use a proper transformer isolation circuit like the sane engineers do.