2 minutes, 12 seconds
Last year I wanted to be a “Hacker” and code up a solution to show near by access points and nearby phones. I failed. However, I did a good job of brushing up on what I needed to do over the past year and so this year I was a hacker for reals. Here I am in the final get up:
Let’s break it down! Here’s the hardware list (affiliate links to Amazon):
- Big ol’ USB battery (USB-PD, no less!)
- Raspberry Pi 3 B+
- MicroSD card
- 9″ HDMI & USB-C monitor
- External USB WiFi adapter which allows monitor mode
- Jumper Cables
- BME280 Temp and Humidity Sensor
- Misc USBC & MicroUSB cables
- 2 buckling straps – One to hang the monitor around your neck and one around your waist to keep it from bouncing about. I found two in my camping gear.
- 8 zip ties – 4 around each VESA screw and also around 4 other zip ties attached to the straps (like this)
- Velcro cable ties, you can never have enough!
- Optionally a run of EL wire to spice things up and add visibility while you walk around with your kids
- Extra optionally a silly “Hacker” name tag ;)
- EXTRA optionally a pair of Coveralls – but really, you’ll need a lot of pockets.
My final build out looked like this:
A quick write up of the software is:
- install latest Rasbpian on your MicrSD card
- Install latest YANPIWS in /var/www/html/YANPIWS
- Install howmanypeoplearearound as the pi user. Ensure it’s path is
/home/pi/.local/bin/howmanypeoplearearound
- Ensure you have all the libs for YANPIWS python scripts installed so you can talk to the BME280
- Hook up the BME280 to the right 4 pins on the Pi using the jumper cables
- Hook up the monitor to the Pi’s HDMI and the External WiFi adapter a USB port
- Have the Pi boot into kiosk mode with a browser that points to
http://127.0.0.1
by following this awesome guide on pimylife.com. Note that you’ll only use the one URL and have nowhile
loop in the kiosk bash script. - Install Apache and PHP with
sudo apt install apache2 php
- In
/var/www/html/
put all of the files I just published on this gist. Basically it’s a small web app to show the data we’re collecting as well as some bash scripts that get run in cron. - Install a bunch of cron jobs that gather the data as the
pi
user. This will usewlan0
(built in) to look for nearby access points using the venerableiw
command. It will usewlan1
(USB adapter) to look for phones and such in monitor mode usinghowmanypeoplearearound
. Finally, it will get the temp and humidity using the python script from YANPIWS. You may need to make/var/www/html
writable bypi
user to make this work.
It’s not my finest code, but if everything worked correctly, the Pi will boot up every time and show something like this:
As you can see it got cold tonight on our walk – by the time we got home at 8pm it was 45. Happy Hacker Halloween!