Author Topic: Measuring AC voltage of two different AC sources using micro controller  (Read 1788 times)

0 Members and 1 Guest are viewing this topic.

Offline arslan43711Topic starter

  • Contributor
  • Posts: 17
  • Country: pk
Hi,
this is the first time I am posting to some kind of forum.
I am having trouble with my circuit that I am using to measure the voltage of the AC supply using Arduino.
Basically, I want to measure the voltage of two different AC sources using the same microcontroller. I have made a circuit whose picture I have attached with this post. It works perfectly fine when I attach only one AC source but when I even
attach only one wire of the other AC source it displays the voltage of both the lines.
Can anyone guide me in the right direction?
Thanks.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #1 on: February 15, 2020, 10:16:25 am »
Are your two AC sources linked in anyway? I.e. not fully floating??

https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline arslan43711Topic starter

  • Contributor
  • Posts: 17
  • Country: pk
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #2 on: February 15, 2020, 10:20:22 am »
currently, I am using two different phases of AC source to test.
 

Offline arslan43711Topic starter

  • Contributor
  • Posts: 17
  • Country: pk
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #3 on: February 15, 2020, 10:46:50 am »
 I have attached the picture of my wiro board circuit.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #4 on: February 15, 2020, 11:07:35 am »
currently, I am using two different phases of AC source to test.
But are they linked in anyway???? If the sources have some sort of electrical common then you’ll have to look at how the circuit works again.

Please provide details of the sources.
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline arslan43711Topic starter

  • Contributor
  • Posts: 17
  • Country: pk
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #5 on: February 15, 2020, 11:24:41 am »
I am using 2 phases (and neutral) out of 3 phase ac supply from grid station(220v AC between each phase and neutral).
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #6 on: February 15, 2020, 11:50:59 am »
There’s your problem.

