I need to measure AC voltages up to 265V! I tried in every possible place and found nothing and what I found did not work out. Precise circuit and code or something that works! Giving a search on google I found this: AD736 - True RMS to DC Converter; I already have a ready circuit with this CI and another using the 4N25. If anyone has anything can go! Grateful!.
Will you be measuring mains voltage.
If so, how will you isolate mains from Arduino ground.
The second circuit.
What is is supposed to do.
It just generates a voltage across the 10k resistor if AC voltage is present.
If... the opto will survive that reverse voltage (opto absolute max is 6volt).
Leo..
An opto-isolator is non-linear. It's designed to be a switch, so it can "detect" AC voltage but you can't use it to measure voltage.
You DO need to ISOLATE the high voltage. A multimeter is typically enclosed in an insulated case and either battery operated or powered by an isolated power supply. With a plug-in multimeter there is no electrical continuity between the test leads and the power-line or to the power-line ground.
And that true-RMS chip is going to fry if you directly connect 200V!
Do you need to measure lower voltages, or just voltages in the ballpark of 260V?
You generally need a [u]voltage divider[/u] to knock the voltage down to something you can reasonably use (or multiple switched voltage dividers for various ranges).
And, you need [u]protection diodes[/u] in case you connect a voltage higher than expected or in case you connect a high voltage when you're on a low-voltage scale.
Do you need true RMS? i.e. If you know you're measuring sine waves the relationship between RMS and peak, or RMS and average, is a known constant. So you just measure the peak or average* and calculate RMS in software.
The Arduino can be damaged by the negative half of the AC waveform (or by voltages greater than +Vcc). To handle that, you can either bias the input or use rectification. For low voltages you need a precision rectifier (an op-amp circuit). For higher voltages, you can just use a diode (or a full-wave bridge rectifier) and either subtract-out or ignore the voltage drop across the diode(s).
- Mathematically, you take the average of the absolute value... A sine wave is negative half the time and positive half the time and the average is exactly zero.
@DVDdoug.
That chip is an RMS to DC converter.
The circuit has a 10Meg/10k divider and protection diodes.
Leo..
There is lots of useful information about safely measuring mains voltages at openenergymonitor.org
DVDDoug this circuit with AD736 accepts inputs up to 200VAC and divider network generate 120mV at 120VAC input!
JohnLincoln!! This library EmonLib don't display information in LCD! Only in serial monitor! I've tested but print the information only in serial monitor!!! And the circuit for measure voltage put lower voltage AC in arduino input! Can arduino input read directly lower voltage AC or no?
tiagomega:
JohnLincoln!! This library EmonLib don't display information in LCD! Only in serial monitor! I've tested but print the information only in serial monitor!!! And the circuit for measure voltage put lower voltage AC in arduino input! Can arduino input read directly lower voltage AC or no?
The example sketch here, and reproduced below, enables you to extract all calculated values out into variables for easy access.
Once you have the data in a variable, you can display it on an LCD.
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1; // Create an instance
void setup()
{
Serial.begin(9600);
emon1.voltage(2, 234.26, 1.7); // Voltage: input pin, calibration, phase_shift
emon1.current(1, 111.1); // Current: input pin, calibration.
}
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 realPower = emon1.realPower; //extract Real Power into variable
float apparentPower = emon1.apparentPower; //extract Apparent Power into variable
float powerFActor = emon1.powerFactor; //extract Power Factor into Variable
float supplyVoltage = emon1.Vrms; //extract Vrms into Variable
float Irms = emon1.Irms; //extract Irms into Variable
}
The peak to peak voltage applied to the Arduino input has to be less than 5V.
Openenergymonitor even have a page, that shows you how to optimise component values to give a signal of just under 5V peak to peak.