This project centered on an electronic scale integrated with hospital information systems through wired and wireless links, reducing manual transcription and human error. I worked on MCU resource planning, power management, weighing-signal quality, and clock stability.
MCU pin-out redesign
The prototype was complete when I joined, but customer feedback kept adding sensors and modules. COVID-era supply risk and medical-certification schedules ruled out an MCU change, so I replanned the STM32L4S9ZI PinMux while working with hardware engineers to balance pin count, power architecture, signal integrity, and EMC.
| Interface | Initial | Final | Change |
|---|---|---|---|
| UART | 2 | 4 | Added Wi-Fi and external optical-sensor interfaces |
| I2C | 2 | 2 | Kept two buses while adding gyro, RGB LED, touch sensor, batteries, EEPROM, and other devices |
| SPI | 2 | 3 | Added Ethernet and migrated NFC from PN7100 to ST25R3916 |
| GPIO | 10 | 22 | Added power control for Load Cell, Ethernet, Wi-Fi, optical sensor, and other subsystems |
Three-source power architecture
Together with the hardware team, I replanned battery selection, the power tree, and MCU control strategy around a Main Battery, onboard Sub Battery, and 110/240V AC. AC powers the complete system and charges both batteries. The sub battery maintains service when the main battery is depleted or hot-swapped, while the hospital system is notified. The MCU also gates Ethernet, Wi-Fi, optical-sensor, and gyro power domains to reduce consumption.
Reaching ±0.5% weighing accuracy
I established a validation method for Load Cell linearity, repeatability, and temperature compensation, covering zero-load drift, consistency across loads, and stability under the same load at different temperatures. The results guided several changes:
- Added an independent 5V Load Cell supply to reduce power noise.
- Upgraded the ADC from HX711 to ADS1232 and improved front-end and RC filtering.
- Replaced the connector with a friction-lock JST to reduce contact-impedance variation.
- Added filtering, calibration, and temperature compensation to MCU processing.
The system reached ±0.5% accuracy and passed medical-device certification testing.
Reducing RTC drift from 3,500 ppm to 34 ppm
The system clock drifted by roughly five minutes per day, and intermittent hospital networking made NTP correction unreliable. We traced the root cause to MCU clock accuracy, selected a high-precision external 32.768 kHz ±10 ppm crystal, improved component handling, and revised PCB layout. Measured drift fell from roughly 3,500 ppm to 34 ppm.
Conventional validation took more than 24 hours, so I routed the MCU clock to GPIO, counted pulses with an Arduino Uno, and compared them with a DS3231 high-accuracy RTC. This accelerated late-stage tuning substantially.