Gonzalo Ferrero Martín

TU/e 5EWC0 · first year · 2025 – 26

Rock Your Baby

A baby-monitoring cradle split across four boards that talk over UART.

Four subsystems, each on its own PYNQ-Z2: heartbeat and crying feed decision-making over UART, and decision-making commands the actuator over UART; the actuator drives two PWM channels, one for frequency and one for amplitude.heartbeatADC → filter → BPMwaveform on 240×240 TFTPYNQ-Z2cryingADC → RMS − noise floorthree pthreadsPYNQ-Z2decision-makingfuse → frequency 1–5,amplitude 1–5 → UARTPYNQ-Z2actuatorPWM 1 → frequencyPWM 2 → amplitudePYNQ-Z2UARTUARTUART
Fig. 1 — Four PYNQ-Z2 boards, one subsystem each, talking over UART; the actuator drives two PWM channels, one for frequency and one for amplitude.
Role
Team project · 5EWC0 · first year
Stack
C · libpynq
Board
PYNQ-Z2 ×4
Status
complete — first-year project · 2025 – 26

Four boards, three links

A first-year TU/e project: a baby-monitoring cradle built as four subsystems, each on its own PYNQ-Z2, each in C on libpynq, talking over UART (Fig. 1). The decision-making board polls the heartbeat and crying boards for their latest values, then sends a single command byte to the actuator.

Splitting it that way meant each board could be developed and tested on its own, with a byte protocol between them. The lesson that stuck was about interfaces: agree the bytes first, then build.

Heartbeat and crying

The heartbeat board samples an analog heart-rate signal through the ADC, filters it with an adaptive exponential filter — heavy smoothing on slow changes, almost none on fast edges — and detects beats on the rising edge. Each beat interval is converted to BPM; anything above 240 is rejected as impossible, and the result is averaged over the last five beats and rounded to the nearest 5 before it is sent. The 240×240 TFT shows the number and, below it, the live waveform: 240 samples per sweep, about 1.5 s each, redrawn after every sweep.

The crying board listens to a microphone through the ADC and reports loudness as RMS over a 4,000-sample window with the noise floor subtracted. Raw RMS is mostly room noise, so the board calibrates on an initial stretch of silence and subtracts the floor in the energy domain; the floor keeps adapting, but only while the room is quiet, so a crying baby cannot teach the board that crying is normal. Capture and calculation, sending, and display run as three separate pthreads so the sample period stays steady while the screen draws, and the volume level goes out over UART.

Decision and actuator

The decision-making board fuses both inputs into a single stress number and picks a rocking frequency and amplitude from 1 to 5: a 5×5 grid of settings, walked one step at a time, alternating between changing frequency and changing amplitude, keeping a move only if the stress number went down. The current cell, the candidate and the rejected ones are painted on its TFT so you can watch it think, and each chosen setting is forwarded over UART.

The actuator decodes one command byte and drives two PWM channels: one for the frequency of the rocking motion, one for its amplitude. The PWM period is 100,000 ticks, and each of the five settings maps to a duty cycle of 10, 20, 40, 60 or 80 % of it. It shows its current state on its own display, so the team could confirm what the cradle thought it was doing without reading the UART.

Status

Complete: a first-year project, 2025 – 26. Nothing on this page is a measured result; the filter, the RMS window and the duty cycles above are what the code does, so there is no verification section.