An Internet Power Switch (IPS) has been built for Mt Pleasant. Its main purpose is to provide remote and local control of power to a small cluster in the computer room. This can be operated from the front panel of the device or remotely via a terminal window. There are also several Remote Switches which plug into a wall socket and allow remote control of a single device via WiFi. Software on the IPS allows for control of these devices.
Hardware consists of a Raspberry Pi PC inside the IPS, connected to two relay boards for managing power switching and a custom-made circuit board primarily for managing input from front-panel buttons and displaying switch status on the panel.
Software running on the Raspberry Pi consists of four programs:
SwitchInterface.py, runs from a terminal window. Multiple instances can be run at once. It provides a user interface for monitoring and control of the rack-mounted IPS and all available Remote Switches.
RemoteRelayServer.pywhich runs a MQTT server and manages input from buttons on the front panel of the IPS. The MQTT server accepts requests from
SwitchInterface.pyand from the Remote Switches. The Remote Switches are designed to have their WiFi switched off for most of the time to keep radio interference to a minimum, but report in once per minute (or at another configurable interval).
RemoteRelayServer.pymanages requests to switch this device and sends any update commands to the Remote Switch whenever it checks in on the network.
RemoteRelayServer.pyInteracts with the hardware in the rack-mounted IPS. It takes commands via MQTT from RemoteSelayServer.py and actually switches the corresponding relay. It also controls the LEDs that indicate status of the switches. The circuit board also has three temperature and humidity sensors attached and this software logs their values every minute to a SQL database.
IPSTHServer.pyprovides temperature and humidity data to MONICA on request
The Remote Switches have Arduino-compatible ESP8266 NodeMCU microcontrollers to manage a single relay switch. Each microcontroller runs software to manage the relay, WiFi connection, MQTT communication, a local button and some LEDs. When powered on it will connect to the local WiFi network if configured or start up as an access point if not, allowing a local connection for initial configuration (which is saved to non-volatile memory for next time). The software is in the Arduino directory, called RelayControl.ino.
Mount the SD card.
Enable ssh: touch /Volumes/boot/ssh
IP address: 188.8.131.52 hostname: ipspihb
interface eth0 static ip_address=184.108.40.206/26 # /26 = netmask of 255.255.255.192 static routers=220.127.116.11 static domain_name_servers=18.104.22.168