This tutorial describes the creation of an activity monitoring devices for use in a variety of location. It is compact, waterproof and low-power, making it idea for use outside in woodlands, parks and other green spaces. With a good set of quality batteries the operational duration of the device can be expected to be around a month. Much however depends upon number of people in the space and the amount of triggered of the sensor !
It is important to note that the described device cannot provide an accurate (absolute) count of footfall. Rather, it offers a mechanism to capture the relative patterns of activity with in a space.
Step 1: Components
This project makes use of the excellent Ardulog board from Hobby Tronics. Combines arduino-compatible microcontroller with (battery backed up) realtime clock and SD card data logging features. All combined onto a small form-factor board for a very reasonable price. Other key electronic components include:
- Passive Infrared (PIR) sensor - Parallax or similar (many available on ebay)
- 4 x AA batteries held in a slim-line battery case
- Micro SD card for logging activity
Additionally, you will need a USB-to-serial converter in order to program the Ardulog board (for example the FTDI Basic Breakout)
Step 2: Wiring
Both Ardulog board and PIR sensor can receive the 6 volts delivered by the 4 x AA batteries. These should therefore be wired in parallel as shown in the diagram.
The output signal of the PIR sensor should be wired to pin 2 on the Ardulog board (as shown in the diagram).
Be sure to check the pin-out order on your PIR sensor to make sure it is the same as the one in the diagram (you might have to remove the white plastic lens to see the labelling !)
Step 3: Code
Download the below Arduino program and upload it onto the Ardulog board. The code is as power-efficient as we could make it - using a deep sleep mode to save power and an interrupt (INT0) to wake up when someone approaches.
The code stores a timestamp on the SD memory card to record when activity is sensed. It is worth noting that a new file is created for each sensed activity. Although this leads to many files, it reduces the risk of total data loss (imagine the potential impact of a loss of battery power half-way through writing to a single large log file !).
You can go further to reduce power consumption, but this will involve hardware modifications to the Arduino (from example removing the LED).
Step 4: Enclosure
To help protect the delicate electronics, we needed a waterproof, temperature resistant, vandal and theft-proof container. We ended up using a composite enclosure that consisted of two separate layers (see cross-section diagram). The inner layer was a thin waterproof plastic tube (repurposed from off-the-self bubble wands). The outer layer was a thick wooden fencing post. A deep hole was drilled into the post to receive the inner plastic tube. Additional holes were drilled in the wooden post to allow the infrared sensor to detect activity and a downward-facing drainage hole to prevent the accumulation of water inside the post. A thick wooden cap (secured by “star drive” screws) was then attached to the top of the post.
Step 5: Deployment
The completed device was then wire-tied to a permanent structure (e.g. existing signs or fence posts) again to prevent theft. It is important to select the positioning of sensor careful to achieve maximum potential (for example near entry and exit points into the green space areas or at particular pinch points (such as gates and bridges). We also need to be careful to avoid activities that might accidentally trigger the sensor, such as car parks and known badger habitats.
Step 6: Data Retrieval
After a desired period of deployment, the devices can be collected and the data retrieved from the SD Cards. Simple tools such as spreadsheet applications can be used to aggregate the data (for example into hourly rates) and generate graphs and other visualisation.
We have built our own data analysis and visualisation tool, which was used to generate the above "heatmap" graphic. If you'd like to have a go with it, the source code is attached (for the Processing language). Brief instructions are in the zip file - full details will appear in a future instructable !