Modbus

Click PLC with Ethernet Modbus Interface. The PLC has almost all the lights and light switches for the house going through it. There is one real light and light switch, so I can work on the PLC if it fails.

There is an RS485 Modbus network throughout the house to about ten Temperature/Humidity sensors. These are mounted in most rooms on the walls. The sensors were about US$5 each on AliExpress and mounted using blank wall plates inside the wall.

This network also has a Digital IO unit from TryCom that monitors Hot and Cold water flows.

There is a separate RS485 Modbus network for external environmental measurements. This involves a combined Temperature/Humidity sensor as above, as well as a Wind Speed/Direction sensor. These are connected to an RS485 to WiFi interface

The Solar inverter operates on an RS232 Modbus connection

The three networks above are polled by a Brimesh GY-G300 Modbus gateway. This device is useful since it will do the polling of a large number of Modbus devices with different Device ID’s and combine them into a single pollable device.

Modbus to MQTT

I am running two instances of Modbus to MQTT software.

The first connects to the Brimesh concentrator and downloads all the data and sends it to the MQTT server. There are two things to note here.

Instance 1 – Environment

First, the temperature and humidity sensors work well, but they do have artefacts where error conditions are not detected well. The gateway throws out obviously bad data and averages apparently good data over a few minutes. This improves the accuracy of the data significantly. This is only needed on certain sensor classes.

The software also monitors the counters for water usage and sends an MQTT pulse whenever water is used indicating volume used.

Instance 2 – PLC

The second instance connects to the PLC and scans the state of all the switches and lights. When changes are detected, these are sent to the MQTT server. In addition, the instance listens to MQTT transmissions from my Alarm’s PIR sensors and sends these to the PLC.

This allows the PLC to know when I have pressed the buttons in my alarm, and can automatically turn the main garage light on and off accordingly.

MQTT

All the MQTT data is sent to a server where the following tasks operate:

  • Interface to the home Alarm system
  • Interface to CWOP Citizen Weather Observations
  • Prowl/Growl Notifications
  • Interface to Home Assistant
  • Interface to a Modbus LCD Display