Skip to the content
4 layers309.5 × 145 mmMicro HIL v0.1, the printed circuit board in 3D

microHIL is a self-developed testing device for setting up a basic hardware-in-the-loop environment

Size
309.5 × 145 mm
Copper layers
4
Thickness
1.6 mm
Parts
396
Nets
263
Pads
1,018
Tracks, vias
1,862, 843
Pours
48
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
8 Sep 2026
Updated
9 Sep 2026

Overview

Micro HIL v0.1 is an open-source printed circuit board by danielsimonreinhardt, from the danielsimonreinhardt/microHIL repository on GitHub, published under the MIT licence. It is a 4-layer board of 309.5 × 145 mm with 396 parts on 263 nets, routed with 1,862 tracks and 843 vias.

It is built around the TLV6001UIDBV, SN65HVD1050D and INA240A1D, with the AMS1117-3.3, AMS1117-5.0 and SRV05-4 among its other parts. Its parts include 138 resistors, 63 capacitors, 45 connectors, 43 transistors and 32 ICs. It belongs with the STM32 boards of this library.

Main components

12

README

README.md

microHIL

A small, self-built hardware-in-the-loop box: switchable relays, digital and analog I/O, two current-monitored 12 V supply outputs and a CAN interface — all driven from a PC over a single USB cable.

microHIL is built around an STM32F446RET (LQFP64) on a custom PCB. It enumerates as a USB composite device with two virtual COM ports: one carries a plain ASCII command protocol for the I/O, the other exposes CAN1 as a standard SLCAN adapter. Both can be used at the same time.

Status: working prototype, in active use on the bench. The firmware, the command protocol and the Python host library are stable and verified against real hardware; the PCB is at revision v0.1 and has a few documented quirks that needed rework (see docs/hardware-notes.md). Project documentation under docs/ is currently in German.

Features

FunctionChannelsNotes
Relays4dry contacts
Digital outputs8OUT1-8
Digital inputs812 V level, comparator front end with selectable 5 V/12 V threshold
Analog inputs4calibrated, reported in mV (divider for up to ~13 V)
Analog outputs2DAC + buffer, calibrated, ~0…12.2 V
Switchable 12 V outputs2high-side switch with current sense (mA) and firmware current limiting
PWM outputs40…1000 ‰, configurable frequency 1 Hz…20 kHz (PWMFREQ, shared by all 4 channels, ceiling scope-verified), shares the output stage with OUT1-4 (interlocked in firmware)
CAN1 (+1 reserved)CAN1 as SLCAN USB adapter; CAN2 reserved for remote control

Analog channels (AIN1-4, AOUT1-2, CURR1-2) are individually two-point calibrated against reference instruments, so the protocol speaks physical units (mV / mA) rather than raw ADC counts — see docs/calibration.md.

The 12 V outputs are protected in firmware: a per-channel limit (ILIM, default 1200 mA) and a combined 1500 mA budget for the shared polyfuse. A tripped channel latches off until its request is explicitly withdrawn; PWR12FLT? reports the cause.

Repository layout

text
firmware/microHIL_fw/   STM32CubeMX + CMake project for the STM32F446RET
host/                   Python client library, test GUI, hardware-free checks
hardware/               KiCad 9 schematic, PCB and Gerbers (rev v0.1)
docs/                   Protocol reference, CAN/SLCAN reference, calibration,
                        hardware notes (German)

USB interfaces

