Lockdown project 2 – wooden Pi Camera

So after reading this article about building your own camera with a Raspberry Pi 4 by Becca Farsace from The Verge I was sold. It was still (sort of) lockdown, I had waaay too much Raspberri Pi stuff. So i went about making my own.

First off I got the core components.

  • Raspberry PI 3A+ (already owned)
  • Raspberry Pi camera module
  • C-Mount lenses (Pentax 25mm, Raspberry Pi 6mm Wide Angle Lens)
  • Puck.js button (to remotely control the device – essentially the shutter release button)

I then tried to get a suitable case, I first bought a couple of second hand broken camera bodies off of eBay, an old Pentax film camera, but it was too small to house the Pi, then a Olympus underwater camera housing which very nearly worked after hacking at it, but I couldn’t then screw the lenses in! Finally I decided I needed to make the case. So bought some 3mm plywood…..

Et voila.

View of camera from the front

Now for the programming, I am a web developer, but my craft is HTML, CSS, Javascript so not really a l33t python dev. So this was mostly trial and error, oh and a shit load of googling (a.k.a. The Web Developer’s Handbook ™ ® ©)

I use rmate because I *still* can’t use VI/nano

The first file is the command we want to run, based around raspistill, well use this later. So I created a file called camera.sh which will take the photo and save it to an Apache server instance to you can remotely access it, e.g. http://192.168.0.*


# Unix time and date filename
sudo raspistill -f -ts -o /var/www/html/photos/PI_CAM_%d.jpg

Now to set up the Puck.js button, we can use the web based IDE to flash code the device, this code (below) will allow the Puck.js button to act like a bluetooth keyboard key, e.g. F7, (note the Puck needs to be paired with the Pi)

//For Puck.js 8b1e

var kb = require("ble_hid_keyboard");
NRF.setServices(undefined, { hid : kb.report });

//F7 key - https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
function btnPressed() {
  NRF.sendHIDReport([0,0,64], function() {

// trigger btnPressed whenever the button is pressed
// consider repeat:false
setWatch(btnPressed, BTN, {edge:"rising",repeat:true,debounce:50});
function ledBlink() {
  setTimeout(function() {
  }, 250);

Now we need to set up a multimedia keyboard daemon that can intercept the Puck.js button click (which for our purposes is going to act as a bluetooth keyboard – a one key keyboard). I found something called esekeyd and here are the various commands to get that firing

sudo apt-get install esekeyd
sudo keytest /dev/input/event1

// sudo learnkeys /etc/esekeyd.conf /dev/input/event1
// where eventX == result from above, e.g. event1

sudo learnkeys /etc/esekeyd.conf /dev/input/event1

// Press F7 (), esekeyd will create the configuration file you need (esekeyd.conf). You then need to edit it with your editor of choice. You’ll see a line like this: `#F7(press):` Delete the #, and add your desired command directly after the : (no spaces!). Your new line might look something like this:


// Make sure the sh file is executable

chmod +x camera.sh

// Now let's set up the config
touch esekeyd.conf
rmate esekeyd.conf
sudo cp esekeyd.conf /etc/esekeyd.conf

//run the file
sudo esekeyd /etc/esekeyd.conf /dev/input/event1

//to run on startup
sudo nano /home/pi/.bashrc
sudo esekeyd /etc/esekeyd.conf /dev/input/event1

mkdir -p ~/.config/autostart
cd /home/pi/Desktop
touch terminal.desktop 
rmate terminal.desktop
sudo cp terminal.desktop ~/.config/autostart

This file, terminal.desktop, will launch terminal and the esekeyd service so the camera is ready to take clicks from the button however this didn’t work for me, terminal opens up but I get an error ‘Failed to open /dev/input/event1 (Permission denied)’ I think this is because bluetooth hasn’t enabled yet, I dunno.

[Desktop Entry]
Comment=Test the terminal running a command inside it
Exec=/usr/bin/lxterminal -e "bash -c 'sudo esekeyd /etc/esekeyd.conf /dev/input/event1;$SHELL'"

And there we have it a (mostly) working camera. Here is it:

And here is a time-lapses I took with the wooden pi Camera.

And some of the camera in action / build process

View of camera mounted to balcony
Me building the wooden case

dogwonder.co.uk is dead long live dogwonder.co.uk

This site has been running since 2004 💪 primarily as a blog. The origins of the url are that it was a nickname I received early on in my career. I carried it through to internet usernames and then the title of my blog. And in 2012 the name of my Ltd company. Dogwonder Ltd. As such it made sense to have this site as a sort of blog / company site. I had a few different layouts, but it never quite worked out, what was the purpose?

Anyway after some recent discussions, it was pointed out to me I am mostly known professionally by my name not my brand so it made sense to leverage that for my professional work (whilst still trading as Dogwonder Ltd) and retain this site purely for blogging once or twice a decade 😜.

richholman.com is now a thing. Focused purely on my professional side.

dogwonder.co.uk is just for shits and giggles now (and some code probably).

The many many other urls I have registered over the years, who knows.

Hackercise bike

During lockdown I was fortunate enough to have continued work building websites, in-fact due to Covid-19 various organisations needed to pivot focus I was busier than usual. So although I didn’t suddenly find myself with loads of time on my hands there was still plenty as I wasn’t going out or travelling to an office.

And on that part of not travelling, I really missed my daily cycle into my office space. It was only 2 miles each way but with lockdown I really started to feel the lack of that daily exercise.

So I emergency purchased an exercise bike – a ‘Roger Black Gold Folding Magnetic Exercise Bike’ for £109 from Argos a week before lockdown (we all knew it was coming right).

During the early stages of lockdown it was a real boon. But I still missed the feel of my bile as well as the ability to track my ride. The Argos one very much didn’t have these capabilities. As such the Hackercise bike was born. I bought or repurposed the the following.

  • Bike tape
  • Garmin Speed Sensor 2 (key to tracking distance)
  • Garmin Cadence Sensor (optional)
  • Garmin out front mount
  • Garmin 520+ Edge bike computer

Now the Speed sensor is meant to go on a proper bike, and the one I bought had a flywheel, I tried to see if I could attach the sensor to it in some way, but there was no good place to do so. So I attached it to the pedal crank. I read somewhere that if you then give the Garmin Edge a fake wheel circumference that you could trick it into thinking it’s a real bike. Anyway, I did so and using the existing speed sensor that came with the bike I was able to calibrate the sensor with the wheel circumference at a massive 4.85 meters. But what the hell, I had an accurate(ish) reading.

It was on.

That sorted I removed the foam padding from the bars, removed the existing computer (basic LCD) – tapped up the bars, and added the mount. It actually felt like a real bike! And I was able to record my rides!

The project had two purposes, firstly a little focus during some pretty dark times, and secondly it also allowed me to exercise more which then helped with purpose one.

And it worked! Here’s a Strava activity from the Hackercise bike.

And some photos, the first one is the original setup.

Nunjucks and rediscovering web development

So I am still very much love WordPress, I even had a cold embrace with Gutenberg (no React for me though, I strictly follow the three important rules that must never be broken: do not expose the mogwai to light, especially sunlight, which will kill it, do not let it come in contact with water, and above all, never feed it after midnight, ACF all the way for me💪) but the entire WordPress 5 tug of war did get me thinking, I really don’t need to be so wedded to one CMS or even a set method of building sites.

For some time I had considered static site builders (*again*, I used to build sites in Movable Type). And given I didn’t have to learn React I could learn something else I actually wanted to do and not pipe 400kb down the pipe before rendering 1 line of HTML (and lets face it WordPress is not ideal here in the first place). Obviously the CMS part was the reason I build so many websites in WordPress in the first place, but not all websites need a CMS. I’ve build many CMS’ for people that thought they needed the ability to edit their site, and probably never logged in to it (and sometimes just ask me to update stuff, because they don’t know what to do or the interface has changed way too much 😜). So I figured why not static, more secure, faster, and I get to get back to what I really love crafting websites mostly in HTML/CSS and a sprinkle, Salt BAE style, of Javascript.

I’ve been playing around with Handlebars, Jekyll for a bit and liked them, and then found out about Nunjucks (can’t remember where, but I knew Gov.uk used it for their site). Really liked it a lot, I’ve been using npm/Gulp for a number of years, and many different template engines/systems, so felt comfortable using it, hell WordPress is one of the best right, but also used liquid, django and probably others that are gathering dust in a SVN repo somewhere.

I liked the fact it was like hand coding a site, but on steroids, I could hook it up to a JSON file like a lightweight CMS and generate all the pages I needed, I could use even markdown files as content as well (with the addition of a package). Set off a gulp task and HTML pages came out the other side of the npm machine, like a website factory with lots of little AI helper bots, with myself in an upstairs office looking on.

It also allowed me to concentrate more on accessibility and performance, something I really care about, often with WordPress sites, there were a ton of external dependancies and code that I just can’t control. It also allowed me to create something open source, which I don’t do enough.

So the end point of all this chatter was a little static starter kit called juckWonder (geddit?) that I will use as a starting point for small static sites I need to build. The code is available here on GitHub. I intend to keep on developing and improving it, but pretty happy to where I’ve got with it, I even managed at one point to achieve the holy grail, 💯 across the board on a lighthouse test. Oh yes. Performance doesn’t always return 100 but it’s on a Github pages instance so I wouldn’t expect it to.

So in a roundabout way I am pretty happy WordPress development moved away from me, I got to embrace other parts of development I missed.

2020 2019 2017 2016 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004