Skip to content
cmoore42 edited this page Sep 5, 2016 · 1 revision

This project is one part of my home automation system. The purpose of this project is to act as a bridge between wireless data packets and the MQTT system on the server.

(Diagram to be inserted here)

Data is transmitted to and from wireless sensors using Arduino compatibles equipped with RFM69HW radio modules. The two versions I'm using are the Moteino and the Anarduino.

The Anarduino libraries I use are based on the RHReliableDatagram objects from RadioHead

The contents of the data packets is based on MySensors with some modifications by me.

I use a Moteino R5-USB as the server's interface to the wireless mesh. The code on that Moteino receives packets from the sensors and, for each packet received, writes a line to the serial port of the form:

node;sensor;type;sub_type;payload

Node is which wireless sensor node sent the packet Sensor is which sensor on the node is reporting Type is the command sent (see below) Sub_type is dependent on the command. For C_PRESENTATION commands this is the type of sensor. For C_SET, C_REQ, and C_ACK this is the type of data in the payload.

This program monitors the serial port for lines in the above format. When it receives one it posts and MQTT message. The topic is mqtt///<data_type> and the data is the payload.

For example, I have a sensor node in my garage that has two sensors - one reports temperature and the other reports distance. (Distance in this case is the distance from the ceiling to whatever is below it - I use that to tell if the garage door is open or closed, and which car if any is in the garage.)

Packets are received by the Moteino and sent to the serial port like this: 1;0;1;0;28.0 This is: Node 1, sensor 0, C_SET, V_TEMP, 28.0 degrees Or: 1;1;1;13;0.34 This is: Node 1, sensor 1, C_SET, V_DISTANCE, 0.34 meters

Clone this wiki locally