Lawrence Langat
Mechatronics Engineer & IoT Developer
Mechatronics engineer with a great passion for I4R and Web3.0 technologies.
About Lawrence Langat
Focus
📚 Education Contributions
Edge Gateway for MCU Sensor Networks
Build a complete edge gateway on the Raspberry Pi Zero 2 W that receives MQTT data from ESP32 and Pico sensor nodes, stores readings in SQLite, serves a live web dashboard, captures USB webcam snapshots, and forwards data to the cloud. The capstone project that ties together all six embedded courses.
Published: March 12, 2026
Yocto Project and Production Images
Build a production-grade Linux image for the Raspberry Pi Zero 2 W using the Yocto Project with a custom BSP layer, application recipe, SDK generation, and OTA update preparation. Covers BitBake, layers, recipes, and reproducible builds
Published: March 12, 2026
System Services and Process Management
Build a systemd-managed sensor daemon with auto-start, hardware watchdog, structured logging, and IPC using Unix sockets on the Raspberry Pi Zero 2 W. Covers unit files, daemon design, shared memory, and PREEMPT_RT real-time scheduling
Published: March 7, 2026
Buildroot: Custom Linux from Scratch
Use Buildroot to create a minimal Linux image for the Raspberry Pi Zero 2 W that boots directly into your sensor application. Covers configuration, package selection, root filesystem overlays, and custom package recipes
Published: February 28, 2026
Linux Kernel Module Development
Write a custom Linux kernel module that registers a character device (/dev/mydevice) to control LED patterns on the Raspberry Pi Zero 2 W. Covers module skeleton, Makefile, sysfs attributes, procfs entries, and file operations
Published: February 21, 2026
Userspace I/O: GPIO, I2C, SPI
Build a GPIO doorbell monitor with I2C sensor logging using libgpiod and i2c-dev on the Raspberry Pi Zero 2 W. Covers character devices, ioctl, userspace driver patterns, and event-driven GPIO handling
Published: February 14, 2026
Device Trees and Hardware Description
Learn device tree syntax, write a custom overlay to enable a BME280 sensor over I2C, and compile it into a kernel-recognized device on the Raspberry Pi Zero 2 W. Covers DTS structure, property bindings, pinctrl, and overlay mechanics
Published: February 7, 2026
Kernel Configuration and Custom Build
Navigate the Linux kernel source tree, use menuconfig to strip unnecessary subsystems, and build a custom kernel that boots the Raspberry Pi Zero 2 W in under 4 seconds. Covers module vs built-in decisions, kernel image formats, and deployment to microSD
Published: January 31, 2026
Cross-Compilation and the Linux Boot Process
Set up a cross-compilation toolchain and trace the full Linux boot sequence on a Raspberry Pi Zero 2 W. Build a custom 'hello from custom Linux' binary that runs on first boot, covering bootloader, kernel, initramfs, and root filesystem stages
Published: January 24, 2026
Power Management, Watchdog, and Sleep Modes
Master ATmega328P low-power techniques including all six sleep modes, watchdog timer configuration, and BOD disable. Build a battery-powered door open alert that sleeps in power-down mode and wakes on a magnetic reed switch.
Published: March 12, 2026
ADC and Analog Signal Acquisition
Master the ATmega328P 10-bit ADC with register-level configuration. Build a light-tracking indicator using photoresistors that displays a real-time bar graph on an OLED, covering reference voltages, free-running mode, and noise reduction.
Published: March 5, 2026
I2C Bus and Sensor Integration
Implement the I2C (TWI) protocol on ATmega328P from register level. Build a mini weather station that reads temperature, humidity, and pressure from a BME280 sensor and displays the data on an OLED screen.
Published: February 26, 2026
SPI Protocol and Peripheral Interfacing
Master the ATmega328P SPI peripheral by writing an SSD1306 OLED driver from scratch. Display a real-time clock on a 128x64 OLED, covering clock polarity, phase, data framing, and display buffer management.
Published: February 19, 2026
UART Serial Communication
Implement UART from scratch on the ATmega328P using USART registers. Build a temperature logger that reads an NTC thermistor, formats CSV data, and streams it to a PC for plotting.
Published: February 12, 2026
Interrupts and Event-Driven Design
Learn ATmega328P external interrupts (INT0/INT1), pin-change interrupts, and timer interrupts. Build a reaction time tester that measures your response in milliseconds using ISR-driven timing.
Published: February 5, 2026
Timer/Counter Fundamentals
Explore ATmega328P Timer0, Timer1, and Timer2 in Normal, CTC, and PWM modes. Build a tunable tone generator that produces precise audio frequencies using timer compare match interrupts and a piezo buzzer.
Published: January 29, 2026
GPIO Registers and Digital I/O
Master ATmega328P GPIO registers (DDRx, PORTx, PINx) through direct bit manipulation. Build an electronic dice that displays a random pattern on LEDs when you press a button, with proper hardware debouncing.
Published: January 22, 2026
AVR Toolchain and Bare-Metal C Setup
Set up a complete AVR development environment with avr-gcc, avrdude, and Makefiles. Program an Arduino Nano directly in C without the Arduino IDE. Build a Morse code beacon that blinks your name on an LED.
Published: January 15, 2026
Capstone: Connected Sensor Network
Combine everything from the course into a two-node IoT system: an outdoor sensor with battery power, deep sleep, and MQTT publishing, plus an indoor display with an OLED screen, always-on MQTT subscription, and a live dashboard.
Published: March 12, 2026
Power Management and Deep Sleep
Master ESP32 deep sleep modes, ULP coprocessor programming, RTC memory persistence, wake sources, and power budgeting. Build a solar-ready weather node optimized for months of battery life.
Published: March 7, 2026
OTA Updates and Secure Boot
Configure OTA partition schemes, implement firmware rollback, enable flash encryption and secure boot v2, and sign firmware images. Build a remotely updateable sensor node that receives firmware over Wi-Fi.
Published: February 28, 2026
Bluetooth Low Energy (BLE)
Implement BLE on the ESP32 with GAP advertising, GATT services and characteristics, notifications, and BLE plus Wi-Fi coexistence. Build a BLE environmental beacon that any phone can read.
Published: February 21, 2026
MQTT and Cloud Communication
Implement MQTT on the ESP32 with QoS levels, TLS encryption, persistent sessions, and last will messages. Build a plant soil moisture monitor that sends alerts to your phone via a free MQTT broker.
Published: February 14, 2026
HTTP Server and REST API
Build an HTTP server with RESTful endpoints, JSON parsing, mDNS discovery, and a responsive web UI served from SPIFFS. Create a browser-controlled thermostat with real temperature sensor input and relay output.
Published: February 7, 2026
Wi-Fi and Network Configuration
Master the ESP32 Wi-Fi driver: STA, AP, and STA+AP modes, the event-driven model, SmartConfig provisioning, and scan capabilities. Build a Wi-Fi signal mapper that scans nearby access points and serves results as a webpage.
Published: January 31, 2026
GPIO, Peripherals, and Driver Framework
Explore the ESP32 GPIO matrix, LEDC PWM controller, pulse counter, RMT peripheral, and the ESP-IDF driver model. Build a capacitive touch lamp dimmer using the built-in touch sensor pins.
Published: January 24, 2026
ESP-IDF Toolchain and Dual-Core Architecture
Install ESP-IDF, configure menuconfig, understand partition tables, and explore the Xtensa dual-core FreeRTOS model. Build an RGB mood lamp where one core runs color animations and the other handles serial commands.
Published: January 17, 2026
Wireless Networking with Pico W
Use the CYW43 wireless driver for Wi-Fi and BLE connectivity. Set up network sockets, run a microdot web server, and build a Wi-Fi controlled NeoPixel display with a phone-friendly web UI.
Published: March 12, 2026
MicroPython on RP2040: Rapid Prototyping
Flash MicroPython firmware, use the REPL, access hardware through the machine module, write PIO programs in Python, and build C extension modules for performance-critical code. Rebuild a previous project and compare C versus Python.
Published: March 7, 2026
USB Device Classes
Use TinyUSB to implement HID, CDC, and MSC USB device classes on the RP2040. Build a custom USB gamepad with a joystick and buttons that appears as a standard HID controller on any PC.
Published: February 28, 2026
DMA and High-Speed Data Pipelines
Configure DMA channels with chaining, pacing timers, and ring buffer modes. Build an audio sampler that captures microphone input via ADC and DMA, then stores recordings to external SPI flash.
Published: February 21, 2026
Multicore Programming: Dual Core
Launch code on Core 1, communicate through hardware FIFOs, use spinlocks and shared memory safely. Build a dual-core tone synthesizer where one core generates waveforms and the other handles button input.
Published: February 14, 2026
PIO: Programmable I/O State Machines
Learn PIO assembly from scratch: the instruction set, state machine architecture, FIFOs, clock dividers, sideset, and custom protocol implementation. Build a WS2812B LED strip driver written entirely in PIO.
Published: February 7, 2026
GPIO, PWM, and Analog I/O
Explore RP2040 GPIO functions, PWM slice architecture, the 12-bit ADC with on-chip temperature sensor, and hardware interpolators. Build an LED brightness controller with analog knob and serial feedback.
Published: January 31, 2026
Pico SDK and RP2040 Architecture
Install the Pico C SDK, understand CMake build flow, dual Cortex-M0+ cores, bus fabric, and UF2 boot process. Build a USB text injector that types a predefined message when the Pico is plugged into any computer.
Published: January 24, 2026
Low-Power Modes and Production Firmware
Build a battery-powered data logger with RTC wakeup, SPI flash storage, and STM32 Stop/Standby modes. Learn low-power design, flash programming, option bytes, and bootloader basics for production firmware
Published: March 12, 2026
FreeRTOS Fundamentals on STM32
Learn FreeRTOS multitasking on the STM32 Blue Pill with tasks, queues, semaphores, and mutexes. Build a multitasking dashboard with sensor reading, display updates, and serial logging running as separate tasks
Published: March 5, 2026
Debugging with SWD, GDB, and Fault Handlers
Master STM32 debugging with SWD, GDB breakpoints, watchpoints, HardFault decoding, ITM trace, and register inspection. Find and fix five real bugs in pre-written firmware
Published: February 26, 2026
ADC with DMA and Analog Watchdog
Build a voltage and current monitor with threshold alerts using the STM32 ADC with multi-channel DMA scanning, oversampling, and the analog watchdog peripheral
Published: February 19, 2026
SPI and I2C: HAL vs Register Level
Connect an SSD1306 OLED and BME280 sensor to the STM32 Blue Pill. Write the same driver two ways, using HAL and bare registers, to compare code size, speed, and readability
Published: February 12, 2026
UART with DMA and Interrupts
Build an interactive command shell on the STM32 Blue Pill using USART with DMA transfers, NVIC interrupt priorities, circular buffers, and idle line detection. Control PWM, read pins, and dump registers over serial
Published: February 5, 2026
Timers, PWM, and Input Capture
Explore STM32 general-purpose and advanced timers to generate PWM, measure signals with input capture, and use the hardware encoder interface. Build a servo pan mechanism controlled by a rotary encoder
Published: January 29, 2026
GPIO and Clock Tree Configuration
Master the STM32 RCC clock tree, AHB/APB bus architecture, and all four GPIO modes. Build a rotary encoder menu system that outputs to a serial terminal using the Blue Pill board
Published: January 22, 2026
STM32 Toolchain and ARM Cortex-M Architecture
Set up the complete STM32 development toolchain with arm-gcc, OpenOCD, and STM32CubeMX. Explore the ARM Cortex-M3 architecture, vector table, startup code, and linker scripts while building a breathing LED on the Blue Pill board
Published: January 15, 2026
Capstone: Async Sensor Hub
Integrate everything from the course into a complete async sensor hub: BME280 readings, SSD1306 OLED display, microSD card logging, MQTT publishing over Wi-Fi, push buttons, and status LEDs, all running as concurrent Embassy tasks on the Pico W.
Published: March 12, 2026
Wi-Fi and Networking (Pico W)
Connect the Pico W to Wi-Fi using the cyw43 driver and embassy-net. Build a TCP client, perform HTTP requests, and create an MQTT sensor node that publishes BME280 readings with automatic reconnection.
Published: March 11, 2026
USB Device with embassy-usb
Build USB CDC and HID devices on the RP2040 using embassy-usb. Create a virtual serial port that reports sensor data and a USB keyboard that sends keystrokes from button presses, then combine them into a composite device.
Published: March 10, 2026
UART, DMA, and Ownership
Configure async UART with DMA on the RP2040, parse GPS NMEA sentences from a NEO-6M module, and see how Rust ownership prevents the buffer aliasing bugs that haunt C DMA code.
Published: March 9, 2026
I2C and SPI with embedded-hal
Use the embedded-hal trait system to write portable sensor and display drivers. Build a weather station on the RP2040 with a BME280 sensor and SSD1306 OLED, using async Embassy drivers that work across any MCU.
Published: March 8, 2026
Embassy Async Fundamentals
Learn Embassy, the async runtime for embedded Rust. Build a multi-task system with concurrent LED control, button handling, and serial reporting on the RP2040 Pico, all without an RTOS heap or per-task stacks.
Published: March 7, 2026
Timers, PWM, and Interrupts
Configure RP2040 timers and PWM slices to drive a servo motor. Handle interrupts safely in Rust using the critical-section crate and static Mutex pattern. Read analog inputs with the ADC and generate buzzer tones with timer-based frequency control.
Published: March 6, 2026
Ownership, Borrowing, and Hardware
Learn how Rust's ownership model maps to embedded hardware. Typestate GPIO prevents misconfigured pins at compile time. Button debouncing with owned state, Result-based error handling, and safe shared resources with Mutex and critical sections on the RP2040.
Published: March 5, 2026
Rust Toolchain and First Blink
Install the complete embedded Rust toolchain with rustup, probe-rs, and flip-link. Create an RP2040 project from scratch, configure Cargo.toml, memory.x, and the linker. Build and flash a blinking LED with defmt RTT logging on the Raspberry Pi Pico.
Published: March 4, 2026
Zephyr RTOS Introduction
Port the traffic light controller from Lesson 2 to Zephyr RTOS. Learn the Zephyr build system (west), devicetree hardware abstraction, Kconfig configuration, threading model, and cross-RTOS portability patterns.
Published: March 12, 2026
Debugging and Profiling RTOS Applications
Diagnose real RTOS bugs using Tracealyzer and SEGGER SystemView. Work through provided buggy firmware containing deadlock, priority inversion, and stack overflow, then fix each issue using profiling tools and runtime diagnostics.
Published: March 7, 2026
Software Timers and Interrupt Management
Build a debounced multi-button input system with deferred interrupt processing. Learn FreeRTOS software timers, ISR-safe API calls, critical sections, interrupt nesting, and the timer service task architecture.
Published: February 28, 2026
Memory Management and Safety
Build a memory-safe command processor using static allocation, stack watermarking, and MPU fault demonstration. Learn FreeRTOS heap schemes (heap_1 through heap_5), memory pools, stack overflow detection, and memory protection unit configuration.
Published: February 21, 2026
Semaphores, Mutexes, and Synchronization
Build a multi-sensor I2C coordinator where three sensor tasks share one I2C bus using mutex-protected access. Learn binary and counting semaphores, priority inheritance, deadlock avoidance, and priority inversion with practical demonstrations.
Published: February 14, 2026
Queues and Inter-Task Communication
Build a sensor data pipeline using FreeRTOS queues: a producer task reads ADC values, a filter task smooths the data, and a consumer task displays results on an OLED. Learn message queues, stream buffers, event groups, and producer-consumer patterns.
Published: February 7, 2026
Tasks, Scheduling, and Context Switching
Build a priority-based traffic light controller with three FreeRTOS tasks: light sequencing, pedestrian button handling, and emergency override. Learn task states, preemptive scheduling, time slicing, and context switch overhead.
Published: January 31, 2026
Real-Time Systems Concepts
Understand hard, soft, and firm real-time systems by measuring jitter on bare-metal loops versus FreeRTOS tasks. Learn determinism, worst-case execution time (WCET), and rate-monotonic scheduling theory with hands-on timing measurements.
Published: January 24, 2026
Alerts, Automation, and Rule Engines
Configure threshold alerts that notify via email, SMS, Discord, Slack, and Telegram. Build automation flows with Node-RED that trigger actions based on sensor data. Compare self-hosted rule engines with the SiliconWit.io alert system.
Published: March 10, 2026
Device Security, TLS, and Provisioning
Generate and deploy X.509 certificates for mutual TLS authentication. Implement device identity and provisioning workflows. Secure firmware updates with signed images. Audit your IoT deployment against common attack vectors.
Published: March 10, 2026
IoT Architecture and Protocol Comparison
Survey IoT system architectures and compare MQTT, CoAP, and HTTP side by side. Send the same BME280 sensor data over all three protocols from an ESP32 and measure bandwidth, latency, and power consumption to make informed protocol choices.
Published: March 10, 2026
MQTT Broker Setup and Secure Connections
Install and configure a Mosquitto MQTT broker with TLS encryption, password authentication, and topic ACLs. Connect to both a self-hosted broker and the SiliconWit.io platform. Understand retained messages, last will, QoS levels, and persistence.
Published: March 10, 2026
MQTT Clients on ESP32, Pico, and STM32
Write MQTT client firmware for three MCU platforms: ESP32 with ESP-IDF, RPi Pico W with MicroPython, and STM32 with an ESP-01 Wi-Fi module. Design a consistent topic hierarchy, publish structured JSON payloads, handle reconnection with exponential backoff, and buffer messages when offline.
Published: March 10, 2026
Capstone: Production IoT Monitoring System
Combine everything from the IoT Systems course into a production deployment: multiple sensor nodes, TLS-secured MQTT broker, time-series database, Grafana dashboards, automated alerts, a REST API, and cloud forwarding to SiliconWit.io.
Published: March 10, 2026
Real-Time Dashboards and Data Visualization
Store MQTT sensor data in InfluxDB via Telegraf, build Grafana dashboards with live charts and gauges, explore the SiliconWit.io dashboard as a managed alternative, query historical data with Flux, and create lightweight Chart.js dashboards for embedded gateways.
Published: March 10, 2026
REST APIs, Webhooks, and Device Integration
Design RESTful APIs for IoT device management and data retrieval. Build webhook endpoints that receive push notifications, validate HMAC signatures, and integrate REST with MQTT for a complete IoT data pipeline.
Published: March 10, 2026
Capstone: Multi-Sensor Data Logger
Build a complete environmental monitoring station combining BME280, OLED display, SD card logging, Bluetooth streaming, alarm outputs, and a state machine UI on the STM32 Blue Pill
Published: March 10, 2026
DMA, Interrupts, and CAN Bus
Use DMA for zero-copy ADC streaming and SPI transfers, configure interrupt priorities, and build a two-node CAN bus sensor network using the STM32F103 built-in bxCAN peripheral with MCP2551 transceivers
Published: March 9, 2026
Stepper Motors and Encoder Feedback
Drive a NEMA 17 stepper motor with the A4988 driver using timer-generated step pulses and trapezoidal acceleration profiles on the STM32 Blue Pill. Read a rotary encoder in hardware encoder mode, implement homing with limit switches, and build a precision linear positioning stage.
Published: March 8, 2026
RFID, NFC, and Identification Systems
Interface the RC522 RFID reader over SPI, read and write MIFARE Classic 1K cards, build an access control state machine with OLED display and audio/visual feedback on the STM32 Blue Pill. Store authorized card UIDs in flash memory and manage cards with a master card.
Published: March 7, 2026
UART Devices: GPS, Bluetooth, and RS-485
Parse GPS coordinates from NMEA sentences, relay position data over Bluetooth to a phone, and communicate over long distances with RS-485. Use DMA with idle line detection for robust UART reception on the STM32 Blue Pill
Published: March 6, 2026
SPI Protocol: Storage and Displays
Interface an ST7735 color TFT display and microSD card on the same SPI bus. Build a portable data logger that displays real-time charts and writes CSV data to an SD card using FatFS on the STM32 Blue Pill
Published: March 5, 2026
I2C Protocol: Sensors and Displays
Master I2C communication on the STM32 Blue Pill. Read temperature, humidity, and pressure from a BME280, drive an SSD1306 OLED display, store data in AT24C256 EEPROM, and build a weather station with logging and history recall.
Published: March 4, 2026
PWM, Timers, and Motor Control
Generate PWM signals with STM32 hardware timers for servo positioning, DC motor speed control via L298N H-bridge, and audio tone generation. Use input capture to measure external signal frequency and build a potentiometer-controlled pan-tilt mount.
Published: March 3, 2026
ADC and Analog Signal Conditioning
Configure the STM32 12-bit ADC with single, continuous, and scan modes. Add signal conditioning circuits and build a multi-channel environmental monitor with LED bar graph
Published: March 2, 2026
GPIO and Digital Interfacing
Set up STM32CubeIDE, configure GPIO inputs and outputs with the HAL, and build an ultrasonic proximity alarm with relay trigger on the Blue Pill
Published: March 1, 2026
Edge-Cloud Hybrid Architectures
Cover tiered inference, cloud-assisted retraining, OTA model updates, and federated learning concepts. Build a complete system where an ESP32 runs local anomaly detection, escalates uncertain cases to a cloud server for a more powerful model, receives retrained models via OTA, and reports status to an MQTT dashboard.
Published: March 9, 2026
Camera Image Classification on ESP32
Deploy a MobileNet-based image classifier on an ESP32-CAM module with OV2640 camera and PSRAM. Capture images, preprocess them on device, run TFLite Micro inference, and classify objects or detect people in real time within the ESP32's tight memory budget.
Published: March 8, 2026
Anomaly Detection for Predictive Maintenance
Train an autoencoder on normal vibration data from an MPU6050 mounted on a motor, deploy it on an ESP32, and detect mechanical anomalies in real time. Compare edge inference with cloud-based anomaly scoring for latency, bandwidth, and reliability.
Published: March 7, 2026
Accelerometer Gesture Recognition
Collect labeled gesture data from an MPU6050 accelerometer, train a TensorFlow classifier, and deploy it on both RPi Pico and STM32 using TensorFlow Lite Micro. Compare inference performance across platforms with LED feedback and MQTT publishing.
Published: March 6, 2026
Keyword Spotting and Voice Wake Word
Build a Hey Device wake word detector using an ESP32 and INMP441 I2S MEMS microphone. Capture audio with the I2S driver, extract MFCC features on device, train a keyword model on the Speech Commands dataset, and run real-time inference to trigger actions on detection.
Published: March 5, 2026
Model Quantization and Optimization for MCUs
Apply post-training quantization and quantization-aware training to a CNN model. Compare float32 vs int8 accuracy, inference speed, flash size, and RAM usage on ESP32. Learn model pruning basics and best practices for deploying optimized models on microcontrollers.
Published: March 4, 2026
TensorFlow Lite Micro Model Deployment
Deep dive into the TFLite Micro runtime architecture. Train a gesture classifier in TensorFlow, convert it to TFLite Micro, and deploy it on both ESP32 and STM32. Compare inference time, RAM usage, and porting considerations across platforms.
Published: March 3, 2026
Edge Impulse Data Collection and Training
Collect accelerometer data from an MPU6050 on ESP32, upload it to Edge Impulse, train a motion classifier for idle, walking, and running activities, and deploy the quantized model back to the ESP32 for real-time inference.
Published: March 2, 2026
TinyML and Machine Learning on Microcontrollers
Understand the TinyML landscape, hardware constraints, and the full ML pipeline from TensorFlow training to on-device inference. Deploy a sine wave regression model on an ESP32 using TensorFlow Lite for Microcontrollers.
Published: March 1, 2026
🛠️ Product Development
Activity Monitor Firmware
Getting started with the HLK-LD2420-based activity monitoring firmware for ESP32-S3
Published: December 12, 2024