Detect if a device is connect to power outlet?

Hi All,

I am working on a home automation project, where I want to detect if there’s a device (TV, Microwave, etc) connected to the outlet or not. What I want to do is connect Core/Photon to an outlet via terminals and relays which can turn on/off the power if a device is connected to it.

I come from a software background and started playing with hardware when I was introduced to Spark :smiley:

Thank you all for your help in advance

That’s sounds really challenging!

@mrabie, one way is to use a current sensor - either an inline hall affect sensor (it needs to be connected in the AC wiring) or a clip-on current transformer or CT sensor (which clips on to the “live” AC wire).

I also used a circuit like the ones used for a non-contact AC sensor you can get from any home centre. I have also seen AC voltage optocoupler sensors that could be used.

3 Likes

I also think the split core current transformer idea might work - what @peekay123 mentioned above. Here is an Arduino project based on such a sensor. It might help you adapt it to the Spark Core:

http://openenergymonitor.org/emon/buildingblocks/ct-sensors-interface

@mrabie, if size is an issue, the hall affect current sensor may be your only option.

@mrabie, I’m not completely sure if I understand your intention completely.

While @peekay123 's and @electronut 's suggestions will work once the outlet is powered and the connected device will draw a detectable current, I’m not completely convinced this is what you described.

If your outlet should stay powered off, if there is no device connected, the suggested solutions won’t work, due to the lack of current flow.
In this case you’d need some independend sensing - e.g. an IR barrier/beam break detector (can’t think of a better English term :blush:) that tests for the physical presence of a plug in the socket.

@ScruffR, yet again you try to bring common sense to a thread!! :sunglasses:

Good point! I was thinking about that and thought about how one would put a “presence” detector on the outlet. I could not think of any way that would not modify the plug. @ScruffR’s IR detector idea may work. Another approach is to have a “barrier” that needs to be rotated/moved to allow a plug to be inserted. If it is spring loaded then it will stay closed if no plug is present. The barrier could be the beam break for the IR method. Or could have a magnet and close/open a reed switch. :smiley:

1 Like

I am with @ScruffR here: I don’t understand the problem.

What some other systems do (like x10) is run a small sense current through the device and if that current detects a lower resistance/higher current flow (like you turned the switch on for a light bulb) then it brings the full current on with the triac or relay. You have to have control over both terminals of the AC supply I believe, since sensing the neutral may not work. In x10 land, this is called “local control” and is common.

This works OK with things like old fashioned light bulbs but not so well with CFL or LED bulbs and would not really work at all with things like a microwave oven.

My microwave and my TV don’t like being completely powered off and lose their programming after sometime in that state.

Maybe @mrabie can explain what problem they are trying solve by detecting what is plugged in? I am having trouble imagining what such a device would do.

2 Likes

Let’s get brainstorming :sunglasses:

When you mentioned rotating a child protector inset for Middle Europe outlets came to mind, where you push the plug into then rotate a quarter turn. These would be adaptable quite nicely, but would only work where I am. But for @mrabie we’d also need to know what outlet type he’s using.

Another (extended) idea would be to have some connecting points (possibly spring loaded) or a reed switch (behind the outlet face plate) which could be bridged via properly adapted plugs - this would allow to only power “entitled” devices :wink:

If @mrabie could also give some background about his HVAC insight, we might even be able to give some more dangerous suggestions - only via PM, tho’.

1 Like

Re-reading the original post, the OP is looking to turn off a device if it is plugged in. Meaning that if it is drawing power, he wants to turn it off. After all, if it is already off, then turning off the power to it is irrelevant. I believe we are back to the current sensing bit. :flushed:

But what’s about this?
I think we need @mrabie to clarify.

And what if the device is powered off and you then turn the outlet off, you’ll never be able to switch the device back on, since it won’t draw the unavailable current :wink:

So sorry, but no quite :confused:

I get the impression that we are WAY over thinking this and @mrabie really needs to clarify :smirk:

3 Likes

Agreed - tooooo much brain only gives you headache :stuck_out_tongue_winking_eye:

1 Like

Wow :smiley:
Thank you for your great feedback! Your discussion cleared some requirements that I didn’t think of.
Well I’m in the States 110V standard US sockets.

Let me give you a more detailed overview of what I ultimately was thinking of, which I am not sure it can be done.

I want to create a smart child safe plugs. Where if something other than a electric device connected to the plug, it will automatically turn off.

Scenario

  1. TV plugged in, electricity is on
  2. TV unplugged it will turn off
  3. A child for example got a small key and plugged it in, the electricity will still be off.
  4. The plugs can be turned on/off on demand by the user via the mobile app

@peekay123 & @ScruffR thanks for the info about having a reed switch or a current sensing device

After thinking about it in more details after reading ur brainstorms, I got an idea

  1. Put 2 push buttons (or something) that will detect if 2 pins are inserted
  2. If true then turn on electricity
  3. elseif 1 of the buttons are pushed then keep electricity off

What do you think?

@ScruffR I would love to hear more about the dangerous suggestions :wink:

1 Like

Good to hear we were of some help :+1:

The mentioned “dangerous” suggestions would involve some alterations inside the outlet that goes deeper than only the face plate.
But if you get your desired result with anything other than this, I’d rather go for that.

As for your two push buttons/microswitches - this already sounds quite close to “dangerous” since you’d need to get rather deep into the outlet housing.
On the other hand having been a four year old once, who figured that two knitting needles do fit into the two holes, I’d guess this aproach would not have saved me either (but this 240V experience is engraved in my mind for almost fourty years now ;-))

But are there no pre-fab child-guards for US outlets with some mechanical barriers, which you could pimp?

@mrabie, as @ScruffR points out, when you make modifications to the mechanical or electrical aspects of a plug, you then need to re-certify the entire plug. The buttons kind of go there IMO. Doing solid market research may be a good idea.

1 Like

how about:

  1. make a small plug adapter that has a small magnet between the two power plug pins
  2. make a coverplate that has a small magnetic reed switch which controls power to the socket.

Then by plugging in a plug with the special adapter, the magnet would toggle the state of the reed switch. This way only devices “approved” by mom or dad by adding the magnetic adapter would be able to power the socket.

2 Likes

Just as a side note to @matt_ri 's suggestion.

To stay save even if the adapter is in the outlet, but the “approved” device got unplugged from the adapter (possibly by the child) you may add some way to detect the presence of the devices plug-pins into that adapter - or even simpler just tie/strap the adapter to the device-plug to prevent unplugging at all.

Hi @mrabie ,

In Europe we have a mandatory mechanical lock on the input pins of an outlet. They only give way when both pins of a plug are present and ‘forced’ in to the socket.
Not a very sparkling solution, but it works ver well,and saved many children an early exposure to a less pleasant way to spark! :wink:

Aren’t those kind of outlets available in e.g. te US?

@marcus, just for clarification - although this is a good provision, it’s “unfortunately” not mandatory all over Europe.
And there are such outlets available for most (if not all) major European outlet systems/standards.

1 Like