M0AGX / LB9MG

Amateur radio and embedded systems

  • Connecting Modbus RTU to TCP with Waveshare RS485 to Ethernet converter

    I have been planning to connect my Modbus electricity meter to Home Assistant for a while. Unfortunately my Home Assistant machine is placed far away from the breaker panel and I wanted to avoid running extra cabling. Modbus RTU to Modbus TCP conversion has been a solved problem for a …

    Read more...

  • Connecting a Modbus energy meter to Home Assistant

    I have an electricity meter that supports communication over Modbus. I wanted to add it to Home Assistant. Modbus is supported out-of-the-box by Home Assistant but I could not find an end-to-end tutorial how to connect a device and how to use a Modbus sensor for energy tracking. This article …

    Read more...

  • Getting Home Assistant uptime in minutes

    My Home Assistant installation sends out several "device normal" notifications right after startup. I wanted to avoid being bombarded with useless notifications so I needed to filter out these events. The most obvious condition can be Home Assistant uptime. Basically: send a device status notification only 1-2 minutes after startup …

    Read more...

  • Water leak app notification in Home Assistant

    Home Assistant is an extremely flexible home automation solution that does not come in a magic locked-down box. The flexibility comes with difficulty figuring out how to actually do things because of so many options and different approaches (just like with Linux overall).

    I installed some Zigbee water leak sensors …

    Read more...

  • Migrating to Pelican

    Returning readers: please update your feed reader with the new RSS or Atom URL.

    Last updated 06 Aug 2023.

    I decided to migrate my blog from Wordpress to a static site generator. My main motivation, apart from just trying something new for the sake of it, was the endless stream …

    Read more...

  • Oscilloscope bandwidth benchmark

    What is the impact of oscilloscope bandwidth on the observed signals? Does a bandwidth of 25 MHz mean that a scope will display a 30 MHz signal only with a lower amplitude? Can oscilloscopes work around Nyquist with equivalent sampling? Is a scope four times the bandwidth worth four times …

    Read more...

  • STM32 stop mode & EXTI wakeup without HAL

    Low-power modes come in handy (apart from obvious power saving) when the electromagnetic emissions of an MCU have to be reduced. For example when an MCU is placed close to antenna switching relays - you definitely do not want to receive the noise from the MCU in your HF transceiver (even …

    Read more...

  • Matching STM32 hardware CRC with standard CRC-32

    Hardware CRC generators come handy in embedded systems when data or code have to be validated. For example: storing settings in flash or EEPROM, receiving new firmware via a bootloader. Software implementations are either slow (when calculating the CRC directly) or need quite some memory for lookup tables. There are …

    Read more...

  • Coax relay PCB for HF antenna switching

    This is a simple board that switches 4 antennas to a single transceiver. It features SO-239 coax connectors, relays with popular footprints and flyback diodes. Unused antennas are grounded. It can be driven by virtually any controller in the shack.

    PCB top view

    How to get one?

    Gerber files are available here. You …

    Read more...

  • Fast integer scaling on Cortex-M0

    Integer scaling is very common in embedded systems. For example to make human-readable values of ADC readings (correcting for gain or voltage dividers). Two operations are needed to do scaling without using floating-point numbers - multiplication and division. Cortex-M0 is a nice little beast with a single cycle integer multiplier. ARM …

    Read more...