Sense AC power is on/present with Photon

Hi All,
I want to have my photon sense when an outdoor light motion sensor is on, and then send API commands to my HUE hub. I struggle with the electrical theory side of things… Starting with the hardware side of things… I had 2 ideas:

  1. Run the switched load wire of the outdoor sensor to a relay that then the photon is connected to, either normally open or closed. Would this work, and would I need a mechanical relay because of the voltage leak of a solid state relay, using such low voltage (had that issue with my ecobee and my air handler, had to have all mechanical relays)?

  2. Some how using a small AC to DC Power Module Supply to send a signal to one of the input ports on the photon. The light sensor activating would power the power module and send a signal to the photon.

-OR- is there a better way to do this? It needs to be simple, reliable, and cost effective. If I can just sense when AC voltage is present, I can do all sorts of things with the photon. I don’t want a current sensor, because the motion sensor will not be hooked to anything.

Any link to a similar effort would be most helpful.

Thanks for any help and insight!

Depending on the load you could use a contact-less sensor that sensed the magnetic field through the wire (similar to clamp meter).
That would be the safest and least intrusive option IMO.

But does that work when there is no load on the motion sensor circuit? Are you suggesting that I could place the sensor around a capped off hot wire and it would sense that AC power was present?

Nope, that would not work without load since the magnetic field is proportional to the current through the wire, so no current means no magnetic field means no sensor reading.
Hence this

The load needs to draw enough current to give you some readable field to pick up.

Both methods you suggest would work as well as the method @ScruffR suggests. Your statements about motion sensor not hooked to anything and this is an outdoor light are confusing. That bit aside… Thinking out of the box (and unobtrusively) here are other ideas:

  1. Use a photosensor to sense when the light is on. Very cheap and you can adjust sensitivity in code or analog (using potentiometers).
  2. Use a thermistor (or other temperature sensor) to detect heat from the light when it is on (assuming incandescent flood… if LED or even CFL, it might not work).

Sorry for the confusion in my question… Let me try to explain more clearly the goal. I want to use Philips HUE Par38 bulbs in my outdoor light fixture. We use HUE lights all around the house and want to incorporate the outside lights in with the rest of our automation. But one issue with the HUE lights is they do not have an outdoor motion sensor. Now we have been using RAB outdoor motion sensors for a couple years and they work great! So I want to continue to use the RAB motion sensor, but with the new HUE Par38 bulbs. The HUE bulbs need to be powered all the time in order for them to work with automation. So I can not have the motion sensor powering them, but rather have to power them continuously. I now want to use the RAB motion sensor to detect motion, and send a signal to the Photon, in which I will then send a call to the HUE hub to turn on the lights. If I can get this working, I can then use multiple RAB motion sensors around our property to turn on lights in groups, and do other things like start recording on a CAM.

So, I don’t want to monitor the status of the lights, but rather the status of the RAB motion sensor.

You say that either of my suggestions will work… could you weigh in on which is the best and why you think so?


I get it. Do you have a link to the specific motion sensor? It seems that RAB has many sensors available:

That’s what I was trying to say by…

But I appreciate the suggestion!

Do you have any thoughts on my 2 proposed options? Is it possible to send a 3v signal into the Photon from a power source other then the one the Photon is running on? How would something like that be grounded, or would I just run the positive 3v wire into one of the analog ports?

Have you ever used a solid state relay with the IO pins on the Photon?

Yes, it’s this one, they are great sensors.

Voltage is always relative to a reference level. Consequently you need to have common ground for both sides to measure the voltage provided from one source in relation to the other.

When dealing with mains voltage, it is always best to isolate the high and low voltages using a transformer, relay or other isolator (think optocoupler). The simplest, and probably safest, would be to use an old power adapter from a phone or some other tool or toy. The phone chargers hook up to the switched mains power (from the motion sensor) and output a 5V signal that’s easily detectable by the Photon. You don’t have to worry about isolation because the power supply already does that for you. You can get them super cheap on if you buy in bulk:,null,1#svh-1-5|null:null:r1845925984

If you were to use a relay with the relay coil on the mains side, I suspect you would pay more than a cheap $5 charger from Amazon.

OK, that sounds great. One question though

that’s easily detectable by the Photon

How do I go about detecting the 5v signal from the phone charger?

If using a typical USB A/microB charger or cable, cut the microB-USB end off the cable. You will see 4 wires; 2 for data, one for +5V and one for Ground (GND). Attach the charger GND to the Photon GND, then attach the charger +5V wire to any 5v-tolerant Photon input pin. You will need wire cutters, a wire stripper and depending on how you want to attach to the photon, perhaps some solder.

How do I go about powering the Photon?

Can I use either the USB or the VIN?

Is it OK that both the power to the Photon and the USB Charger power are sharing a common ground?

Folks, if I might suggest a rough schematic might help remove any confusion and danger during implementation. :wink:


You have a few options for powering a photon… but I’m not sure of you whole intent now. Will you have one Photon per motion sensor? If yes, then you could use the phone charger unmodified and attach it to your Photon’s USB in. When motion is detected, power will be supplied to the Photon and then Photon can start sending “Motion detected messaged”. When the motion sensor times out, the Photon will loose power and you know that motion is no longer detected when the messages stop. It’s not elegant and you probably won’t be able to send “Motion not detected” or “motion stopped” messages.

If you want the Photon powered at all times, you will need 2 chargers. One on the switched mains voltage to power the Photon (via USB or Vin… it’s all the same and depends on how you want to package your Photon). The other phone charger would be on the switched motion detection circuit. The switched charger would attach to the same ground reference as the always-on supply. The switched +5V wire can be attached to any 5v-tolerant input pin.

Is that making sense?

Like this…

1 Like

Much better than I was trying to do! I pulled up EagleCAD but I don’t have anything that is a USB charger.

Be aware that the RAB unit may be using a triac to switch its output. The current draw from the USB charger may not be enough to keep the triac conducting. You will need to experiment.

Awesome! This is very simple, and exactly the type of solution that I was looking for!

I was thinking of using a couple of these instead of the USB Chargers, would there be any issue with that. Do they have all the same protections as the chargers do?