← All work

Simorgh Aviation Factory · 2018 – 2020

Automated monitoring and power control for a mining farm

A Raspberry Pi that watches every mining rig, decides when one needs a reboot or a shutdown, and carries it out through Arduino-driven relays, with a web panel for remote control. I built the control system: the Pi, the Arduinos, the software and the networking.

Role
Control system: Raspberry Pi, Arduino, software and networking
Stack
  • Python
  • Raspberry Pi
  • Arduino
  • I²C
  • Relays
  • Web UI
  • Python agent on every rig, decisions on a Raspberry Pi
  • 4 Arduino Mega boards driving 8 × 16-channel relay modules
  • Two relay channels per rig: power and power button

A room full of cryptocurrency mining rigs runs hot and runs all the time. A crashed GPU or a failed fan means lost income, or damaged hardware, until someone notices. I built a control system that notices, decides and acts on its own, down to physically pressing a rig’s power button.

My part was the control system: the Raspberry Pi and Arduino hardware, the software on the rigs, the Pi and the Arduinos, and the networking. The power panels were designed and built by a power engineer.

Mining rigs with rows of GPUs on open steel racks

Architecture

Mining rigs (×N)
  └─ Python agent: GPU temp, fans, hash rate
        │ network
        ▼
Raspberry Pi
  ├─ Python decision service
  ├─ Web panel: remote on / off / reboot
  └─ I²C master
        ▼  daisy-chained bus
4 × Arduino Mega, one address each
        ▼
8 × 16-channel relay modules, 2 channels per rig
  ├─ relay → the rig’s contactor (mains power)
  └─ relay → the rig’s power button

Agents on every rig

A small Python client runs on every rig and reports its health to the Raspberry Pi: GPU temperatures, fan speeds, hash rate and more.

Decisions on the Raspberry Pi

A Python service on the Pi collects the reports and decides what to do with each rig: leave it alone, reboot it, turn it off, or turn it off permanently if it keeps failing.

Physical control through Arduino

The Pi sends predefined command codes over I²C to four Arduino Mega boards, each responsible for a group of rigs. The bus is daisy-chained from board to board: the Pi is the master and each Arduino listens on its own address. The Arduinos drive eight 16-channel relay modules, and every rig has two channels:

  • One drives the rig’s own contactor, which cuts or restores its mains power. The contactors are in two separate power panels.
  • One is wired to the rig’s power button and closes for a moment to imitate a real button press, so a rig can be booted or forced off cleanly without cutting its power.

Close-up of the control section: Raspberry Pi, four Arduino Mega boards and eight relay modules

Photo taken during assembly, before the I²C bus from the Raspberry Pi to the Arduinos was wired.

The same photo with the I²C bus drawn in: a dashed line from the Raspberry Pi (master) through the four Arduinos (slaves 1 to 4)

The same photo with the I²C bus drawn in as an overlay: Raspberry Pi as master, daisy-chained through the four Arduinos.

The control section

The Raspberry Pi, the four Arduinos and the relay modules sit together at the top of an electrical cabinet, laid out in cable ducts. The breakers, contactors and other equipment lower in the same cabinet serve other loads, such as the air conditioning, not the rigs.

The electrical cabinet, with the rig control section at the top

Remote web panel

The Pi also serves a web panel reachable over the internet, where an operator can see every rig and turn it on, turn it off or reboot it by hand.

What it shows

Software that makes decisions and then acts on real hardware: sensors in, logic in the middle, relays out. I built the control system end to end, from the Python code to the Arduino firmware and the network. The same combination, at a larger scale and under regulation, is at the heart of the Multikiosk work.