The Gateway connects the MySensor network to the OpenHAB system, via MQTT. The gateway listens for updates from the sensors and converts it into MQTT notifications which are passed to OpenHAB.

There are a few ways to buid the gateway. For example I could use serial, however in my case my OpenHAB server is a virtual system running under Proxmox and so does not strictly have any serial interfaces. I could of course present a serial interface through proxmox.  I chose to use ethernet as that provides the most flexability. I can CAT 5 all around the house, so I could pick the best place for the gateway to obtain the greatest coverage.  Which turned out to be the Kitchen, hidden on top of the cabinets (Next to my WiFi router). this first iteration of the Gateway requires a 5Volts feed to power it, I would like to use PoE but looking at the necessary circuit to pull power from the ethernet circuit was a little complex.

I’m using the NRL radios which require 3volts, so needed a voltage regulator to drop from 5 to 3.3Volts.  The ethernet module is happy with either 3 or 5 volts. However it turns out that the radio is very fussy so I chose to run the radio at 3 volts and everything else at 5volts.

Using my 3D printer I then desgined a case to hold the gateway. When designing my hand held Raspberry Pi device I found screws to be rather annoying, so this time I used slide rails. I can thus slide the two circuit boards into the case which holds them well. The bottom case has wholes for ethernet and a micro USB socket for power. 

I’m also going to try the radio with a external antenna to see if the range improves. I don’t really want to have to use relay nodes. Though I suspect I will need to in order to reach the loft and garage spaces.

To start with I had some issues with the gateway disconnecting from OpenHAB every few hours. It seems the network side of the gateway was stopping, as I was still able to see the radio receiving updates. I tried to use watchdog timers to reset the Arduino, but it didn’t seem to be effective. I moved on to building a little circuit using a 555 timer to reset whole circuit.  The 555 would trigger a relay to remove power for 2 seconds. This seemed to be a good solution, until I found that triggering it from the Arduino was causing issues.  The Arduino was keeping the digital out lines low duing the reboot.  So I added a transistor to switch it to trigger on high pulse instead.  But during the reset the relay was causing too much noise on the lines which caused the 555 timer to keep retriggering. 

In the end I found a new BETA version of the libraries and gateway software which seems to work much better. within the first hour or so, it might need a reset or two, which I think might be relayed to the openHAB still holding onto connections and confusing the gateway. Once that’s cleared out it stays connected. So far 7+ days and counting.