Principles
- Limit power consumption:
https://forum.mysensors.org/topic/1287/door-window-sensor-consuming-more-power-when-closed/5
try a 1 MOhm pull up and disable the internal. Hardware debounce is the way to go. Add 100nF to ground and 10k in series with the contact.
- Use an Arduino Pro Mini 3V3 to keep the cost down (compared to the sensebender).
- Use hardware debouncing (or none), but not the software debouncing library, since that one is guaranteed to give trouble combined with sleep mode.
- The Arduino 3.3V 8mhz can handle down to roughly 2.8V and the Nrf24l01+ down to 1.9V. Hence the batteries can not be NiMH rechargeables - Alkaline or Lithium required. We use a CR2450 coin cell which gives 3V.
- Program the BOD to 0xFE = 1.8V.
- Prepare the Arduino Pro Mini for use with a battery supply: remove the power LED, remove the voltage regulator.
- Add a Si7021 module to measure temperature and humidity.
The result
Used Components
- NRF24L01+SMD
- Reed contact with resistor 3M3 Ohm
- ArduinoProMini3V modified to reduce current consumption for battery supply
- AdapterProMiniForNrfSmd Connects the NRF24L01+ with the Arduino
- Si7021Module 3V version
- WindowOpenAlarm with magnet
Wiring
Component | Pin | Wire/Component | Pin | Component |
---|---|---|---|---|
ArduinoProMini3V | VCC | red | plus | Battery CR2450 |
ArduinoProMini3V | GND | black | min | Battery CR2450 |
GND | GND | Reed Contact | D3 | ArduinoProMini3V |
ArduinoProMini3V | VCC | Resistor > 3M Ohm | D3 | ArduinoProMini3V |
AdapterProMiniForNrfSmd | IRQ | green | D2 | ArduinoProMini3V |
Si7021Module | VCC | red | VCC | ArduinoProMini3V |
Si7021Module | GND | black | GND | ArduinoProMini3V |
Si7021Module | SCL | A5 | Purple | ArduinoProMini3V |
Si7021Module | SDA | A4 | Green | ArduinoProMini3V |
Programming
- Select as board: Arduino Pro or Pro Mini
- Processor: ATmega328P (3.3V, 8MHz)
- Serial monitor: 19200 Baud
- Use platformio
Code at: CoinCellNode.ino
First sign of life
__ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ |___/ 2.3.2 104 MCO:BGN:INIT NODE,CP=RNNNA---,FQ=8,REL=255,VER=2.3.2 167 TSM:INIT 174 TSF:WUR:MS=8000 190 TSM:INIT:TSP OK 200 TSF:SID:OK,ID=16 212 TSM:FPAR 223 ?TSF:MSG:SEND,16-16-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 835 TSF:MSG:READ,0-0-16,s=255,c=3,t=8,pt=1,l=1,sg=0:0 862 TSF:MSG:FPAR OK,ID=0,D=1 1193 TSF:MSG:READ,7-7-16,s=255,c=3,t=8,pt=1,l=1,sg=0:1 1689 TSF:MSG:READ,10-10-16,s=255,c=3,t=8,pt=1,l=1,sg=0:1 2263 TSM:FPAR:OK 2271 TSM:ID 2277 TSM:ID:OK 2285 TSM:UPL 2297 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 2334 TSF:MSG:READ,0-0-16,s=255,c=3,t=25,pt=1,l=1,sg=0:1 2363 TSF:MSG:PONG RECV,HP=1 2377 TSM:UPL:OK 2387 TSM:READY:ID=16,PAR=0,DIS=1 2408 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 2447 TSF:MSG:READ,0-0-16,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 2482 TSF:MSG:SEND,16-16-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2 2523 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 2560 TSF:MSG:READ,0-0-16,s=255,c=3,t=6,pt=0,l=1,sg=0:M 2594 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=11,pt=0,l=14,sg=0,ft=0,st=OK:Coin Cell Node 2639 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0 2682 TSF:MSG:SEND,16-16-0-0,s=1,c=0,t=6,pt=0,l=17,sg=0,ft=0,st=OK:CCN - Temperature 2729 TSF:MSG:SEND,16-16-0-0,s=2,c=0,t=7,pt=0,l=14,sg=0,ft=0,st=OK:CCN - Humidity 2777 TSF:MSG:SEND,16-16-0-0,s=3,c=0,t=0,pt=0,l=18,sg=0,ft=0,st=OK:CCN - Reed contact 2822 MCO:REG:REQ 2836 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2 2873 TSF:MSG:READ,0-0-16,s=255,c=3,t=27,pt=1,l=1,sg=0:1 2902 MCO:PIM:NODE REG=1 2914 MCO:BGN:STP Coin Cell Node 1.0 Channel 125 - Online! 2940 MCO:BGN:INIT OK,TSP=1 Wake up - now minute -1 2975 TSF:MSG:SEND,16-16-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1 Reed contact changed without interrupt - now open T: 21.84 H: 62.00 TempDiff :121.84 HumDiff :162.00 3061 TSF:MSG:SEND,16-16-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:21.8 3125 TSF:MSG:SEND,16-16-0-0,s=2,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:62 3160 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 3188 TSF:TDI:TSL 3196 MCO:SLP:WUP=-1 3209 TSF:TRI:TSB Wake up - now minute 0 T: 21.80 H: 62.00 TempDiff :0.04 HumDiff :0.00 3256 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 3307 TSF:TDI:TSL 3315 MCO:SLP:WUP=-1 3328 TSF:TRI:TSB Wake up - now minute 1 T: 21.69 H: 62.00 TempDiff :0.15 HumDiff :0.00 3373 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 3424 TSF:TDI:TSL 3434 MCO:SLP:WUP=-1 3444 TSF:TRI:TSB Wake up - now minute 2 T: 21.54 H: 62.50 TempDiff :0.30 HumDiff :0.50 3491 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 3543 TSF:TDI:TSL 3553 MCO:SLP:WUP=-1 3563 TSF:TRI:TSB Wake up - now minute 3 T: 21.42 H: 63.00 TempDiff :0.42 HumDiff :1.00 3614 TSF:MSG:SEND,16-16-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:21.4 3676 TSF:MSG:SEND,16-16-0-0,s=2,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:63 3710 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 3739 TSF:TDI:TSL 3749 MCO:SLP:WUP=-1 3760 TSF:TRI:TSB Wake up - now minute 4 T: 21.27 H: 63.00 TempDiff :0.15 HumDiff :0.00 3807 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 3858 TSF:TDI:TSL 3866 MCO:SLP:WUP=1 3876 TSF:TRI:TSB 3895 TSF:MSG:SEND,16-16-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0 Reed contact changed - now closed 3948 MCO:SLP:MS=100,SMS=0,I1=255,M1=255,I2=255,M2=255 3977 TSF:TDI:TSL 3987 MCO:SLP:WUP=-1 3997 TSF:TRI:TSB Wake up - now minute 5 4028 TSF:MSG:SEND,16-16-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1 Reed contact changed without interrupt - now open T: 21.23 H: 63.50 TempDiff :0.19 HumDiff :0.50 4110 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 4161 TSF:TDI:TSL 4171 MCO:SLP:WUP=-1 4182 TSF:TRI:TSB Wake up - now minute 6 4210 TSF:MSG:SEND,16-16-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1 Reed contact repeat last message - now open T: 21.20 H: 63.50 TempDiff :0.22 HumDiff :0.50 4290 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 4341 TSF:TDI:TSL 4352 MCO:SLP:WUP=-1 4362 TSF:TRI:TSB Wake up - now minute 7 4392 TSF:MSG:SEND,16-16-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1 Reed contact repeat last message - now open T: 21.53 H: 65.50 TempDiff :0.11 HumDiff :2.50 4476 TSF:MSG:SEND,16-16-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:21.5 4538 TSF:MSG:SEND,16-16-0-0,s=2,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:66 4573 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 4599 TSF:TDI:TSL 4610 MCO:SLP:WUP=-1 4620 TSF:TRI:TSB Wake up - now minute 8 4651 TSF:MSG:SEND,16-16-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1 Reed contact repeat last message - now open T: 21.42 H: 65.50 TempDiff :0.11 HumDiff :0.00 4730 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255 4782 TSF:TDI:TSL 4792 MCO:SLP:WUP=-1 4802 TSF:TRI:TSB Wake up - now minute 9
Comments: