After a lot of experimentation, research and prototyping, I finally have all the parts I need to finish my PIR sensors. I plan to have one in each room, well almost.
They will have two functions. Primarily they will be used to track us and switch lights and heating (Nexa remote switches) as appropriate when we are home. The switching will follow certain rules, like time of day, who is home, weekday, weekend etc. When no one is home, they will be part of the security system and notify us, using Pushbullet, if they sense movement while we are not home. Both functions will be controlled by DomotiGa running on a Raspberry Pi, using a RFXCOM rfxtrx433e USB transceiver.
Earlier I used a Tellstick Duo to receive and transmit signals. The protocol to use then was the Nexa (AC) protocol. The PIR prototype would then send an "On" signal, when movement was detected. After I replaced the Tellstick with the RFXCOM rfxtrx433e USB transceiver, I changed the protocol to X10 RF. The X10 security protocol is more suited as it has a built in signal for PIR sensors. It will send "Motion" instead of "On", when movement is detected. The signal is then processed in DomotiGa, which in turn will take the appropriate action based on the predefined rules.
Until now I have used standard 1.5V AA batteries tp power my sensors, including the Moteino. I'm now experimenting with the 3V CR2477 950 mAh coin cell battery. The benefit is the small size. A bit higher than "ordinary" coin cells, but a huge space saver anyway. On the other hand they can only deliver 950mAh, compared to 2700 mAh AA batteries.
The PIR sensors consists of a, well PIR sensor (HC-SR-501), Arduino Pro Mini, a 433MHz transmitter (MX-FS-03V) and a 950 mAh CR2477 coin cell battery. All built in to an appropriate enclosure. See the complete part list, schematic and source code below the pictures.
Since these sensors will run on 3V, I will have to connect the PIR a little differently than explained in the datasheet. The sensor is made for 5V, but you may omit the voltage regulator and connect directly on the 3.3V pin. For more information about this, have a look here. I have found that this sensor comes in two different configurations, so if you build this, make sure you get the right one.
I managed to assemble the first unit in about 3 hours. After the first unit was complete, it took about 1 hour to assemble 2 more. Due to the small space in the box I had to plan the placement of each part carefully. Also I intended to use as little as possible of crossing wires over the vero board. I think I did quite well with only 3 wires. After I finished the assembly I discovered that the male headers and the jumper wires was to high to fit the lid on the box. The solution to this was to bend the jumper wires connectors 90 degrees. See image.
I have loosly calculated that with this configuration, the battery will last for up to 2 months, maybe more. The power consumption during standby is about 400 uA. I could have it down to about half that if I disabled the voltage regulator, but then the programming of the Arduino would be quite a hassle, so I'll try with this setup first.
On the side I can mention that this sensor is the exact same as my PIR sensor for Tellstick Duo. The only thing I changed was the battery type and the code. The PIR sensor for Tellstick Duo ended up as just a prototype.
The code (may change without notice):
- PIR sensor (HC-SR-501)
- Arduino Pro Mini
- 433MHz transmitter (MX-FS-03V)
- 3mm red LED
- 100 ohm resistor
- Veroboard or PCB
- Male headers
- Short female to female jumper wires
- CR2477 battery w/batteryholder