Monday, 28 March 2022

The many versions of the Wireles Door Sensor an Version 5


The Journey so far

I have to admit that it's become a bit of an obsession to try and get this sensor smaller and to use less power at each revision. well I've just finished version 5 which has definitely got the consumption down to a really low level, 3.9uA at its lowest.

Versions 1 to 4 in a row

....... and Version 5
Version 5 assembled PCB

Version 5 has two functions, the normal reed switch trigger so it can be used as a Window/Door sensor and a single button input so it can be used as a Doorbell switch or general WiFi button.

The trigger circuitry combines an edge triggered Monostable circuit from two XOR gates and a single OR gate latch circuit, this latch is triggered either by a pulse from the Monostable or the press of a button which sets the latch.
Once the latch has been set it can then be reset by a LOW signal from the ESP12 when the code has finished running on the ESP12, I used GPIO16 as it is held high during boot.


Circuit diagram V5

Using the circuit above the quiescent current of the whole device when there is no magnet next to the reed switch, i.e. door open is 3.90uA and if you were using it as a WiFi connected button then that would be the Quiescent drain, if used as a door/Window sensor then when the magnet is next to the reed switch the quiescent is slightly higher at 5.4uA due to R1 drawing current when the reed switch is closed.

Battery Life

Actual Current consumption

Using a  Nordic Power Profiler Kit II I made some current measurements of the device in the different states: -
Current Consumption Graph

Using an online battery lifetime calculator I found here I calculated these battery times based on a usage of 10 activations per day: -
As you can see the worst consumption will give a battery life of more than 7 years! although this will only be an esitmate and in "real life" I assume there will be other factors that may impact on the bttery life but only time will tell but I think you would have a good chance of getting a few years out of a relatively small cell.

The files are available on my Github page


MakerMeik said...

You are so amazing. Thanks for the great work and especially for sharing it.

michael said...

really a great project. Thanks for sharing your knowledge!

I have got a question regarding ordering populated PCBs from jlcpcb:

Your "Window sensor V5updated BOM.csv" on your github project "Window-Door-sensor-Version-5" do not show the LED_small D1. But the LED is listed in the file "Window sensor V5-top.pos". I could not find any further details regarding the LED (voltage etc.). Can you please let me know, what LED to use and do you know the LCSC part number?

thanks for your help!

with kind regards


Gadjet said...

Sorry Michael I decided to leave out the LED at the last moment from the assembly as I was aiming to use as little current as possible, I just bought some 0805 LEDs to add myself when testing out the boards so I would know when the LDO was powered up before I added an ESP.

The series resistor is 1K and I just added an 0805 Green LED to test it I bought from Ebay.

Also when I was looking at the JLCPCB parts list there wasn't many LEDs to choose from and they seemed expensive or had a large min order quantitys at the time.


Anonymous said...

Hi Gadjet,

JLCPCB asks for a CPL file containing the parts positions for the pick n place process. I understand that it can be generated out of KiCad but I was wondering if you already have one prepared. It's the first time I am ordering assembled PCBs so I am not familiar with the process.



Gadjet said...

Andreas, As I remember the zip file on github contains the .pos files, one of those is the cpl file that JLCpcb needs, after uploading you will be able to check the component layout visually.

Anonymous said...

Thanks Gadjet, found it!


Unknown said...

Hi mate! First, thanks for sharing your work... I already order pcbs and components... By chance, did you create any 3D model to be printed for this v5?
Thankd once more.

Gadjet said...

Thanks, I've added the exported Step file for the board to the the GIT repository.

Unknown said...

Thanks Gadjet.
Sorry, I wanted to mean a 3D for a CASE for the board.
I saw a case for your V1.


Gadjet said...

Ah! OK I'll upload one later.

Anonymous said...

Sorry to bother you. I'm trying to order the pcb with the top assembled on JLCPCB but i get error when i upload BOM and Pick&Place file. I have never order PCBs before.

Gadjet said...

