Wireless PIR Sensor
The purpose of this project is to make a wireless motion sensor powered on batteries.
It can be used for alarm system, lighting etc ...
It can dure months on the batteries, depending if it is triggered often or not.
Bill of Materials
Materials :
- Motion detector HC-SR501 (ebay, aliexpress, adafruit ...)
- 433 Mhz (315 Mhz for USA) superheterodyne Transmitter and Receiver (aliexpress)
- 2 NiMh accumulators
- FTDI USB-Serial adapter to program the board
Skills:
- Eagle cadsoft
- PCB making
- 3D printing
The PCB
The PCB is powered by 2 NiMH accumulators (2 * 1.2 V = 2.4V). This voltage is powered up to 5V by the MT3608 boost converter. This component consumes less than 1mA when idle, what is convenient for portable applications.
I've used an atmega328p to be Arduino compatible because Arduino is cool and it does the job ;-)
- The LED2 is the same as the built-in LED of Arduino Uno (pin 13).
- ISP1 will let us to burn the Arduino bootloader.
- RF Transmitter is powered directly by PB2 (pin 10 on Arduino) : the RF module consumes 20mA when emitting, PB2 can deliver up to 40mA, so it is enough :-)
- The PIR sensor is plugged on a XH connector, it consumes only few micro-amps.
- The FTDI connector let an USB-Serial adapter to be plugged and then to program the board directly from the Arduino IDE.
I've used Eagle to design the board and OSH Park to make it.
As soon as the components are soldered burn the Arduino bootloader and you will have an equivalent of Arduino Uno.
About Programming
You must use the sleep mode feature of Arduino to save battery life !! Else the batteries won't last for long.
The algorithm should behave like this :
- Set wake up trigger on PB1 (pin 9)
- Sleep (the consumption goes down to few micro-amps)
- Arduino will stop here till the motion sensor triggers
- Wake-up
- Send an RF signal and go back to sleep mode
I give you my program but it is just an example of what can be done.
I've used the RH_ASK library : https://github.com/PaulStoffregen/RadioHead
Downloads
Make a Case
A 3D printer is a very good tool to make cases when you are an electronic hobbyist.
I made the design with Fusion360. It is made for outdoor, so water proof : I've cut a seal made of cork wood to close the assembly.
The case is made of PLA, whatever you can read on internet, it can support bad weather for years.
The 4 screws are M3. The PLA has been threaded with a tap, it works fine on this material, just do not tight too much.