microHIL presents two CDC-ACM functions under the same VID:PID 0483:5740 (ST's factory VCP IDs — no own USB vendor ID). They are told apart by interface number, which host/microhil.py does automatically:

InterfaceWindowsLinuxContent
0…&MI_00…-if00HIL command protocol — docs/protocol.md
2…&MI_02…-if02CAN1 as SLCAN — docs/can-usb.md

Two ports rather than one multiplexed port, because a COM port can only be opened once on Windows: this way the test GUI and a CAN tool can run side by side.

Command protocol

Line-based ASCII, uppercase, \n-terminated requests, \r\n-terminated replies — a plain readline() is enough. Values are always integers in mV/mA.

text
*IDN?                 -> microHIL,fw=0.1.0,SN=2065386A5631
RELAY 1 1             -> OK
IN?                   -> 10110001        (IN1 first)
AIN? 2                -> 3300            (mV, calibrated)
PWR12 1 1             -> OK
CURR? 1               -> 536             (mA)
PWM 1 500             -> OK              (‰ duty cycle)

Errors are exactly ERR ARGS, ERR RANGE or ERR UNKNOWN. The full reference, including the range-checking rules and the board serial number in *IDN?, is in docs/protocol.md.

CAN1 speaks the SLCAN/Lawicel dialect (CAN232-compatible), so it works with python-can (interface="slcan") and, on Linux, as a regular SocketCAN interface via slcand. Two extensions beyond CAN232: B<bit/s> for exact non-standard bitrates and Y for a loopback self-test without a bus. See docs/can-usb.md.

Getting started (host)

bash
pip install -r host/requirements.txt
python
from host.microhil import MicroHIL

with MicroHIL() as hil:          # finds the right COM port by itself
    print(hil.idn())
    hil.set_relay(1, True)
    print(hil.get_ain_mv(2), "mV")
    hil.set_pwr12(1, True)
    print(hil.get_curr_ma(1), "mA")

A PySide6 test GUI that exercises every function manually, with a CAN trace tab, comes with it:

bash
python host/gui.py

Two checks in host/tests/ run without any hardware attached — they verify the CAN bit timing against the bxCAN register limits and the SLCAN wire format in both directions against the real python-can driver:

bash
python host/tests/check_bit_timing.py
python host/tests/check_slcan_wire.py

Building the firmware

Needs the arm-none-eabi GCC toolchain, CMake ≥ 3.22 and Ninja. The project was generated with STM32CubeMX and is set up for the STM32Cube extension for VS Code, but builds fine from the command line:

bash
cd firmware/microHIL_fw
cmake --preset Debug
cmake --build --preset Debug

Flashing is over SWD with an ST-Link V2, e.g.:

bash
STM32_Programmer_CLI -c port=SWD -w build/Debug/microHIL_fw.elf -rst

With GCC 10.3.1 (the version bundled with STM32CubeIDE 1.10.1, confirmed working end-to-end 2026-09-09), the linker fails on all three .ld files with non constant or forward reference address expression for section .ARM.extab — the (READONLY) section attribute on .ARM.extab/.ARM/ .preinit_array/.init_array/.fini_array needs GCC 11+ (each occurrence says so in its own comment). Remove (READONLY) from those five section headers in STM32F446xx_FLASH.ld (used by the CMake build) and, for STM32CubeIDE's own Eclipse build, STM32F446RETX_FLASH.ld/_RAM.ld too, if building with GCC 10. A GCC 11+ toolchain doesn't need this.

If you regenerate from microHIL_fw.ioc, note that the CAN bit timing is computed at runtime in Core/Src/slcan.c (deliberately not stored in CubeMX) and that the CDC composite build needs ST's CompositeBuilder, which CubeMX does not emit for the F4 series — it is vendored in Middlewares/ST/STM32_USB_Device_Library/Class/CompositeBuilder/.

Hardware

  • MCU: STM32F446RET, LQFP64, 8 MHz crystal, HSE/PLL clock tree
  • Debug: SWD (ST-Link V2)
  • CAN1: PB8/PB9, transceiver and 120 Ω termination populated
  • CAN2: PB5/PB6, not in service yet (see Roadmap)
  • KiCad sources, PCB and Gerbers for rev v0.1 are in hardware/

Board revision v0.1 has known issues that required rework — most notably VBUS routed straight onto the supply rail, and missing pulldowns on the digital input comparator stages. All of them are documented, with measurements and the fixes applied, in docs/hardware-notes.md. Read that file before building a board from these files.

Roadmap

  • CAN2 as a remote-control interface. Drive microHIL from a supervising ECU or test bench with the same functions as the USB command protocol. Frame layout, addressing and bitrate are still to be defined; the bxCAN filter bank split needed for CAN2 to receive at all is already in place (SlaveStartFilterBank = 14 in Core/Src/can_if.c).
  • CAN1 against a second real bus node, plus a scope measurement of the actual bit rate.

License

MIT — see LICENSE.

Vendored third-party code keeps its own license: the STM32 HAL drivers, CMSIS and the ST USB device library under firmware/microHIL_fw/Drivers/ and firmware/microHIL_fw/Middlewares/ are © STMicroelectronics / Arm and licensed under their respective terms (see the LICENSE.txt files in those directories).

Parts

396
QtyValueFootprintReferences
4110kResistor_SMD:R_0603_1608MetricR1, R103, R104, R105, R106, R107, R109, R111, R113, R115, R116, R117, R118, R123, R124, R125 +25
39100nCapacitor_SMD:C_0603_1608MetricC2, C12, C13, C14, C16, C17, C20, C21, C22, C23, C24, C25, C26, C27, C28, C29 +23
36Conn_01x01Connector:Hirschmann_SEP_2630_S1,9J1, J2, J10, J11, J12, J13, J14, J15, J16, J17, J19, J20, J21, J22, J23, J24 +20
281kResistor_SMD:R_0603_1608MetricR10, R13, R14, R17, R18, R19, R20, R21, R22, R24, R26, R28, R30, R39, R40, R41 +12
19TestPointTestPoint:TestPoint_Pad_D1.0mmTP2, TP3, TP4, TP5, TP6, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18, TP19, TP20 +3
16LM397Package_TO_SOT_SMD:SOT-23-5U9, U10, U11, U12, U13, U14, U15, U16, U21, U22, U23, U24, U25, U26, U27, U28
15BZT52B8V2Diode_SMD:D_SOD-123D6, D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26, D27, D28, D29
123,3kResistor_SMD:R_0603_1608MetricR99, R100, R101, R102, R119, R120, R121, R122, R135, R136, R137, R138
1247nCapacitor_SMD:C_0603_1608MetricC41, C43, C45, C47, C49, C51, C53, C55, C60, C61, C62, C63
12BSS84Package_TO_SOT_SMD:SOT-23Q32, Q33, Q34, Q35, Q36, Q37, Q38, Q39, Q40, Q41, Q42, Q43
10BC807Package_TO_SOT_SMD:SOT-23Q7, Q9, Q11, Q13, Q15, Q17, Q19, Q21, Q25, Q31
10BC817Package_TO_SOT_SMD:SOT-23Q6, Q8, Q10, Q12, Q14, Q16, Q18, Q20, Q24, Q30
10DNPResistor_SMD:R_0603_1608MetricR35, R36, R37, R38, R57, R58, R59, R60, R64, R82
80.5AFuse:Fuse_1210_3225MetricF4, F5, F6, F7, F8, F9, F10, F11
815kResistor_SMD:R_0603_1608MetricR88, R90, R92, R94, R108, R110, R112, R114
84.7kResistor_SMD:R_0603_1608MetricR31, R32, R33, R34, R53, R54, R55, R56
7100kResistor_SMD:R_0603_1608MetricR6, R65, R66, R127, R129, R131, R133
62N7002Package_TO_SOT_SMD:SOT-23Q2, Q3, Q4, Q5, Q26, Q27
5680Resistor_SMD:R_0603_1608MetricR7, R11, R12, R15, R16
5LED redLED_THT:LED_D5.0mmD7, D8, D9, D12, D13
410Resistor_SMD:R_0603_1608MetricR71, R72, R75, R76
410µCapacitor_SMD:C_0805_2012MetricC18, C19, C31, C39
433kResistor_SMD:R_0603_1608MetricR128, R130, R132, R134
4G5Q-1ARelay_THT:Relay_SPST_Omron-G5Q-1AK1, K2, K3, K4
4LL4148Diode_SMD:D_MiniMELFD10, D11, D14, D15
4PMT200EPEXPackage_TO_SOT_SMD:SOT-223-3_TabPin2Q22, Q23, Q28, Q29
4TLV6001UIDBVPackage_TO_SOT_SMD:SOT-23-5U29, U30, U31, U32
33AFuse:Fuse_1812_4532MetricF1, F13, F14
3SW_SPDTTerminalBlock:TerminalBlock_bornier-3_P5.08mmSW1, SW2, SW3
20.2AFuse:Fuse_1210_3225MetricF12, F15
2120Resistor_SMD:R_0603_1608MetricR5, R8
212pCapacitor_SMD:C_0603_1608MetricC8, C10
216kResistor_SMD:R_0603_1608MetricR80, R81
227kResistor_SMD:R_0603_1608MetricR63, R79
2330Resistor_SMD:R_0603_1608MetricR2, R4
24,7µCapacitor_SMD:C_0805_2012MetricC1, C6
2450mAFuse:Fuse_1210_3225MetricF2, F3
2DB9_FemaleConnector_Dsub:DSUB-9_Female_Vertical_P2.77x2.84mm_MountingHolesJ43, J44
2DNPCapacitor_SMD:C_0603_1608MetricC32, C33
2Ferrite_Bead_SmallInductor_SMD:L_0805_2012MetricFB1, FB2
2INA240A1DPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU18, U19
2JST_PH_B4BConnector_JST:JST_PH_B4B-PH-K_1x04_P2.00mm_VerticalJ18, J41
2LVK24R050CERResistor_SMD:R_Shunt_Ohmite_LVK24R73, R74
2NUP2105LPackage_TO_SOT_SMD:SOT-23D3, D4
2OPA330xxDBVPackage_TO_SOT_SMD:SOT-23-5U17, U20
2SN65HVD1050DPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU4, U5
116MHzCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1
11MResistor_SMD:R_0603_1608MetricR3
11µCapacitor_SMD:C_0603_1608MetricC11
122µFCapacitor_SMD:CP_Elec_6.3x5.9C15
1AMS1117-3.3Package_TO_SOT_SMD:SOT-223-3_TabPin2U7
1AMS1117-5.0Package_TO_SOT_SMD:SOT-223-3_TabPin2U8
1Conn_01x10Connector_TE-Connectivity:TE_3-1445056-0J42
1IRF7404Package_SO:SOIC-8_3.9x4.9mm_P1.27mmQ1
1JST_PH_S4BConnector_JST:JST_PH_S4B-PH-K_1x04_P2.00mm_HorizontalJ40
1LED_greenLED_SMD:LED_0805_2012MetricD2
1LED_redLED_SMD:LED_0805_2012MetricD1
1LM809Package_TO_SOT_SMD:SOT-23U2
1SM6T33CAYDiode_SMD:D_SMB_HandsolderingD5
1SRV05-4Package_TO_SOT_SMD:SOT-23-6U6
1STM32F446RETxPackage_QFP:LQFP-64_10x10mm_P0.5mmU1
1SWDConnector_IDC:IDC-Header_2x03_P2.54mm_VerticalJ3
1TE_AMPMODU_HEADERConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ31
1TestPointConnector_Pin:Pin_D1.1mm_L8.5mm_W2.5mm_FlatForkTP1
1USBLC6-2SC6Package_TO_SOT_SMD:SOT-23-6U3
1USB_BConnector_USB:USB_B_TE_5787834_VerticalJ45
1WE_SLMInductor_SMD:L_CommonMode_Wuerth_WE-SLML1

Similar boards

  • 2 layers90 × 60 mmFeedme pcb, the printed circuit board in 3D

    Feedme pcb

    rplanier/feedme-pcb

    51 parts
  • 2 layers122.5 × 87.6 mmControllerCircuit, the printed circuit board in 3D

    ControllerCircuit

    stuartpittaway/diyBMSv4

    Version 4 of the diyBMS

    113 parts1.1k
  • 2 layers66 × 42 mmBspd, the printed circuit board in 3D

    Bspd

    Formula-Trinity/bspd

    A safety device which detects hard braking and acceleration and shuts the engine down.

    81 parts
  • 4 layers96.1 × 56.1 mmHPM5300RDCRevB, the printed circuit board in 3D

    HPM5300RDCRevB

    hpmicro/hpm_apps

    hpm apps for hpm sdk

    288 parts35BSD-3-Clause
  • 2 layers115 × 100 mmCog1, the printed circuit board in 3D

    Cog1

    diegodemarco/cog1

    cog1 is an open-source industrial IoT gateway (hardware and software) built as a motherboard hosting an Orange Pi Zero 3 Linux SBC.

    133 parts6MIT
  • 2 layers99.5 × 99.5 mmBidirectional Power Converter 24V-12V with BMS, the printed circuit board in 3D

    Bidirectional Power Converter 24V-12V with BMS

    kwiecinski/BMS-and-offgrid-photovoltaic-management-system

    Project contains BMS for lead-acid batteries and ESP-based board used to pull information from EASUN offgrid inverter, energy meters and sensors.

    156 parts3MIT

Questions

How big is the Micro HIL v0.1 PCB?

It measures 309.5 × 145 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Micro HIL v0.1 use?

396 parts, built around the TLV6001UIDBV, SN65HVD1050D, INA240A1D and AMS1117-3.3. 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 Micro HIL v0.1 KiCad files?

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

Can I use the Micro HIL v0.1 design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).