Firmware Programmer using a Raspberry Pi

Work needed a low-cost way to program all the different firmware for various products. They ranged from nRF52 BLE beacons, LTE modems, and ESP32-based sensors.

They also needed to:

  1. Pick up the MAC address of each BLE sensor via Bluetooth scan and print a tiny label with a QR code.
  2. Scan the barcode of a SIM card and print a QR code.

I figured it a factory setting it was easier to have a small footprint, limited feature programmer box than to have a bunch of laptops.

System Components

  • Raspberry Pi
  • 20x4 character LCD with I2C backpack (Amazon)
  • 4-button board (AliExpress)
  • Barcode scanner module (AliExpress)

The code was written in Python. I made a menu system that picked the function to perform.

The I2C backpack on the LCD makes it much easier to connect, needing only 4 wires to the Pi. It uses an I2C GPIO expander to control the parallel interface of the character LCD.

Programmer Internals Text LCD with I2C board, 4-button board, Raspberry Pi in the box

I made 8 or 10 of these programmers and we deployed thousands of devices into the field that year before we outgrew this system.

Enclosure

A 3D printed enclosure can be easily mass produced instead of modifying an off-the-shelf enclosure one by one. We did not have a CNC mill at the time, anyway.

So this was the perfect excuse to build up my 3D modeling skills. OpenSCAD is free and easy to use once you get used to it. It works well if you like writing code and your device does not have complicated curves.

OpenSCAD Enclosure in OpenSCAD

Software

I wrote the software in Python with help from libraries that supported the label printer and the Bluetooth scanning.

Python Software

The menuing system was from scratch. The menu was defined as a large tuple in a JSON-like format and Python logic that went through the menu items as the buttons were pressed.

Label Printer

The label printing function prints the MAC address of a sensor it found over Bluetooth, or a SIM card scanned by the barcode scanner.

QR label