Hi,
I cant find by searching, so i'm asking; can i give AC (alternating current) signal to the analog inputs of arduino ?
(I think its not possible, only DC signals. But if it is possible, my project gets very simple and compact )
Hi,
I cant find by searching, so i'm asking; can i give AC (alternating current) signal to the analog inputs of arduino ?
(I think its not possible, only DC signals. But if it is possible, my project gets very simple and compact )
Not directly. If you put a negative voltage into the Arduino, you can damage it.
What's your application? Do you need to read both halves of the AC signal?
If you need to read/measure both halves, you can use an offset-circuit to bias the signal so that zero ("ground") is 2.5V. This can be done with a couple of resistors, and is probably the simplest solution.
A full-wave rectifier will give you both halves,but you won't know if the true signal is positive or negative. A half-wave rectifier will kill the negative half of the waveform. If you need to accurately measure signals, or detect/measure signals below 0.7V you will need to build a precision rectifier corcuit with op-amps.
i'm trying to make a mains (grid) monitor with ac/ac adapter. addionally, i want to use current transformers and measure the power factor and active-reactive power. if i use current transformers(transducer) with dc output, i couldnt measure the phase angle.
and i think using dc offset method is ok. but i dont really know what is the limits(voltage, current) of the analog inputs. and if i use dc offset, what about code and programming? will it be very complicated ?
youngclever:
and i think using dc offset method is ok. but i dont really know what is the limits(voltage, current) of the analog inputs. and if i use dc offset, what about code and programming? will it be very complicated ?
Those are good questions. If you bias the analog input pin to +2.5vdc and then couple an AC voltage to the input then the maximum safe AC voltage you can apply is 1.768 Vac RMS. And yes, trying to analyze a AC waveform applied to a analog input pin is very complicated and complex and fraught with difficulties. Perhaps if you could state what information you wish to obtain from the AC signal we can suggest easier and better methods?
Lefty
Bias the input to +2.5v as Lefty says, also put a 10K or higher resistor between the transformer output and the analog input pin, to limit the current flowing into the input protection diodes when voltage spikes appear on the mains.
To measure the phase angle, you will need to take many samples per mains cycle. My approach to this is to kick off each ADC conversion from a timer interrupt, and use the ADC conversion complete interrupt to save the result. This allows the processor to do other things while the conversion is in progress.
thanks for answers :). at first, i want to measure the mains (both voltage and current) as a dc signal with rectifier and comparator circuits. and using a zero crossing comparator circuits to find phase angle between voltage and current (for calculating active&reactive power).
but this is not the most reliable way to monitor mains with harmonics. considering harmonics, phase angle is not very meaningful. power factor is more important.
and then i want to use "Analog Device"s energy meter ICs with lots of feature. but all that ICs in smd type. and i'm not a soldering master
at last, i think a little bit mistake is acceptable. so im going to measure by dc signals. because im at the beginning of the arduino
You need to realize you're messing with voltages that can easily electrocute
you or whoever else touches your ckt, if you get your wires crossed [literally],
or some component in the ckt fails. Been there, done that. I'm lucky to have
gotten to be my age :-).
What you might think about is isolating the AC from the Arduino, and stepping down
the voltage, BEFORE applying it to the voltage divider others are talking about. You
might try a power transformer that takes 120VAC input [assuming USA], and outputs
6.3VAC. That will isolate the grounds, and then you can apply the output to the
voltage divider.
Easy to find, go to jameco.com and search on "power transformers".
Also, since you want to measure both voltage and current, you might use
a split bobbin type transformer that has 2 sets of windings, and use one for
voltage and the other for current-measuring. Eg, jameco p/n 221292.
If you're good and careful, you might get to be oldclever.
oric_dan(333):
Also, since you want to measure both voltage and current, you might use
a split bobbin type transformer that has 2 sets of windings, and use one for
voltage and the other for current-measuring. Eg, jameco p/n 221292.If you're good and careful, you might get to be oldclever.
Erm, how does the magnetic flux know how to tell different things to each winding then? Think about how a current transformer works and you'll see it can't be used to measure voltage at the same time.
I thought the signals in the 2 windings are pretty much isolated, but you might
be right. In which case, can use 2 different transformers. Better than using
a non-isolated connection from mains to 5V electronics.
If one is careful, and one is certain to connect the neutral mains leg to Arduino
ground, things should go well, but then, they do mount those ground-fault
interrupter things in bathroom wall sockets for a reason - to keep us guys from
hazard in case the electric razors/whatever fail. I also remember the days before
polarized wall sockets [some nonpolarized are still around in older houses], and
when they had those old AC-DC radios that gave you a nasty shock if the plug
was inserted wrong, so the chassis was hot. You still might find one hanging
around in your grandparents attic. Must build circuit carefully.
MarkT:
Erm, how does the magnetic flux know how to tell different things to each winding then? Think about how a current transformer works and you'll see it can't be used to measure voltage at the same time.
I imagine you'd want to use the transformer to measure the voltage (put some small load across it, and also use a resistive divider, because 120 V to 6.3V will still end up with about 20 V peak-to-peak output swing IIRC.)
I imagine you'd want to use a "current sense" coil around one of the mains wires to sense current. Or perhaps something Hall Effect based.
oric_dan(333):
You need to realize you're messing with voltages that can easily electrocute
you or whoever else touches your ckt, if you get your wires crossed [literally],
or some component in the ckt fails. Been there, done that. I'm lucky to have
gotten to be my age :-).What you might think about is isolating the AC from the Arduino, and stepping down
the voltage, BEFORE applying it to the voltage divider others are talking about. You
might try a power transformer that takes 120VAC input [assuming USA], and outputs
6.3VAC. That will isolate the grounds, and then you can apply the output to the
voltage divider.Easy to find, go to jameco.com and search on "power transformers".
Also, since you want to measure both voltage and current, you might use
a split bobbin type transformer that has 2 sets of windings, and use one for
voltage and the other for current-measuring. Eg, jameco p/n 221292.If you're good and careful, you might get to be oldclever.
Thanks for advices. At my last message, i talked about secondary side of the system. Of course i will use isolation. I want to use a AC/AC adapter or transformer. And use a current transformer. But i think split-bobbin transformers may not be feasible for my application because i want to place adapter and CT to different places (not far, i consider voltage drops ).. But may be suitable for another application or another person's project, thanks.