Wireless Water Pipeline Sensor
PCB & Firmware Design Project
Wireless Water Pipeline Sensor
PCB & Firmware Design Project
Introduction
My BlackPearl Technology internship tasked me with a project that involved designing and building a custom embedded hardware platform for a low-power sensing application, taking the system from schematic capture and PCB layout through bring-up and validation. I then developed C/C++ firmware to interface with the board’s peripherals, acquire sensor data, and communicate results reliably to the rest of the system.
My goal was to create a robust, field-ready sensing node that could collect measurements, process them on-device, and transmit data efficiently over a long-range wireless link. My design centered on a custom PCB designed on Altium Designer with a microcontroller, power regulation, and a LoRa radio, along with the required sensor and connector interfaces for real-world deployment. I validated the hardware using lab equipment, debugged issues during bring-up, and iterated on both the board and firmware to improve reliability, power performance, and overall system stability.
PCB Schematic
I captured the BlackPearl PCB schematic by organizing the design into clear functional sections and then connecting them with consistent net names for power, ground, SPI, debug, and sensor signals. I started with the STM32G030K6T6 microcontroller as the central hub, added the required power pins and local decoupling capacitors, and brought out an SWD programming header with SWDIO, SWCLK, NRST, 3.3 V, and GND so the board could be reliably programmed and debugged during bring up. Next, I integrated the LoRa module as an SPI peripheral by mapping MOSI, MISO, SCK, chip select, and the key control lines like reset, busy, and DIO signals, and I included the antenna connection and supporting RF components to ensure stable communication. I then captured the power path as its own section, starting from the solar input into the battery charger and finishing with a 3.3 V regulator and the correct bulk and bypass capacitance for clean supply rails. Finally, I added the sensing and I/O interfaces, including transistor driven flow meter headers, a strain gauge pressure sensor integrated through a Wheatstone-bridge circuit, and a thermistor divider for temperature.
PCB Layout
I built the layout by first locking in the 4 layer stackup so the top (red) and bottom (blue) layers could be used mainly for signal routing while the two internal layers acted as solid 3.3 V and GND planes for low impedance power delivery and clean return paths. I placed the STM32 MCU at the center of the board to minimize trace lengths to every subsystem, then clustered the highest speed or most sensitive interfaces around it, especially the LoRa module near the top with a short, direct connection to the antenna network and plenty of nearby ground reference. After placement, I routed critical nets first, which meant the SPI lines between the MCU and LoRa module and the control lines like reset, busy, and DIO, keeping them short and parallel where possible and dropping vias only when needed to swap layers. I then routed power and low speed control signals, using the internal 3.3 V plane to feed each block and tying every decoupling capacitor to the nearest power and ground with short connections so the MCU, RF module, and analog front end all had stable supply rails. For the sensor and transistor driver sections on the right side, I kept those traces grouped and direct to their connectors, and I avoided unnecessary routing through the RF area to reduce coupling. Finally, I poured copper on the outer layers, stitched ground where helpful, and checked clearances and DRC to ensure the design was clean and manufacturable.
PCB Firmware
After the boards arrived, I hand soldered and assembled the PCB, then brought it up systematically by verifying power first and testing each subsystem in isolation before running the full system. I checked the battery charger and 3.3 V regulation for correct voltage and stable current draw, then validated the sensor interfaces and driver circuitry with a DMM and oscilloscope to confirm expected signal levels and clean digital timing on the SPI bus.
Once the hardware passed initial checks, I programmed the firmware through the SWD header and developed the application in STM32CubeIDE. I configured the MCU clock tree, GPIO, ADC channels, and SPI peripheral at the register and HAL level, then integrated a LoRa driver to handle radio initialization, packet formatting, and transmit routines over SPI to the LoRa module. On the sensing side, I set up periodic sampling to read the thermistor through an ADC voltage divider, measure the pressure signal coming from the instrumentation amplifier output, and capture flow meter activity through the digital input and driver circuitry, then converted those raw readings into usable engineering values before packaging them into a single payload. From there, the firmware schedules sensor reads, assembles the data frame, and transmits it reliably over LoRa, with debug hooks used during bring up to confirm correct timing, clean SPI transactions, and consistent end to end sensor reporting. I cannot actually share the code because it is client IP.