PiCNN is a lightweight, open-source, single-header C++ library for Convolutional Neural Networks that is capable of running on single-board computers such as the RaspberryPi. It enables practical machine learning for Raspberry Pi programmers without the hassle, size, and computational requirements of installing and running larger machine learning frameworks. I developed this library during a past internship at the University of Cambridge’s Computer Laboratory.

Check out a brief presentation of PiCNN: PiCNN Presentation

Or take a look at the complete derivation of PiCNN: PiCNN

The source code is available here on GitHub.

Fixed-Wing UAV Flight Control System

I’m designing a complete flight control system from scratch. This includes the hardware, low- and high-level software, control and guidance algorithms, telemetry protocols, ground control station, etc.

Check out the source files on GitHub: https://github.com/pms67/HadesFCS

A video giving a broad overview of the hardware design:

Here’s a sneak peek of the hardware!

Low-Noise Headphone Amplifier

Low-noise, stereo-to-mono headphone amplifier. Pictures of the completed system can be seen below.

The amp consists of a set of input buffers, a summing amplifier, Baxandall volume stage, and finally a class AB output stage.

The PCB was designed in KiCAD.


It is rated for 9V but can be used with a supply voltage of up to 18V. Bandwidth (-3dB points) was designed to be from 20Hz to 20kHz when driving an 8 Ohm load. The amp can however drive larger loads easily, such as Beyerdynamic DT 880 Pro headphones at 250 Ohms.

The amplifier consists of four main sections:

  1. Power supply section: Reverse polarity protection, power supply filtering, bias voltage generation.
  2. Input buffers and summing: Simple NPN emitter followers (using standard BC547s) as high impedance buffers followed by a an approximately unity gain, op-amp summing amplifier (low-noise NE5532).
  3. Active volume control: This is a low-noise, Baxandall volume control (seen in Douglas Self’s book ‘Small Signal’) giving up to 17dB of gain.
  4. Output power amplifier: Finally, the output stage consisting of a unity gain op-amp buffer and a class AB power amplifier, capable of driving loads as small as 8 Ohms.

Self-Balancing Bicycle

As part of my final year at university, I built a full-scale rider-less, self-balancing bike. This involved the modelling, simulation, control system design, and mechanical/electrical/software implementation.


Read the final report by clicking here!


PID and H-Infinity controllers:

Full-scale bicycle test run:

Some pictures of the full-scale bicycle:


Quaternion EKF for UAV Attitude Estimation

An extended Kalman filter implementation specifically tailored towards (small) fixed-wing UAVs using a quaternion-based attitude representation.

Download: Quaternion-Based Extended Kalman Filter for Fixed-Wing UAV Attitude Estimation (PDF)

An essential part in controlling an Unmanned Air Vehicle (UAV) is having accurate and reliable state estimates available for feedback, which are then used in the governing control systems. Unfortunately, estimating these states – such as roll, pitch, and yaw angles – is no trivial task in such a dynamic environment and when using relatively inexpensive, noisy sensors.

A tried-and-tested method of state estimation of dealing with this problem is via the
use of an Extended Kalman Filter (EKF), which can also handle non-linear system
models via linearisation. The EKF is the industry-standard in most systems these
days, such as commercial aircraft and figher jets.

To circumvent problems with computationally expensive operations, numerical stability, and gimbal lock, a quaternion-based EKF is developed, as opposed to representing the aircraft’s attitude via Euler angles. The EKF in this document is
specifically tailored to a (small) UAV and common sensors aboard such a system.

A final implementation in both Matlab and C code is also given (See: https://github.com/pms67/EKF-Quaternion-Attitude-Estimation).