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.

Future extensions

  • Add a Si7021 module to measure temperature and humidity.

The result

Used Components

Wiring

Component Pin Wire/Component Pin Component
StableNode +bat red plus Battery CR2450
StableNode -bat brown min Battery CR2450
GND GND Reed Contact D3 StableNode
StableNode VCC Resistor > 3M Ohm D3 StableNode
StableNode NRF24L01+ SMD chip IRQ green D2 StableNode

Programming

  • Select as board: Arduino Pro or Pro Mini
  • Processor: ATmega328P (3.3V, 8MHz)
  • Serial monitor: 19200 Baud

Code at: CoinCellStableNode.ino

First sign of life

__  __       ____
|  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
| |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
| |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
|_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
        |___/                      2.3.2

104 MCO:BGN:INIT NODE,CP=RNNNA-Q-,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=170     <---  The ID was already assigned !!
212 TSM:FPAR
223 ?TSF:MSG:SEND,170-170-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
2263 !TSM:FPAR:NO REPLY
2275 TSM:FPAR
2285 ?TSF:MSG:SEND,170-170-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
2717 TSF:MSG:READ,0-0-170,s=255,c=3,t=8,pt=1,l=1,sg=0:0
2746 TSF:MSG:FPAR OK,ID=0,D=1
2785 TSF:MSG:READ,7-7-170,s=255,c=3,t=8,pt=1,l=1,sg=0:1
4325 TSM:FPAR:OK
4333 TSM:ID
4339 TSM:ID:OK
4347 TSM:UPL
4358 TSF:MSG:SEND,170-170-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4395 TSF:MSG:READ,0-0-170,s=255,c=3,t=25,pt=1,l=1,sg=0:1
4425 TSF:MSG:PONG RECV,HP=1
4440 TSM:UPL:OK
4448 TSM:READY:ID=170,PAR=0,DIS=1
4470 TSF:MSG:SEND,170-170-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
4509 TSF:MSG:READ,0-0-170,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
4546 TSF:MSG:SEND,170-170-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2
4589 TSF:MSG:SEND,170-170-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
4628 TSF:MSG:READ,0-0-170,s=255,c=3,t=6,pt=0,l=1,sg=0:M
4663 TSF:MSG:SEND,170-170-0-0,s=255,c=3,t=11,pt=0,l=21,sg=0,ft=0,st=OK:Coin Cell Stable Node
4716 TSF:MSG:SEND,170-170-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
4759 TSF:MSG:SEND,170-170-0-0,s=1,c=0,t=0,pt=0,l=19,sg=0,ft=0,st=OK:CCSN - Reed contact
4806 MCO:REG:REQ
4816 TSF:MSG:SEND,170-170-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
4855 TSF:MSG:READ,0-0-170,s=255,c=3,t=27,pt=1,l=1,sg=0:1
4884 MCO:PIM:NODE REG=1
4898 MCO:BGN:STP
Coin Cell Stable Node 1.0 - Online!

4921 MCO:BGN:INIT OK,TSP=1
4941 TSF:MSG:SEND,170-170-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
Reed contact changed - now 1

4995 MCO:SLP:MS=5,SMS=0,I1=255,M1=255,I2=255,M2=255
5021 TSF:TDI:TSL
5031 MCO:SLP:WUP=-1
5042 TSF:TRI:TSB
Wake up - Short cycle after REED contact change.

5085 TSF:MSG:SEND,170-170-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
5122 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255
5150 TSF:TDI:TSL
5160 MCO:SLP:WUP=-1
5171 TSF:TRI:TSB
Wake up - now minute 1

5197 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255
5224 TSF:TDI:TSL
5234 MCO:SLP:WUP=-1
5244 TSF:TRI:TSB
Wake up - now minute 2

5271 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255
5298 TSF:TDI:TSL
5308 MCO:SLP:WUP=-1
5318 TSF:TRI:TSB
Wake up - now minute 3

5345 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255
5371 TSF:TDI:TSL
5382 MCO:SLP:WUP=-1
5392 TSF:TRI:TSB
Wake up - now minute 4

5419 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255
5447 TSF:TDI:TSL
5455 MCO:SLP:WUP=-1
5468 TSF:TRI:TSB
Wake up - now minute 5

5494 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255
5521 TSF:TDI:TSL
5531 MCO:SLP:WUP=-1
5541 TSF:TRI:TSB
Wake up - now minute 6

5568 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255
5595 TSF:TDI:TSL
5605 MCO:SLP:WUP=-1
5615 TSF:TRI:TSB
Wake up - a long period has passed.

5652 TSF:MSG:SEND,170-170-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:105
5695 TSF:MSG:SEND,170-170-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
5732 MCO:SLP:MS=60000,SMS=0,I1=1,M1=1,I2=255,M2=255
5758 TSF:TDI:TSL
Tags: domotica nodes
Comments: