Software Configuration

From Stock OS to Industrial Network Bridge

← Back

1. OS Customization

The foundation of this project is a clean installation of Raspberry Pi OS (Bookworm). Starting from the original stock image, I implemented several low-level modifications to transform the Pi into a reliable network appliance.

Persistent Hardware Identity (Static MAC)

Because the ENC28J60 does not have a factory-burned MAC address, it often causes "IP jumping" in DHCP logs. I developed a systemd service that runs before the network stack. This service reads the Pi CPU's unique serial number and generates a corresponding static MAC address, ensuring each system has a unique, permanent identity.

Read-Only File System

To prevent SD card corruption—a common issue with original OS installations during power loss—this system has been converted to a Read-Only (RO) file system. Maintenance can be performed by using the rw (read-write) and ro (read-only) terminal commands.

Automated System Recovery (Watchdog)

To ensure 24/7 availability, a Hardware Watchdog service is active. It will automatically force a reboot if:

Networking Bridge

Configured for DHCP using hostapd and dnsmasq to bridge traffic to the WiFi. Time synchronization is handled by the ntpd service. Update your WiFi credentials (/etc/hostapd/hostapd.conf) immediately after setup.

System Resources

Equipped with a 1 GB swap partition to provide extra stability for the Zero 2 W.

Remote Access

Active ssh service with remote root access enabled and default password is Dooshei4. Change this password at the first occasion.

Development Environment

For application development and scripting, Python is fully installed and pre-configured on the system.

2. Hardware-Specific Configurations

This ecosystem utilizes different Raspberry Pi hardware classes depending on the workload. Edge nodes use the ultra-low-profile Raspberry Pi Zero 2 W, while the central intelligence runs on the high-performance Raspberry Pi 5.

2.1. Edge Nodes - Raspberry Pi Zero 2 W

Custom SensorNode Python package, designed as a highly optimized, lightweight daemon service managed by systemd.

A. Settings

Open /root/SensorNode/config.json and customize the settings:

# --- MQTT ---
broker_host = "192.168.1.100" # IP of your central RPi 5
username = MQTT username
password = MQTT password
# --- Device ---
name = Friendly name of the device
# --- Broadlink ---
host = "192.168.1.101" # IP of Broadlink Controller
covers = List of devices controlled by Broadlink
            

B. RF/IR Code Learning (BroadLink)

To control external appliances (like smart covers) via BroadLink, run the learning script to scan and capture RF/IR remote signals. Follow the interactive CLI prompts to save the codes: python3 /root/SensorNode/sensor_array.py --learn-covers and follow the provided steps.

2.2. Central Node - Raspberry Pi 5

The central node serves as the primary intelligence hub of the smart residence, running high-performance services to coordinate and store data from all edge nodes.

A. Core Services

  • Home Assistant Core: Manages the central automation engine, state machine, and provides the main visual dashboard for users. It processes incoming sensor events and triggers smart rules.
  • Mosquitto MQTT Broker: Handles real-time, low-latency publish/subscribe messaging between all edge nodes (Pi Zero 2 W) and the Central Coordination layer.
  • MariaDB Database: Standard relational database used for robust and optimized historical state logging, ensuring smooth analytics and graphs generation.

B. Network Integration

The Central Node is permanently connected to the local network and runs on a static IP allocation (default: 192.168.1.100). It acts as the gateway for external cloud integrations (such as Google Smart Home and Weather Forecast APIs) while maintaining autonomous offline control for safety-critical heating routines.

3. Installation & Setup

  1. Flash: Use Raspberry Pi Imager[3] to write the os image[4] to your storage media.
  2. Deploy: Insert the storage media into the selected Raspberry Pi board.
  3. Login: Access via SSH and use the rw command to unlock and make permanent configuration changes.
  4. Config: Change the default root password immediately and update the WiFi credentials if deploying a bridge node.

List of Materials (BOM)

Referenced components used in this manufacturing process.

ID Item Description/Source
[1] Raspberry Pi Zero 2 W Available on Emag.
[2] Memory Card Available on Temu.
[3] Raspberry Pi Imager Available on Raspberry Pi Website.
[4] SensorNode OS Image Download Image.