Using 240v Microwave Occupancy Sensor

Hi Folks,

Brand new to working with Spark, but super excited about it :slight_smile: My first project is a bit of environmental sensing and control. Basically I’m having a new bathroom fitted, it will be using a digital shower and bath fill, in-line extractor fan and 6 mains powered LED downlights. My control logic will go something like this:


  • Room unoccupied = no action
  • Room occupied + light level low = ramp lights to 80% + energise IR proximity sensor for touch free dimming control
  • Bath/Shower running = energise extractor fan and record humidity level. When shower/bath finished, run extractor until pre-shower/bath humidity level is reached.

I have purchased the following sensors (some of which are 5v and will need level conversion) to achieve this:

  • in-line current sensor (for sensing shower/bath fill state)
  • Humidity/Temp sensor
  • IR proximity sensor
  • Light sensor
  • 240v microwave occupancy sensor


The occupancy sensor is designed to switch the lighting circuit directly, but I will be using it standalone. What are the techniques available to convert the 240v AC switched signal to the 0-3.3V DC necessary for Spark?

Any help much appreciated.

Have you got any datasheet or a type of your sensor for us?

If your sensor just switches a relay which is capable of switching 240V it doesn’t mean that you have to switch that kind of voltage.
You could just let it switch a 3V3 signal too :wink:

It’s basically a commercial sensor unit ready to be installed in the ceiling, like you might see in any modern office with occupancy detection. I thought the same about running 3.3V through it, but unfortunately the live and switched live share a common neutral :frowning: I don’t have a datasheet (searching for one at the moment)… it’s an eBay purchase from China… it was cheap, so I’m not expecting miracles :slight_smile:

Here we go, this is it:

I see, so I’d suspect the sensor actually just passes through its own supply power (e.g. 240V) via the switched terminal.
So you’d need to “measure” the presence of voltage there. Which would sure be doable in multiple ways, but seems a bit hacky.

I don’t want to be awkward, but is there a particular reason why you didn’t just go for a sensor intended for use with a micro?
It might safe you some hassle.

But if you need, there still will be a way.

The reason… packaging! I’m spending a lot of money on the bathroom and I don’t want something that looks home made :slight_smile: I can do a reasonably neat job of the proximity sensor by mounting it inside a UK 1G blank switch plate (modified for the sensor), but the microwave sensors I’ve seen haven’t been so aesthetically pleasing :wink: It’s also IP44 rated.

The unit is very cheap… so it’s quite possible that I can open it up and see if I can ignore the 240V side and power it directly at low voltage.

OK, that’s a valid reason :+1:

But with this bit of info, I’d just throw in a somewhat heretic idea :wink:

If no action is required, I guess the Core could be powered off too, or not?
But if so, than you could power the socket which powers the Core via the switched terminal of your sensor.
Unoccupied -> Core off
Occupied -> Core on

I’m not sure if that’s such a great idea. If you want to control things from outside the bathroom, then you’ve got no power at your Core. Also, as everyone has probably noticed when being on a toilet with such a sensor, if you keep still, it’ll switch off. That might not be so ideal when your lights go out, and your water stops running if there’s nobody in the room, or you’re not moving a lot.

That would work if only I wasn’t using the same Core to control fan run-on based on humidity.

Water isn’t being controlled by the Core, just sensing whether the bath or shower is running (based on current flowing to the digital pump/processor unit). I think microwave sensors are a lot more sensitive to movement that PIR, it’s why I chose that type of sensor. But if it goes out, it’s a simple enough matter of waving an arm to turn it back on. The output of the sensor is also timed, so if it becomes a problem I could also extend the off timer or indeed do that in the Core (although I’d rather not do that as I want to save as much energy as possible).

I’m beginning to think I should just use the sensor to switch an external relay which then switches a 3V3 line into the Core. That’s a pretty simple option.

How about one of these beauties?

A high-voltage opto-isolator will work fine. You could also build your own something like this:

note that this pulses when “on” so you would need to wait for no zero crossings for say 40ms minimum to be safe.

I think the cheapest solution might a retired cell-phone charger at the output of the occupancy sensor but you would have to figure out how to physically wire it.

If I were building this and thought I might someday sell the house, I would run the occupancy sensor to a switched outlet and then do something low-voltage from there. That would also have a better chance of keeping my home insurance in effect in the case of major problems. In the US, the building code would require a GFCI outlet (receptacle) or circuit breaker at a minimum in a bathroom.

1 Like

Thanks @bko, great suggestions. I must have a spare USB power adapter hanging around that I could mount in my project box.

The bathroom is 1st floor (US Second Floor) in a 2 story house, the sensor is bathroom rated and everything else is ultra low voltage (defined as <= 12VAC or <=30VDC) with any transformers, non IP rated mains, etc, located in the loft space above. The 240v feed will be from a fused spur (shared with lighting, shower/bath fill and extractor fan) which meets UK regulations if it’s all under 6A (which it will be). I believe the work I’m doing is notifiable to the local authority. I think I’m okay with respect to UK building regulations, as long as I get the installation certified by a qualified electrician… but I must admit, I’m not 100% clear on that, so I’ll double check.

OK, since I took your word “Room unoccupied = no action” for what it says, I just thought … :wink:
But given the original idea

the logical next idea would have been what @bko suggested

1 Like

Resurrecting this :slight_smile: One of these is probably the neatest and easiest solution: