Posts

kieferbot: teleop

As a winter project, I’m turning my PinePhone into an indoor robot. The Pinephone has everything needed for a decent stand-alone robot: plenty of CPU, a camera, gyro/accelerometor/compass, display, and it can run Debian. Below is a video of the hardware in teleop mode. A Lolin32 ESP32 running MicroPython takes commands over Bluetooth LE and sends PWM and direction signals to the FIT0441 motors. The frame is 3D printed. Currently the phone is just a passenger.

Bare metal Raspberry Pi Zero

These are short notes on loading baremetal software on the Raspberry Pi Zero. I started down this path due to wanting to learn Rust, which lead to Tock which is an embedded operating system in Rust. Rather than buy yet another piece of hardware I though I’d use one of my 5 (!) Raspberry Pi Zeros as a development board instead. It’s just another microcontroller, just one that runs at 1 GHz and has a ton of RAM…

ESPHome as a Ruuvi bridge

ESPHome is a framework for building custom home automation that runs on an ESP8266 or ESP32. It’s pretty cool - you select and configure components by writing a YAML file, which then drives host side Python snippets to configure and bind the device side code, which is then built and pushed using PlatformIO. Some nice touches: It integrates with Home Assistant and has automatic discovery It can drive displays, including rendering TTF files host side to give nice fonts device side It looks reasonably composable so, for example, you can have multiple Bluetooth broadcast parsers I used this to bridge between Ruuvi tags and my Home Assistant instance.

Android phone as an alarm clock

My son wanted to get an alarm clock for his room which preferably plays MP3s. MP3 players are surprisingly expensive at 40 CHF for a 4 GiB model so I picked up a used Moto E 2nd gen phone for 35 GBP, loaded a stripped down version of Lineage OS on it, and designed a 3D printed a stand: I’m quite happy with how it turned out. The phone is just an alarm clock and MP3 player as the other apps are either not installed or (like the Play Store) behind Lineage’s protected app feature.

ST Link v2 clone as a dev board

I got distracted and had a hack on using a STL Link v2 clone as a development board. There’s a lot to like: A Cortex-M3 STM32F103C8T processor with 64 KiB of flash and 20 KiB of RAM 4 I/O lines and a LED to blink Decent support in STM32duino with a DFU bootloader Comes in a case and plugs directly into a USB port ~$2/each The I/O is strange and limited but it’s enough to drive a RGB LED via PWM, drive a 40 RGB LED pHAT over SPI, and drive a 320x240 LCD over fast bitbanged SPI.

SDHC over SPI performance

I’m hacking on adding SDHC over SPI block device support to the Zephyr Project RTOS. I’m currently getting 224 KiB/s on an Arduino Zero with a 4 MHz bus and 1 KiB read size, which is an OK-ish 46 % of the top bus capacity. Here’s where the time goes: 4550 us - total time to read 2x 512 byte blocks from the card 80 us - time spent in ELM FS (impressive!

The many different CRC16-CCITTs

I’m hacking on adding Arduino Zero support to the Zephyr Project at the moment. I had a look at speeding up crc16_ccitt() but ran into a problem: there’s so many variants of CRC16-CCITT to choose from! Zephyr uses CRC-16/AUG-CCITT which is equivalent to CRC-16/CCITT-FALSE with two zero bytes prepended. The effective seed is 0x1d0f and test vector output is 0xe5cc. Mynewt uses CRC-16/XMODEM. The seed is 0 and test vector output is 0x31c3.

OpenOCD with the ST-Link v2

There is an issue when trying to program a SAMD21 like in the Arduino Zero using OpenOCD with a ST-Link v2 which gives errors like this: ** Programming Started ** auto erase enabled Info : SAMD MCU: SAMD21E18A (256KB Flash, 32KB RAM) Error: Failed to erase row containing 00000000 Error: SAMD: failed to erase sector 0 Error: failed erasing sectors 0 to 0 The issue is that NVMCTRL_CTRLA is a half-word register and the ST-Link v2 emulates the half word write using two single byte writes.

SAMD21E18 PCB

In follow up to my mysensors.org build, I’ve always wanted to design PCB and try my hand at SMD soldering. I normally use veroboard on a 0.1” pitch but the time to cut and solder wires makes for a slow build. Here’s the result: It has: An AT91SAMD21E18 (256 KiB flash, 32 pins, 0.8 mm pitch) USB, regulator, Cortex SWD debug header, LED, and pullups on I2C Footprint for a RFM69CW radio Adafruit Feather form factor Two layer PCB with 0603 passives The soldering turned out well.

MySensors

It gets warm and humid here in the summer and feels too dry in the winter. To measure this I built up two MySensors Sensebender Micro boards and designed a 3D printed a case to go with them: The holes in the case are to save on print time and let the air flow. The battery is far oversized and probably self discharges faster than the board draws current. I ended up using a Raspberry Pi Zero with a RFM69HW as the gateway.