Presenting MqGateway - wired MQTT gateway for sensors and controllers

Hi All,
I would like to introduce “MqGateway” :tada: - an open source MQTT gateway for wired sensors and controllers.
The project is both - hardware and software.

This is an improved version of RoomHub 3 you may have read about on this forum here.
Therefore, you may see a lot of similarities if you’ve read that thread.
Since RoomHub, I have received a lot of feedback (also on this forum) and many improvements in MqGateway are the result of them. Thank you!

MqGateway has been created to support multi-device, fully wired solution. It supports MQTT auto-discovery through HomeAssistant MQTT Components Binding.

Here is how it looks with I/O Expander board and in 19’’ rack 1U case.

It just looks like a huge Ethernet switch, because it uses UTP cables with RJ45 to connect sensors and controllers :stuck_out_tongue_winking_eye: . These are NOT actually Ethernet ports.

Typical use case for MqGateway is a house with sensors and controllers distributed all around with wired connections. It is possible to plug in simple and inexpensive devices, like relay modules, PIR motion sensors or just plain wall switches into MqGateway to make capable home automation system. These are the same sensors/modules which you would use with Arduino projects, but you don’t need to do any programming yourself - just connect them with UTP cable and do simple configuration in YAML.

MqGateway communicates with OpenHab through MQTT and supports auto-discovery through HomeAssistant MQTT Components Binding.

In theory, single MqGateway board allows you to connect:

  • up to 64 digital input/output devices (like relays or switch buttons) and
  • up to 16 complex devices using RS485 or UART communication.

For now supported devices are:

  • relay module (on/off)
  • switch button (pressed, released, long-pressed, long-released)
  • emulated switch (useful for opening gates)
  • motion detector
  • reed switch (open/close)
  • timer switch
  • window shutter (open/close, position)
  • BME280 (temperature, humidity, pressure)
  • DHT22 (temperature, humidity)

connection diagram

Hardware-wise MqGateway consists of rather simple electronic components. The aim was to make it easy to assemble for amateur electronic hobbyist. The controller on the board is Nano Pi Neo, but the board is also prepared to fit Raspberry Pi if preferred.

All the work done for MqGateway is available freely under Open Source Licenses.

Why I’ve created MqGateway

When I was doing major renovation at my house, I’ve decided to go with as much wired smart devices as possible. MqGateway is my fourth approach to create inexpensive, wired MQTT gateway for Arduino-capable modules.

I’ve created the device for my own needs, because I haven’t found anything which would suit my requirements. However, I believe now it is flexible and quite easy to use, so maybe others can benefit from it as well.

What’s next?

You can find out more in the documentation:

I’ve got five MqGateway devices around the house working for about 5 months now. It has proved to be stable now, although I still consider it to be in development. I am working to add support for more type of devices and new features.

I have also work in progress on preparing “I/O Extender board” which:

  • expands number of ports to support twice as much devices (prototype is working for some time already)
  • adds 12V powered RS485 bus

I would like to know if there is any interest in device like MqGateway. There is a considerable amount of work related to creating documentation and maintaining project in an open source manner. I want to know if this is of any value for anyone else than me :slight_smile: .

Is there any need for wired solution at all? Do you use something else for the similar use case?

Any feedback is welcome!



Is it possible to elaborate on the ‘use case’. Is this for new builds with new dedicated UTP point-to-point wiring for each sensor?

I would think that standard wifi / ethernet connections would be helpful for non-new-builds (that’s most of us) - even better with some ‘PoE-style’ power for dumb and/or ‘battery’ devices.


Hi @alanambrose,
Thanks for your message.

The use case for MqGateway is rather for new builds. I would say it requires at least some renovation. In theory it could also replace some existing systems if electrical wiring is prepared to be controlled from single place.
I have personally added UTP wiring around the house when doing renovation at my house.
You can read more about my setup on my personal blog if you’re interested.

I am not sure if I was clear enough - MqGateway is using UTP wiring and 8p8c/RJ45 connectors, but it is not using Ethernet connection for controlling devices (Ethernet is used only to connect to MQTT/OpenHab). I’ve chosen UTP cable because it is very popular, easy to use, relatively cheap and have good selection of available sockets.
It is possible to connect up to four devices with single UTP cable. One common example of such a device is relay module like this.
MqGateway is powering these devices with 5V.

Of course if you have existing UTP cables around the house which you do not need for Ethernet any more, you could use them for smart home sensors with MqGateway.

I hope that makes it a bit more clear.