Netduino home hardware projects downloads community

Jump to content


Photo

detecting a AC voltage


  • Please log in to reply
8 replies to this topic

#1 ash

ash

    Advanced Member

  • Members
  • PipPipPip
  • 66 posts

Posted 03 April 2013 - 03:42 PM

I need to monitor a state of some 28VAC lines.

 

Hows the best way to do this?

 

I know i need a full bridge, some smoothing and a opto coupler but the bit inbetween the smoothing and opto im stuck on.



#2 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 701 posts
  • LocationBerkshire, UK

Posted 03 April 2013 - 04:30 PM

Hi Ash, What do you actually need to measure? Do you need to measure the voltage, or just detect that the voltage is present? Do you need to measure frequency, does it matter if the user applies 28V DC instead of AC? How fast does it need to react to the voltage being applied or removed? Answering some of these might show a few shortcuts we can take. For example, a really simple ON/OFF detector could be made with just an opto isolator a resistor and a capacitor. This would not allow voltage measurement, and would not verify the voltage was AC. Also, depending on the size of the capacitor, it might take a while to notice the voltage coming or going. But, this might be good enough for you! Paul

#3 cutlass

cutlass

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationNew England. :)

Posted 03 April 2013 - 11:32 PM

If you're just looking to detect "a voltage", you can use something a "24VAC Chassis-Mount Power Transformer", or something like  RadioShack "25.2VAC" Chassis-Mount Power Transformer 273-1366A, to drop the 28VAC to ~5.5VAC.

 

Then, use an LD1117V33 voltage regulator to output 3.3v.

 

Or, for a transformer:

(A 28VAC will produce an ~4.8VAC output)

http://www.digikey.c...-1050-ND/952920

http://www.signaltra...all/pdf/241.pdf

Digi-Key Part Number  595-1050-ND 
Manufacturer Part Number   241-4-20
Description  XFRMR LAMINATED 6VA CHAS MOUNT
$ 10.01

 

Note that you get an additional drop of ~0.7v from the needed full-wave rectifier after the transformer.

 

 

For a voltage regulator:

https://www.sparkfun.com/products/526

Voltage Regulator - 3.3V
Description: Basic voltage regulators in the TO-220 package. Perfect for low voltage 3.3V parts. These are the LD1117V33.

http://www.ti.com/li...nk/lm1117-n.pdf

 

 

 

Example of a simple power supply:

http://www.popsci.co...dc-power-supply

 

In your case, use a different transformer and voltage regulator (similar to what I suggested above).

Also, use an ~330Ohm resistor on the output to be a load, and to drain the voltage from the cap.

 

Good Luck!



#4 ash

ash

    Advanced Member

  • Members
  • PipPipPip
  • 66 posts

Posted 04 April 2013 - 08:19 AM

we are interfacing to some equipment so there are several inputs of 28VAC so using transformers and regulators is out of the question. The response needs to be pretty darn quick too. Basically its to detect a presence.

 

I know PLC's have AC/DC inputs, so i kinda need that input stage fitted to my NP2



#5 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 701 posts
  • LocationBerkshire, UK

Posted 04 April 2013 - 04:28 PM

Hi ash,

 

I think simple is best.

 

If you need to know (fast) when something is connected but don't need to know when it is disconnected, you could just use an opto-coupler with a resistor. (Since you have many inputs, look for opto-couplers that come in DIL packages with several in one package.)

The resistor is calculated to allow the LED (forward voltage of about 2V) to be connected to the 28V AC signal (40V peak!).

The LED will turn on every half cycle, this will turn on the transistor in the output half of the isolator.

The transistor is connected between ground and a Netduino GPIO pin.

The GPIO pin is configured as an input with a weak pullup enabled.

Add an edge triggered event to the pin that fires when a positive (transistor OFF) to negative (transitor ON) transition occurs.

Once the first one occurs, set a flag or take some action, and turn off the event for that pin to eliminate further activations.

 

That will give you a really fast detection of when the 28VAC is connected. You should be able to add as many of these as you have digital GPIOs.

 

