Construction

The computer is divided in two seperate boards. First there is the mainboard. This is the upper PCB that carries the Compute module 4. The board handles the high-speed interfaces and carries the USB 3.0 host controller, the USB 2.0 hub, ethernet connector and HDMI connector. An SD card can be inserted so CM4's without internal eMMC can be used. 

The mainboard is mounted on top of the utilityboard. This PCB contains an 8 Ampere 5V power supply, RS485 and LED-strip driver circuitry, inputs and (relay) outputs and an input for a current transformer so the power consumption of e.g a 3D-printer can be monitored. In the middle of the utilityboard, a fan is mounted to keep the system cool even under big loads.

Power supply

Many peripherals connected to or implemented on the board, including the compute module need a 5V power rail. To make a stable 5V rail from the 12V input, the Texas Instruments TPS54821 was used. This buck converter can supply up to 8A at 5V. The system has a lot of USB-ports (which will be addressed later). The USB ports to the outside are protected by a power supervisor shutting the port off when a short circuit happens. To each power supervisor IC, 2 USB ports are connected.

Current transformer

Reading out a current transformer can be quiet difficult and can require high sample frequencies and much calculating power. The UCU uses another approach. The current through the transformer is first converter to a voltage over a burden resistor. Then, the signal is buffered, and sent into a dropless rectifier to remain accurate voltage readings. The signal then goes through a peak detector circuit, making a DC signal of the AC waveform that comes in. This DC signal is then sampled by an ADC (MCP3421) without requiring much processing power and high sample rates. The circuit can be made with cheap opamps and still provide decent precision.

USB 3.0 host controller

The VL805 USB 3.0 host controller is used to give the system 4 usb 3.0 ports. The host controller can also be found on the raspberry pi 4. The bootloader for the controller is read from a seperate flash chip at boot. This loads the (proprietary) settings of the controller. Unfortunately, we could not get our hands on the official development documents for the chip, so could not compose our own binary to put on the flash chip. The Pi 4 flash contents also are no good option as the pi only has 2 usb 3.0 ports in use. Instead, we bought a VL805-based PCI card online and de-soldered the flash-ic from the pcb. We then extracted the data from the flash-ic using a raspberry pi and a custom script. We wrote the binaries to our own flash chips and soldered these onto the UCU. All 4 usb 3.0 work with this hack. Due to some bug we have not figured out yet, the system gets stuck in a boot loop when the CM4 is booted with more than 2 devices plugged into the VL805 host controller. Still, it was a nice hack that also kinda worked. :-)

Relay outputs

The 4x 12V output pins of the system are simply open drain connections to ground using N-FET's.

Inputs

There are 4 signal inputs on the system, of 2 different types. The first type of input is realized with a comparator set to a certain threshold. When the voltage on the input-pin with respect to GND goes above the set threshold, the input turns on. The second type of input uses a diode bridge and optocoupler to allow reverse voltage inputs and voltages referenced to something else then system GND.

RS-485

The RS-485 functionality uses a USB 2.0-port of the pi. An CH340 USB-TTL uart converter is connected to this port. The TTL levels are then converted to RS-485 levels. The RS-485 output also has a fused 12V pin to power peripherals.

Status LED's

On top of the system, there are 12 LED's peaking outside through a light pipe. 8 of the LED's are connected to a shift-register and can be controlled from the CM4. The system also has a buzzer.

USB 2.0 hub

The system has the USB 2 mux and hub implemented like seen on the CM4-io board. This allows the USB 2 interface of the CM4 to function as a slave, and also provides extra USB 2.0 ports when the slave functionality is not used.

CM4 peripherals

The system also outputs many of the impressive peripherals the CM4 offers out of the box. An HDMI-port, gigabit ethernet connector with separate transformer and an SD-card slot are fitted.

Enclosure

The whole system was designed to fit into a small DIN-rail enclosure. The used enclosure is the APRA HO6 O (reichelt part number). A hole is drilled into the bottom to provide an air intake to the fan.

Use case

The Utility Control Unit is currently used to control the 3D-printer in the shed. An ordinary power outlet is switched using a 2-pole relay. One wire to the power outlet goes through a current transformer. The implementation of the system at the 3D-printer is very clean as no modifications to the 3D-printer were necessary. The 3D-printer, a Creality CR-10, could simply be plugged into the system with the original power cord and plugged into the UCU with a USB cable. This also goes for the LED-strip and RS485 humidity & temperature sensor.