The system is composed of several components working together:
arduino: A C++ sketch running on an Arduino Nano. It is responsible for reading analog sensor data (voltage and current) and communicating with control boards via I2C.serial: A Go service that runs on a Raspberry Pi. It reads the data from the Arduino over a USB serial connection.core: The central Go service. It processes the data from theserialservice, manages miner pool information (poolinfo.json), and exposes data to thewebGUI.webGUI: A Go web server that serves a modern React-based frontend, providing the user with a dashboard to monitor and control the hardware.
This project is organized into submodules, each with its own detailed README.md file.
- Arduino Controller (
Arduino/): An Arduino sketch that emulates a power supply and reads current sensors. - Serial Service (
Serial/): A Go service that reads data from the Arduino via serial and sends it to thecoreservice. - Core Service (
Core/): The central Go service that processes data, manages the miner, and exposes metrics. - Web GUI (
WebGUI/): A Go web server with a React frontend for monitoring and control.
- Go (latest version recommended)
- Node.js and npm (for the web frontend)
- Arduino IDE
-
Clone the repository with its submodules:
git clone --recurse-submodules https://github.com/your-username/bluecollar.git cd bluecollar -
Build and configure each service: Detailed instructions for building, configuring, and running each component can be found in its respective
README.mdfile in the Components section.In general, the Go services can be built using
go buildwithin their respective directories. The frontend for thewebGUIrequiresnpm installandnpm run build. -
Run the services: The submodule
README.mdfiles provide instructions for running each service, including how to set them up assystemdservices for automatic startup.
This project is distributed under the GNU General Public License v3.0. See LICENSE for more information.
Connect wires to pins A0, A1, A2, A3 for the current and voltage readings as well as a wire to 5V and ground for each Connect wires to pins A4 and A5 as well as a wire for ground for i2c communication to the control board
Read Setup Arduino IDE for help configuring and getting the know the Arduino IDE Clone or copy the code in the arduino repo Flash the sketch to the arduino nano
Follow the getting started with Raspberry Pi to flash the OS Connect outside network to the ethernet port built into the Pi connect the USB-to-Ethernet adapter to one of the ports on the Pi Connect Ethernet cable between the USB-to-Ethernet adapter and the control board Connect the Arduino to the Pi with a USB cable Connect 5V to pin 2 or 4 and ground to pin 6 If using a BMS with UART pin 8 is TX and pin 10 in RX, connect the BMS TX to Pi RX and BMS RX to Pi TX (NOTE ABOUT VOLTAGE FUNNIES RELATED TO BMS)
sudo usermod -a -G dialout $USER
sudo rebootsudo raspi-configselect: interface options -> serial port When asked if login shell over serial select NO When asked if enable serial select YES When asked if reboot select YES
sudo nmcli connection add \
type ethernet \
con-name "minernet" \
ifname eth1 \
ipv4.method shared \
ipv4.addresses 192.168.10.100/24 \
ipv6.method ignoresudo nmcli connection mod minernet \
ipv4.shared-dhcp-range=192.168.10.101,192.168.10.101,12hsudo nmcli connection up minernetsudo apt install apache2sudo [ nano | vim ] /etc/apache2/sites-enabled/000-default.configpaste the following
<VirtualHost *:81>
ServerName your_server_ip_or_domain:81
ProxyPass / http://192.168.10.101:80/
ProxyPassReverse / http://192.168.10.101:80/
RequestHeader set X-Forward-Proto "http"
RequestHeader set X-Real-IP "%{REMOTE_ADDR}e"
</VirtualHost>
<VirtualHost *:4028>
ServerName your_server_ip_or_domain:4028
ProxyPreserveHost off
RequestHeader set Host "192.168.10.101"
ProxyPass / http://196.168.10.101:4028/
ProxyPassReverse / http://196.168.10.101:4028/
</VirtualHost>
sudo systemctl resart apache2add prometheus config and rules