OK I will have a check of the files, what is the error?

Gadjet said...

I've tidied up the files on GIThub there is now only one BOM and Position file and they are in the "Window sensor" file, these files should work with JLCPCB.

Anonymous said...

It worked. Thank you!

Gadjet said...

Good news, just double check the JLCpcb part numbers in the BOM to make sure the file has correctly linked the right parts, it should be correct but I have had errors before.

Anonymous said...

Hi mate

Finally I received my boards and components, and I have found the time to solder my first unit. Doesnt look as pro as yours but my resources are limited :-)

Im playing with it, and I sucesfull comunicate with ESPNow with an ESP32... it works very well.

But Im facing a problem. Ramdomly the unit keeps sending the message for a while (few seconds) in a loop, before the LDO is dissabled. I have monitorized it, and the END signal from ESP8266 works well, so the only reason to keep the LDO enabled is the two previous gates.

Did you face anything similar to this? Is the magnet power critical? (im using a small but quite powerfull one)

Thanks in advance.


Gadjet said...

I can't say that I've had that problem, do you have an oscilloscope so you can check the waveforms on the logic gate inputs or the enable pin of the regulator?

Even if it was switch bounce it shouldn't last that long! I'm not sure what coulf be happening.
Can you link to some photos of your board maybe?

Anonymous said...

Hi mate.

I have changed the cap (C4) and the supply to a batt, and it seems problems gone.

It works like a charm right now :-)

Not sure how can upload pictures here... I can send them to your email, if you want.


Gadjet said...

Hi I can post a temp email address here you can send to but it's only valid for 10 mins so you need to tell me when you're ready to send, if you like?

Anonymous said...


Not needed. I have prepared a compressed file, with following inside:

* Picture of front and back board
* Oscilloscope pictures, wrong and ok, of signals END and VCC
* A small video, showing how it works with an ESP32 with LCD, showing how the state changes.

You can download it from:
Available for one week.

I have still pending to prepare a case.

Thanks once more.

Gadjet said...

Great news you got it working, thanks for the pictures and video, I will have a look at them.
I have uploaded some STL files to Github for a case but it is quite specific to the battery being used.
I am happy to modify the design to suit another battery if you need one.

Unknown said...

Hi Gadjet, I was just wondering about the battery - where could I find the specific one this case was designed for?

Gadjet said...

These were the ones I bought, you can get the dimensions from here

Anonymous said...

Hi mate!

I would like to contact you. In order to secure our email adresses I have created a temporary one:

I have some changes I want to discuss/share with you

Could you please write me there? Thanks


Anonymous said...

Hi thanks for this wonderful project ...i love to try them. Can you share what all stuffs we need to get this started soo i can buy one by one and get all set .

Gadjet said...

Hi, thanks for the feedback all the information to make one is on my github page, there is a link in the last line of the post :-)

Gadjet said...

Thanks Nick, I think this was the power management IC that was mentioned I think if I made it any better it would generate it's own energy :-) although I have bought a few little (really small) solar cells to experiment with to see if one of those could generate the power to extend the life of the battery or maybe used in conjunction with a supercap?

NickLuzz said...

You are right, I cannot really get better than that! Maybe smaller?
Adding tiny solar cells sound cool! Looking forward to see those in action 🙂

Anonymous said...

Hi Gadjet, amazing project! I am quite new to electronics and I was wondering what changes would have to be made to make this work with a 6V battery? I'm trying to understand the schematic and I can see that there is a voltage regulator, but I am guessing the resistances would need to change?

Gadjet said...

Hi, the regulator is good upto 16V but the logic gates are connected directly to the battery and are only rated to 5.5V so 6V may be pushing it a little, consider putting a couple of dioeds in series with the battery +ve to drop the voltage by 1.2V.

Three button WiFi Remote

Using the power control circuit from the Wirelesse door/Window sensor I have designed a simple 3 button WiFi remote with the intention of co...

Popular Posts