If you also need to know whether it has been disconnected, a simple method would be to use a timer to re-enable the event periodically (maybe every half a second?). A second (or the same timer) could be used to measure an interval over which you would expect another cycle of the AC to occur. If you don't get a new event in the expected time, the AC has been removed.

 

Hope this makes sense - Paul



#6 cutlass

cutlass

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationNew England. :)

Posted 04 April 2013 - 06:44 PM

Paul, wouldn't a typical opto-coupler connected to an AC signal produce a "noisy, glitchy, slow-dv/dt" "digital" output? 

I'd think that, at the very least, the output of a typical opto-coupler connected to an AC signal would need to go through a Schmitt trigger buffer to cleanup the edge.

 

For the OP, make sure you know what the saftey and "UL" (or equiv) requirements are.  Using a transformer and going to a low AC voltage, then fully isolating the power/ground planes of that power circuit from the digital portion is the tried and true (and safe) way of doing things.

 

Switching digital inputs too fast or too slow is very bad.  The exact results gets deep in to statistics and manufacturing.  It "may work" for a while.  Or, it may hang immediately.


If you don't want to use a transformer, then check out something like the HCPL3700:

http://www.fairchild...HC/HCPL3700.pdf

 

http://www1.futureel...LD/HCPL3700.pdf

 

http://e-tools.info/...oad.php?id=2219

 

http://www.avagotech...4&ssbinary=true

 

 

Sample circuit:

Posted Image

 

Reference "equivalent" internal circuit for the HCPL3700:

Posted Image

 

 

 

Again, you need to have a full complete total separation on the PCB between the AC and DC side!

No signals, No ground plane, No power planes, etc.

IMHO, this type of design must be reviewed by a design engineer that is experienced and knowledgeable with all of the saftey and agency requirements.

 

Disclaimer:  I make no claims to the saftey, reliability, or usefulness of anything I presented in this or other threads. :)

 

Good Luck!



#7 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 701 posts
  • LocationBerkshire, UK

Posted 04 April 2013 - 09:26 PM

Hi Cutlass,

 

I just spent half an hour typing and lost the lot when I did a search on the google tool bar by mistake. DOH!

 

Edited highlights:

 

Yes safety is important. If you are unsure ask someone qualified.

 

I had not given it much consideration as 28V AC is not going to be lethal - but you do want to be considering fuses to prevent a fault in the Netduino unit causing damage to the AC circuit you are monitoring.

Also make sure the 28V AC is isolated from the mains. Some power supplies reduce the voltage, but don't isolate - so the "safe" 28V is actually just as lethal as mains.

(For example, a GU10 LED light bulb would not isolate the mains from the LEDs, but the glass shell stops it being dangerous.)

 

Ash just wants to detect the voltage is there, so as long as the transistor in the opto-isolator comes on for long enough, I don't think that there is a problem. Schmidt triggers would be nice to have, and would be needed if Ash were measuring frequency.

The opto-isolator output is not going to go too fast for the Netduino inputs, but yes it might go too slow if the AC is a low frequency and the LED is not getting enough current. The gain of the output stage will help with this, most of the opto-isolators I have used have a high gain, hence give a nice square output as the LED is driven.

 

I do like the HCPL3700 you found.

It has a built in full bridge rectifier, zenor diodes to protect the LED, and a threshold detector.

Its not too expensive either (about £2.20 in the UK).

Good find!

(The output will still be pulsed with the AC input, and it still needs a resistor.)

 

Have fun (safely) - Paul



#8 ash

ash

    Advanced Member

  • Members
  • PipPipPip
  • 66 posts

Posted 05 April 2013 - 08:56 AM

Thanks for the replies :)

 

Im aware of the 3700 but its expensive and im having to use components that if it becomes obsolete it can easily be replaced.

 

I've a circuit diagram which should do what i need :P

Attached Files



#9 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 701 posts
  • LocationBerkshire, UK

Posted 05 April 2013 - 02:51 PM

Looks like it will work.

 

Must cost more than the 3700 using all those components - and will be a lot bigger.

 

You could cut down on cost by replacing the bridge rectifier with a single rectifier diode.

The only drawback being that you won't detect both phases of the AC.

 

Look forward to the project showcase!

 

Paul






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2010-2014 Secret Labs LLC  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.