Xenon Motion Sensor Example

Tags: #<Tag:0x00007fe21fe06218>


This is an example of a Very Simplified Project for a Xenon and a cheap ($2) PIR Motion Sensor for Low-Powered Applications, taking advantage of the Gen3 Mesh and EN Pin.

By allowing the Motion Sensor to control the Xenon’s EN Pin directly, no other hardware is required.
The Motion Sensor is the External Watchdog.

There are only (3) connections, Li+, Gnd, and EN

The Xenon will remain in Shutdown while the Motion Sensor watches for movement, with a current of only 66 µA. When the Motion Sensor is activated, it pulls the EN Pin HIGH, causing the Xenon to boot.

My results show the Xenon joining the Mesh Network and Connected to the Particle Cloud in about 4 seconds. The Xenon performs a Publish and enters Deep Sleep, waiting for the Motion Sensor to time-out (max Runtime is adjustable), then is Shutdown as the Motion Sensors pulls the EN Pin LOW.

A full Motion Cycle and Publish consumes on average 0.10 mWh. This is dependent on your POT settings as discussed below. I have mine set for about 22 seconds max Run-Time. But the Xenon enters Deep Sleep after 4-5 seconds (unless the Mesh Connection wasn’t successful) .

To start, you need to adjust the maximum RunTime allowed with the “Delay” POT on the Motion Sensor:
Turn it CC to the limit, then back a hair.
This is your maximum Run-time Setting for the Xenon (again, mine is 22 seconds).

Next, select your Trigger Mode:
I use Single Trigger, but it’s your choice.

Once you flash the firmware, you can adjust the maximum Run-Time (Delay) POT to suit your needs.
The Xenon’s RGB light will turn OFF as it enters Deep Sleep waiting for the Shutdown.
The D7 LED will remain on until the Motion Sensor pulls the EN Pin LOW for the Shutdown.

The only purpose of leaving the D7 LED on is so you can adjust the Runtime (Delay) POT easily while testing. It’s unnecessary otherwise and wastes energy.

Here’s the code :

//  create a softDelay, safer than delay()
inline void softDelay(uint32_t t) {
 for (uint32_t ms = millis(); millis() - ms < t; Particle.process());
void setup() {
 pinMode(D7, OUTPUT);
void loop() {
 digitalWrite(D7, HIGH);
 if (waitFor(Particle.connected, 20000)) {    // Will continue once connected, or bail-out after time-limit
   Particle.publish("Motion", "Motion Detected", 300, PRIVATE);
   softDelay(4000);                            // A safe delay to allow the Publish to complete
   //     digitalWrite(D7, LOW);
 // You should turn D7 OFF prior to the Deep Sleep after testing, but this shows you when the SHUTDOWN actually occurs.

Current Testing Performed with µCurrent Gold, and 4.116V on the Li-Po Connector:
Xenon Shutdown but Motion Sensor “watching” = 66 µA = 6.5 mWh per day.
Each 22-second Motion Event Cycle with Publish = 0.105 mWh per Event

Primary Batteries:
(3xAA) Energizer L91 can likely produce 5,500 mWh at this low demand.
That’s 2 years on (3xAA) batteries for a location with infrequent Motion Events.
50,000 Motion Events & Publishes for a busy location.
1 Year with 70 Events per Day, etc, etc, etc.

Adding a RTC and using Manual Mode could be used to eliminate the Cloud Connection and Publish for frequent Motion Events, if desired.

If you don’t have to use Primary Batteries, use a 0.5 Watt Solar Panel & Li-Po and never look back.

This same Motion Sensor (w/ EN Pin) Concept will work for a Boron, but the RTC becomes almost necessary.


I absolutely love the simplicity of this very useful combo.

I’ve been trying to find a equipment combo to do something like this for years but after testing many sensors this setup would do the trick of people detection alerts on a very low power budget.

I bet we could power this off Solar forever off indoor lighting using the solar panel + low power energy harvesting chip + tiny LiPo battery or even a super capicator .

Not having to ever change batteries :battery: is attractive.


@RWB…I’m testing 2 different setups for indoor Solar Harvesting w/ SuperCaps right now :wink:
As it turns out, this particular PIR motion sensor doesn’t work very well outdoors, but is great indoors.

My various Power Budget calcs (based on SuperCap sizes, duty cycle, etc) are matching real-world results pretty well so far, but I haven’t tested all the operating conditions to make a recommendation yet.


Which chips are you testing? I know there are a few on Tindie that are good options.

Motion detection outdoors is tricky due to the sun’s heat and other daily distractions in places with daily foot traffic of people and animals.

How far away is your main Argon or Boron from the Xenon with the PIR sensor in your testing?

  1. https://www.tindie.com/products/jaspersikken/solar-harvesting-into-supercapacitors/

  2. https://www.ebay.com/itm/BQ25570-thermal-solar-energy-harvester-with-30F-super-capacitors/332393146893

I’m trying various 10F, 30F, and 100F SuperCaps. The leakage current varies significantly.

~100’ from the Argon Gateway right now, using External Antenna on everything.


2 awesome energy harvesting chips there!

I’m really looking forward to your testing results with these and the Gen3 devices.

I’m always been fascinated with the low power indoor energy harvesting.


@RWB, my testing for Indoor Solar Harvesting shows each install location is very specific.
For any particular lighting condition, its not too hard to select the appropriate Solar Panel.

I have not been able to produce a decent design that covers a large range of indoor lighting conditions, especially considering the duty cycle is unknown for a motion sensor. The safe bet is to also have a backup source.

The first link above (Tindie) uses the AEM10941 Chip.
The AEM10941 can charge a Li-Po or SuperCAPS. It also has an option to include a “Primary” (non-rechargeable) backup battery (L91 Primaries for example).

Do you know of a good 3V3 motion sensor that Outputs High during detection (mine are officially 4.5V) ?
If so, the AEM would be a good starting point for Indoor Solar PIR with backup battery for peak times.