The main idea behind the project came from a partner involved in retail, as he wondered how to effectively measure if he was drawing people to its commercial booths and folding stands, where people stopping by to pay attention? how many people stopped compared to the people walking nearby? what did they look like? are this people the commercial target?
There are existing solutions (proprietary that is) that try to answer most of these questions, but what if we build our own? Taking out mandatory considerations whenever you are to take pictures of people without them noticing (take good attention about this! privacy and anonymity should be always a must!), we have developed a simple system that whenever detects a person closing by, takes a picture and uploads it to twitter.
As the wireless sensor we used the Zolertia RE-Mote platform, an ultra low-power and dual radio device (2.4GHz and 868/915MHz bands), hooked with a simple motion sensor from Groove. Whenever the sensor detects a presence, it drives a pin high for a given number of seconds (depending on the distance). The motion sensor signal pin
is connected to the PA5
of the RE-Mote, connect also GND
and D+3.3V
accordingly.
The application is started when the user button
on the RE-Mote is pressed, then it loops forever, checking every second for presence. If it detects a person nearby, then sends a radio message to a receiver node connected to the Raspberry Pi, and increases the detection time to 20 seconds (to avoid spamming). If the presence sensor doesn't pick up anyone then it returns to a faster check rate, else it sends a message again and continues polling every 20 seconds.
The receiver node connected connected to the Raspberry Pi is another RE-Mote (in the photo is shown another model, but any RE-Mote connected over its USB port will do). The receiver toggles a LED whenever it receives a message and then forwards it over via USB, where a Python script running on the Raspberry Pi reads the content, then takes a picture with the on-board camera and attaches it to a gmail message. The email is picked up by IFTTT, triggering a twitter update.
We powered the Raspberry Pi using a 7200 mAh power bank (a portable battery charger), tapped to the Raspberry Pi's enclosure. This provided enough juice for half a day while testing the setup, making this solution at least portable and easy to fix anywhere. We also used a WiFi dongle to connect to the AP.
The following assumes you have a python installation (and pip) in your system.
First get the cc2538-bsl
script to flash the RE-Mote over USB.
git clone https://github.com/JelmerT/cc2538-bsl
cd cc2538-bsl
pip install intelhex
pip install python-magic
Then download the pre-compiled binaries and flash one RE-Mote as receiver and the other as the wireless motion sensor.
To flash the RE-Motes then run the below command, changing the /dev/ttyUSB0
(Linux) for COM11
(Windows), /dev/tty.SLAB_USBtoUART
(OSX), depending on your Operative System. You need to install the CP2104 driver for your system for the RE-Mote to be recognized (not necessary on Linux).
python cc2538-bsl.py -e -w -v -p /dev/ttyUSB0 image.bin
Copy the Serial-photo.py
script in the /home/pi
folder in the Raspberry Pi, then to be executed automatically add the following line to the /etc/rc.local
file:
python /home/pi/twitter-post-pi/Serial-photo.py &
Configure the user email and password in the Serial-photo.py
script, set up your account in IFTTT, and there you go!
This is our experimental setup, the photos were published to a twitter test account. We included in the message the 16-bit
address of the RE-Mote to be able to replicate and use many wireless motion sensors in different places and tag with geolocation references.
The radio interface used for the experiment was 2.4Ghz, which gave roughly 30m in indoor locations, and over 200m in outdoor with line of sight. The demo-stand application sources (available in the Github repository) allows to recompile the example, and use the 868/915MHz radio, to achieve a longer range and obstacle penetration if required.
Comments