Hi,

On Mon, Feb 04 at 11:14, Tim Brocklehurst wrote:
> On Monday 04 Feb 2013 21:49:18 James Courtier-Dutton wrote:
> > 
> > I have found lots of web site detailing how to drive a relay from a
> > Raspberry PI, for example, turning 240V AC mains devices on and off.
> > What I cannot find is how to have the PI detect if 240V is on a wire
> > or not. I.e. If a 240 AC wire is powered or not?
> 
> > Done anyone know of any sort of "detect 240V AC" adapter for the GPIO
> > of the Raspberry PI?
> 
> I don't know of any pre-made boards/kits, so it's probably a DIY job.

Don't think you'll find a pre-made board.  The risk to the supplier of
DIYers plugging things together wrong outweighs the profit on something
with so few components costing pennies.

Actually there are a few boards out there but the suppliers are very
careful to label them for low voltage operation only.  Working out
which are genuine low voltage and which might be subverted for high
voltage use is not something I'd like to go into.


> There are (at least) two ways of doing this. You can either sense voltage, in 
> which case you need some form of rectifier, potential divider and buffer 
> circuit 
> (possibly an optocoupler). There is some info here: 

Not "possibly an optocoupler", isolation is a must not an option.  It might
take the form of optoisolation, capacitive coupling or a good old fashioned
isolating transformer.

A current detector is kinda an extreme case of an isolating transformer,
with a caviat.  It will tell you when the target device is drawing current
(and probably need a large current to activate), not when potential volts
are being provided.  This might actually be what you want in the case of
monitoring a heating systems.

Of the three voltage detectors an isolating transformer (not an "auto"
transformer) converting the mains potential to a low AC voltage is
conceptually the simplest, and probably the only one I'd suggest for
home experimentation.

Capacitive isolation is specialist and tricky, not one to experiment with.

The opto isolator like the transformer is conceptually simple.  The
circuit at [1] is good and would be safe for 110V or 230V operation.
I'd drop the output transistor as not required to drive a RPi input.
However the size of components, normally surface mount these days, makes
if difficult to build a safe unit.  Mains in and low volts out with only
a few mm clearance is not for the regular home constructor.

[1] 
http://electronics.stackexchange.com/questions/50782/ac-detection-for-microcontroller


-- 
        Bob Dunlop

-- 
Please post to: Hampshire@mailman.lug.org.uk
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------

Reply via email to