The solution is simple (if just as dangerous), but you will end up with half-wave rectified voltage (so only the positive halves/peaks of each waveform.

Also, your design intention is only to capture the peak voltage, not RMS?
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline arslan43711Topic starter

  • Contributor
  • Posts: 17
  • Country: pk
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #7 on: February 17, 2020, 03:48:34 am »
Quote
There’s your problem.
I did not get it can you can explain what I am doing wrong. Can you explain/name the phenomena that are causing this issue? Initially, I had the plan to use half-wave rectification but I roll that out because both the phase can be from a single grid station or also can be from different grid stations. I need common GND of both the phases so that I could connect the microcontroller GND. One other reason for full-wave rectification is that if the neutral and phase is interchanged it does not any effect.
 

Offline Helix70

  • Supporter
  • ****
  • Posts: 289
  • Country: au
  • VK4JNA
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #8 on: February 17, 2020, 11:44:28 am »
How is the circuit powered? Is it floating or is the Arduino ground earthed? Without a transformer isolating the AC input, the swing is above *and* below the earth reference. The "ground" from the rectifier is actually negative with respect to neutral.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #9 on: February 17, 2020, 01:18:38 pm »
I did not get it can you can explain what I am doing wrong. Can you explain/name the phenomena that are causing this issue?

Follow where the 220 AC goes through the bridge rectifier and you'll see your 0V/GND gets connected to minus 300V. :o
It's too dangerous, I'm surprised you haven't been electrocuted already. Measuring the AC voltages though 2 small low voltage mains transformers would be better.
.  That took much longer than I thought it would.
 
The following users thanked this post: jesuscf

Offline arslan43711Topic starter

  • Contributor
  • Posts: 17
  • Country: pk
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #10 on: February 18, 2020, 09:27:15 am »
Quote
How is the circuit powered? Is it floating or is the Arduino ground earthed? Without a transformer isolating the AC input, the swing is above *and* below the earth reference. The "ground" from the rectifier is actually negative with respect to neutral.

I am powring the circuit with 5v mobile phone charger that has 2 legs (no earth). I have made common all the grounds.
 

Offline arslan43711Topic starter

  • Contributor
  • Posts: 17
  • Country: pk
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #11 on: February 18, 2020, 09:32:25 am »
Quote
Follow where the 220 AC goes through the bridge rectifier and you'll see your 0V/GND gets connected to minus 300V. :o
It's too dangerous, I'm surprised you haven't been electrocuted already. Measuring the AC voltages though 2 small low voltage mains transformers would be better.

Till this time I have not got electrocuted. At the out of the voltage measurement circuit, I have dc voltage less than 12v that is not dangerous. I did not want to use the transformer.
Reasons, It will increase the cost and size of the circuit.
 

Offline Helix70

  • Supporter
  • ****
  • Posts: 289
  • Country: au
  • VK4JNA
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #12 on: February 18, 2020, 10:24:44 am »
The biggest problem here is that you don't know just how dangerous this circuit is. You have no respect for the danger.
 
The following users thanked this post: Ed.Kloonk, fcb, jesuscf, newbrain

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #13 on: February 18, 2020, 01:02:55 pm »
I have dc voltage less than 12v that is not dangerous.

What you think is 0V and 12V is more like -320v and -308V from a real 0V/GND/Earth, :o so quite dangerous.
You don't have to believe us, you could just follow where the -Ve mains cycles go through the bridge rectifier on your diagram. :horse:
Or find out the hard way. >:D
.  That took much longer than I thought it would.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #14 on: February 18, 2020, 01:14:33 pm »
I'll add my voice to Helix70 and StillTrying.
(I can't believe it took until post #8 for the warnings to come out.)

This is dangerous shit.
You are running a whole floating setup running at over -300V!

I hate to even recommend any tests to prove that this is dangerous as the tests would be dangerous!

If I were there, I'd hook a solid ground to your so-called "ground" in the circuit.
I'd get a fire extinguisher, plug in the circuit and put the flames out that are shooting out of the 100 ohm resistors.
That might convince you.

Seriously, this is dangerous shit.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #15 on: February 18, 2020, 04:05:01 pm »
What you are trying to acheive is commonly done throughout the world.  How you are doing it is dangerous; not only to you put possibly the end users.

In the interests of being helpful and trying to preserve/prolong your life I've drawn up a simple circuit (attached) that will be far less dangerous, more accurate and lower cost.

The opamps can be generic rail-to-rail units.
Ensure the 1M resistors are have suitable WORKING voltage ratings - so 1210 or 1/2W types please and with careful attention paid to creepage/clearance. Essentially you have 3M between you and the mains with this design which limits peak currents under normal circumstances to less than lethal amounts.  The three resistors spread the working voltage across them, before building this - make sure you have understood the potential failure modes of resistors and safe layout!

I would digitise the signals at ADC#1 and ADC#2, calculate the RMS/VPK etc.. in the microcontroller, saves the cost of the peak converter opamps etc..  Also you will get Vrms not Vpk (more useful - but we don't know what you are trying to do, so perhaps not).
If you increase the size of the intergrator capacitors you'll get a smoother DC (less ripple) but at the expense of slower response (but you might want that).

If you are wondering what V4 on the model is an AC source of 500V @1234Hz - just used to prove immunity to some amount of offset's, noise, etc..

This design should also work if you use the third phase instead of neutral - you might want to change the gain a bit to give you more headroom.

LTspice model attached.

930496-0
930492-1
* mains.asc (8.78 kB - downloaded 42 times.)
« Last Edit: February 18, 2020, 06:14:51 pm by fcb »
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline jesuscf

  • Frequent Contributor
  • **
  • Posts: 502
  • Country: ca
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #16 on: February 20, 2020, 06:24:32 pm »
Till this time I have not got electrocuted. At the out of the voltage measurement circuit, I have dc voltage less than 12v that is not dangerous. I did not want to use the transformer.
Reasons, It will increase the cost and size of the circuit.

Your circuit, as many others had pointed out, is very dangerous.  Safety MUST be your #1 priority, before cost and size.
Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 

Offline johnkenyon

  • Regular Contributor
  • *
  • Posts: 123
  • Country: gb
Re: Measuring AC voltage of two different AC sources using micro controller
« Reply #17 on: February 21, 2020, 11:14:54 am »
Feed each phase into a separate transformer then play with low voltages (AC or unsmoothed DC).
If you don't isolate then you have to design for phase-phase voltages and faults.

If you want to see how it's done with a single phase (along with AC power failure detection) elsewhere have a look at the circuit diagrams for an APC UPS
for example: https://elektrotanya.com/apc_ups_450_620_700.pdf/download.html

On sheet 1 they have a centre tapped transformer feeding two diodes. The full wave rectified signal gets sent to sheet 2 ("IN-RECT"), On sheet 1 it gets used to create an AC-OK signal.
A further blocking diode then feeds the smoothing capacitors and provides VSTBY to the rest of the device. (the blocking diode prevents the AC-FAIL and AC Input voltage detection from seeing the smoothing capacitor.
On sheet 2 IN-RECT gets conditioned with two resistors and a capacitor before being fed into an ADC (IC10).

Put another way - with a transformer you can get away with two diodes, two resistors and a capacitor, and a known safe circuit which can give you DC power for free on the side. (Hint feed the smoothed DC output from both transformers via diodes into a regulator and you get safe "redundant" DC power from either phase)

Yes the transformers take up real estate, and aren't cheap, but you are trading the known cost of component and PCB space against the costs of designing a solution which can handle unknown failure modes in the face of 400VAC.

Also if needs be, you can carry out conditioning of the signal "cheaply" in the analogue domain rather than having to code a solution from scratch.

jk

PS If you never intended connecting directly to the AC supply, you should have made this clear by showing the two AC sources as being each fed via a transformer... (My crystal ball hasn't worked for years...)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf