Skip to the content
6 layers131.5 × 132.4 mmBedCooler, the printed circuit board in 3D

A dual-zone heating and cooling controller for a bed: a 6-layer KiCad board with an STM32G474 real-time controller and a Raspberry Pi Compute Module 5 host.

Size
131.5 × 132.4 mm
Copper layers
6
Thickness
1.6 mm
Parts
258
Nets
312
Pads
1,103
Tracks, vias
1,751, 966
Pours
53
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
9 Aug 2025
Updated
16 Oct 2026

Overview

BedCooler is an open-source printed circuit board by NicholasKorth, from the NicholasKorth/BedCooler repository on GitHub. It is a 6-layer board of 131.5 × 132.4 mm with 258 parts on 312 nets, routed with 1,751 tracks and 966 vias.

It is built around the STM32G474RET6, DRV8701ERGER and TPS54331DR-JSM, with the GL823K-HCY04, 2920L500/30GR and RT9742SNGV among its other parts. Its parts include 105 capacitors, 68 resistors, 22 connectors, 14 transistors and 12 ICs. It belongs with the STM32 and Raspberry Pi (Linux) boards of this library.

Main components

12

README

README.md

BedCooler

A dual-zone heating and cooling controller for a bed: a 6-layer KiCad board with an STM32G474 real-time controller and a Raspberry Pi Compute Module 5 host.

BedCooler controller board, 3D render from the KiCad board file

3D render from the board file. The Compute Module 5 itself has no 3D model; its two connectors sit along the right edge.

What it does

BedCooler regulates body temperature during sleep. Each side of the bed has its own pair of Peltier (thermoelectric) modules that can heat or cool, so two people can each choose their own temperature. Pumps, valves and fans move the heat; thermistors, a reservoir float switch and a water sensor report back. A touchscreen sets targets and schedules, and the microcontroller keeps each side on target.

I built it and use it every night. It pairs with my Slim Sleep Tracker wearable.

System block diagram

Block diagram as SVG. The full presentation package (overview, block diagram, firmware architecture, board renders and schematic pages) is in docs/bedcooler_package.pdf.

Key specifications

Values come from the design files (schematic, board and firmware), not from measurements.

ProcessorsSTM32G474RET6 real-time controller (Cortex-M4, 144 MHz); Raspberry Pi Compute Module 5 host
Peltier drive2 DRV8701 gate drivers, 8 BSC010N04LS 40 V MOSFETs (one full bridge per side), 5 mΩ current shunts; two pairs of TEC-12712 modules
Loads2 pumps and 2 valves on AO3400A low-side switches; 3 fans, 25 kHz PWM with tach
Sensing4 NTC thermistors (10 k, B 3950), float switch, water sensor, bridge current
Power12 V input, about 350 W; +5V, +3.3V and a second +3.3V rail from three buck converters
InterfacesTouchscreen (MIPI DSI), HDMI, USB 3 type-A, two USB-C (USB 2), microSD, stereo class-D amplifier
Board131.5 x 132.4 mm, 6 copper layers, 1.6 mm; 258 parts, all on the top side
FirmwareBare-metal C on the STM32 HAL; plain-text commands over UART

Repository layout

text
hardware/    KiCad 9 project (schematic, routed board), footprint and symbol libraries,
             3D models (packages3d/), production files (Gerbers, IPC netlist, BOM and placement)
firmware/    bedcoolerstm2: STM32CubeIDE project for the STM32G474
docs/        presentation package PDF, diagrams and renders, an older schematic print

Hardware

Open hardware/BedCooler.kicad_pro in KiCad 9. Schematic sheets:

FileContents
BedCooler.kicad_schRoot: STM32G474, Compute Module 5, display, HDMI, debug header, backup cell
powerreg.kicad_sch12 V input FETs and the three buck converters
untitled.kicad_schThe two DRV8701 H-bridges (sheet "H bridge")
Fan_control.kicad_schFan, pump and solenoid valve drivers
Sensors.kicad_schThermistor, float switch and water sensor inputs
CM5 Ports.kicad_schUSB 3, USB-C, microSD card reader and USB power switches
Audio.kicad_schTAS5805M class-D amplifier

The board was laid out for the JLCPCB 6-layer stackup JLC06162H-3313, with impedance-controlled traces for the high-speed pairs. The Gerbers are in hardware/production/test_bedcooler.zip, and the fabrication-toolkit archive in hardware/production/backups/ also holds the BOM and placement files. The Gerbers are dated 2025-08-13, before the last board edits, so regenerate them from the board file before ordering.

More views: one-page overview, top render, signal map, functional layout.

The 3D model for the Compute Module 5 is not included; the board references packages3d/471511051.stp, which can be added from the Raspberry Pi CM5 IO board KiCad files.

Firmware

firmware/bedcoolerstm2 is an STM32CubeIDE project (HAL, CubeMX .ioc included).

  • The STM32 talks to the Compute Module 5 over USART1 at 115200 baud, 8-N-1, newline-terminated text commands.
  • Every 1 s it runs the control loop for each zone. In AUTO mode a zone switches fully to heat or cool with 0.5 °C hysteresis around the target on its thermistor. Manual heat or cool is time-proportional over a 10 s period.
  • A safety cutoff turns a zone off above 38.0 °C (safety on|off).
  • A fault from an H-bridge driver turns that zone off and sends an alert.
  • Fan speed is set by 25 kHz PWM; RPM is read from the tach signal.

Firmware architecture

CommandExampleEffect
pingpingReplies pong
settempsettemp 1 21.5Target temperature for zone 1 or 2 in °C; enables AUTO mode
peltierpeltier 1 cool 5Manual heat, cool or off; optional duty 1-10 (seconds on per 10 s)
pumppump 2 onPump 1 or 2 on or off
solenoidsolenoid 1 onValve 1 or 2 on or off
fanfan 3 75Fan 1-3 speed in percent
getrpmgetrpm 2Fan RPM
thermtherm 4Raw ADC value and temperature for thermistor 1-4
currentcurrent 1Raw current-sense reading for zone 1 or 2
snsoutsnsout 2Whether current chopping is active for a zone
sensorssensorsFloat switch and water sensor state
safetysafety offEnables or disables the 38 °C cutoff

Build and flash

  1. Install STM32CubeIDE.
  2. File > Import > General > Existing Projects into Workspace, and select firmware/bedcoolerstm2.
  3. Project > Build All. The Debug build uses about 82 KB of flash.
  4. Connect an ST-Link to the SWD header J16 (SWDIO, SWCLK, NRST) and choose Run As > STM32 C/C++ Application.

Open items to verify

  • Zone 1 enable: the firmware drives PA5, but the netlist connects the zone 1 driver's EN pin (U4) to PA9.
  • Input FETs Q18 and Q19: the source is on the input pad and the drain on +12V; check the behaviour with a reversed supply.
  • Fault and fan-tach interrupts: the callbacks exist, but the interrupts are not enabled in this source.
  • USB DFU enumerates, but its flash erase and write functions are stubs; use SWD to program.
  • In the board file the two Peltier- posts carry nets that reach no other copper; check how the posts are wired on the built board.
  • Outer copper weight: the board file stackup says 1 oz; the earlier README listed 2 oz.

Safety

This runs at 12 V and about 350 W, with water circulating near the electronics. Fuse the supply, keep the board away from the water loop, and test the leak and float sensors before leaving it running unattended.

License

CC BY-NC-SA 4.0: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International. You may share and adapt this work for non-commercial purposes with attribution, under the same license. The ST HAL drivers and USB middleware in firmware/ keep their own ST licenses.

Parts

258
QtyValueFootprintReferences
30.1uFCapacitor_SMD:C_0603_1608MetricC2, C3, C10, C12, C13, C14, C17, C19, C25, C28, C30, C31, C33, C43, C101, C102 +14
141uFCapacitor_SMD:C_0603_1608MetricC4, C5, C6, C7, C8, C9, C26, C56, C60, C68, C69, C99, C100, C105
10Conn_01x02_PinConnector_JST:JST_XH_B2B-XH-A_1x02_P2.50mm_VerticalJ5, J6, J7, J8, J11, J12, J13, J14, J15, J23
92200pFCapacitor_SMD:C_0603_1608MetricC34, C74, C75, C76, C77, C78, C79, C80, C82
810KOhmResistor_SMD:R_0603_1608MetricR11, R12, R22, R23, R26, R27, R28, R29
8BSC010N04LSeasyeda2kicad:PG-TDSON-8-FL_L5.0-W6.0-P1.27-LS6.2-BLQ1, Q2, Q3, Q4, Q5, Q6, Q7, Q8
710kOhmResistor_SMD:R_0603_1608MetricR1, R8, R13, R30, R48, R60, R61
74.7kResistor_SMD:R_0603_1608MetricR50, R66, R67, R68, R69, R70, R71
74.7uFCapacitor_SMD:C_0603_1608MetricC35, C36, C40, C41, C67, C81, C84
6.01uFCapacitor_SMD:C_0603_1608MetricC29, C32, C42, C44, C85, C86
647uFCapacitor_SMD:C_1210_3225MetricC37, C38, C39, C45, C90, C91
4.22uFCapacitor_SMD:C_0603_1608MetricC70, C71, C72, C73
4100 OhmsResistor_SMD:R_0603_1608MetricR15, R16, R18, R20
4100 uFCapacitor_SMD:CP_Elec_5x5.4C15, C16, C18, C20
410KohmResistor_SMD:R_0603_1608MetricR14, R17, R19, R21
422uFCapacitor_SMD:C_1210_3225MetricC61, C62, C63, C65
45.1kResistor_SMD:R_0603_1608MetricR42, R43, R46, R47
467 ohmResistor_SMD:R_0603_1608MetricR51, R52, R53, R54
4AO3400APackage_TO_SOT_SMD:SOT-23Q12, Q13, Q14, Q15
4CCapacitor_SMD:C_0603_1608MetricC21, C22, C23, C24
4NFZ2MSM301SN10Leasyeda2kicad:L0806L1, L4, L5, L6
4SS14Diode_SMD:D_SMAD1, D2, D3, D4
310.2kResistor_SMD:R_0603_1608MetricR33, R40, R57
310kResistor_SMD:R_0603_1608MetricR49, R59, R65
3AP22811AW5-7easyeda2kicad:SOT-25-5_L3.0-W1.6-P0.95-LS2.8-BLU9, U10, U11
3Conn_01x04_PinConnector_Molex:Molex_KK-254_AE-6410-04A_1x04_P2.54mm_VerticalJ2, J3, J4
3TestPointTestPoint:TestPoint_THTPad_D4.0mm_Drill2.0mmPeltier -, Peltier-, Peltier+
21000UfCapacitor_SMD:CP_Elec_10x10.5C27, C59
21000pFCapacitor_SMD:C_0603_1608MetricC47, C88
2100nCapacitor_SMD:C_0402_1005MetricC103, C104
210UFCapacitor_SMD:C_1210_3225MetricC57, C95
215pFCapacitor_SMD:C_0603_1608MetricC52, C53
21kOhmResistor_SMD:R_0603_1608MetricR3, R7
222Resistor_SMD:R_0603_1608MetricR62, R63
2220uFCapacitor_SMD:CP_Elec_6.3x7.7C1, C11
23.24kResistor_SMD:R_0603_1608MetricR41, R58
230kOhmResistor_SMD:R_0603_1608MetricR4, R6
2332kResistor_SMD:R_0603_1608MetricR36, R55
233kOhmResistor_SMD:R_0603_1608MetricR5, R9
247pFCapacitor_SMD:C_0603_1608MetricC46, C87
25 mOhmResistor_SMD:R_2512_6332MetricR2, R10
268.1kResistor_SMD:R_0603_1608MetricR37, R56
2B340A-13-Feasyeda2kicad:SMA_L4.4-W2.6-LS5.0-RDD5, D10
2Conn_01x02_SocketConnector_JST:JST_XH_B2B-XH-A_1x02_P2.50mm_VerticalJ1, J19
2DRV8701ERGEReasyeda2kicad:VQFN-24_L4.0-W4.0-P0.50-BL-EP2.5U2, U4
2FXL0530-6R8-Measyeda2kicad:IND-SMD_L5.4-W5.2_FXL0530L3, L7
2SMBJ14CA_C151253easyeda2kicad:SMB_L4.6-W3.6-LS5.3-BID7, D9
2SMD1206-150C-16Veasyeda2kicad:F1206F1, F2
2SQJ407EP-T1_GE3easyeda2kicad:POWERPAK-SO-8_L6.2-W5.1-P1.27-BLQ18, Q19
2TPD2EUSB30ADRTReasyeda2kicad:SOT-9X3-3_L1.0-W0.8-P0.35-LS1.0-BRD6, D12
2TPS54331DReasyeda2kicad:SOIC-8_L5.0-W4.0-P1.27-LS6.0-BLU5, U8
2TestPointLibrary:Power_pad_3mm_drill+12v, GND
2USB_C_Receptacle_USB2.0_16PConnector_USB:USB_C_Receptacle_HRO_TYPE-C-31-M-12J17, J21
1.1ufCapacitor_SMD:C_0603_1608MetricC93
11.96kResistor_SMD:R_0603_1608MetricR34
1100uFCapacitor_SMD:C_1210_3225MetricC54
1130kResistor_SMD:R_0603_1608MetricR31
11kResistor_SMD:R_0603_1608MetricR64
11ufCapacitor_SMD:C_0603_1608MetricC97
120kResistor_SMD:R_0603_1608MetricR24
129.4kResistor_SMD:R_0603_1608MetricR39
12920L500/30GReasyeda2kicad:F2920U6
137.4kResistor_SMD:R_0603_1608MetricR35
151.1Resistor_SMD:R_0603_1608MetricR38
1665kResistor_SMD:R_0603_1608MetricR32
1690-019-298-412CM5IO:EDAC 690-019-298-412J22
1CDBC540-HFeasyeda2kicad:SMC_L6.9-W5.9-LS7.9-RDD11
1CR2032-BS-5-1easyeda2kicad:BAT-TH_CR2032-BS-5-1B1
1ComputeModule5-CM5CM5IO:Raspberry-Pi-5-Compute-ModuleModule1
1Conn_01x04_PinConnector_JST:JST_XH_B4B-XH-A_1x04_P2.50mm_VerticalJ18
1Conn_01x05Connector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_Vertical_SMD_Pin1RightJ16
1Conn_01x22_FemaleCM5IO:Hirose_FH12-22S-0.5SH_1x22-1MP_P0.50mm_HorizontalJ20
1FXL0630-4R7-Measyeda2kicad:IND-SMD_L7.0-W6.6L2
1GL823K-HCY04easyeda2kicad:SSOP-16_L4.9-W3.9-P0.64-LS6.0-BLU12
1LEDLED_SMD:LED_0603_1608MetricD8
1Micro_SD_CardConnector_Card:microSD_HC_Wuerth_693072010801J10
1RT9742SNGVPackage_TO_SOT_SMD:TSOT-23_HandSolderingU13
1STM32G474RET6easyeda2kicad:LQFP-64_L10.0-W10.0-P0.50-LS12.0-BLU1
1SW_SPDTButton_Switch_SMD:SW_SPDT_PCM12SW1
1TAS5805MPWPReasyeda2kicad:HTSSOP-28_L9.7-W4.4-P0.65-LS6.4-BL-EPU7

The 250 most common of 258 parts.

Similar boards

  • 2 layers36.5 × 49.5 mmV485 controller, the printed circuit board in 3D

    V485 controller

    gabrielyoung92/gabs_microSMT_PickAndPlace

    Independent reorganisation of MicroSMT feeder and PNPv3 files, previews and documentation, with upstream attribution and ChatGPT assistance.

    33 parts1
  • 4 layers165.3 × 123.7 mmRX8-7(WithoutOpAmps), the printed circuit board in 3D

    RX8-7(WithoutOpAmps)

    bradport02/RX8-Infotainment_System

    An infotainment system for the Mazda RX-8 that integrates seamlessly with the climate control unit.

    392 parts
  • 4 layers93 × 62 mmPIM V01, the printed circuit board in 3D

    PIM V01

    kpayinda/PIM_V01

    PIM PCB.

    260 parts
  • 4 layers90 × 60 mmBench psu, the printed circuit board in 3D

    Bench psu

    PaulBichl/VibePCB-bench-psu

    USB-C PD (20 V) powered bench supply, 2 independent channels, 1.6-16.6 V / 3 A each, constant voltage / constant current, designed with VibePCB.

    206 parts1
  • 2 layers30.6 × 37.4 mmGlowBandSmall, the printed circuit board in 3D

    GlowBandSmall

    LEDs-by-glowingkitty/GlowBand

    GlowBand is an exciting LED wristband. For dancing at parties and festivals, for long-time exposure photography, and for everyday situations that need some light.

    52 parts4MIT
  • 2 layers76.5 × 16.7 mmBattery Extension PCB, the printed circuit board in 3D

    Battery Extension PCB

    LEDs-by-glowingkitty/GlowSign

    A battery powered LED sign for your laptop, or where ever else you want to use it!

    37 parts1GPL-3.0
  • 6 layers133 × 92 mmMotherboard, the printed circuit board in 3D

    Motherboard

    byrantech/laptop

    anyon_e, a highly integrated, high end, open source laptop. Attempt the impossible.

    264 parts4.3kMIT

Questions

How big is the BedCooler PCB?

It measures 131.5 × 132.4 mm and has 6 copper layers, 1.6 mm thick.

What parts does the BedCooler use?

258 parts, built around the STM32G474RET6, DRV8701ERGER, TPS54331DR-JSM and GL823K-HCY04. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the BedCooler KiCad files?

From the NicholasKorth/BedCooler repository on GitHub, at the commit this page was made from: the board is hardware/BedCooler.kicad_pcb and its schematic hardware/Audio.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the BedCooler design in my own project?

Its repository states no licence, so its author keeps all rights: ask NicholasKorth before reusing the design.