Remote wired relay

Hello everyone

I’m planning a new greenfield installation and want to decide on the remote relay.
I’m planning to have an openHAB in a central location and a few sets of DIN-rail mounted SSRs in the remote locations.
Those SSRs are already equipped with internal optocouplers, so in the remote location I will need something which can provide just TTL level signals to control the relays.
The plan is to use Ethernet between the central and remote locations. Initially I was thinking about RS-485/Modbus (not dependent on LAN at all) but after some reading I’ve got a feeling that such a binding has issues.

I’m looking for ideas about the hardware implementation of such remote device. As an example I can think of something like this:

  • RPi with Webiopi controlled through HTTP requests from openHAB
  • controller like PoKeys57E also controlled through HTTP (excessive number of ports, a bit expensive)
  • Arduino with Ethernet shield loaded with some “web relay” software - don’t like this idea
  • just found CAI Networks WebControl 8 board with 8 TTL outputs plus other features
  • 16x Digital output RS485 MODBUS module recently found on Aliexpress

Please share what you use and what suitable hardware you see around.

Thanks!

Hi!

Have a look at MySensors, it is possible to use RFM, nrf24l01+ and WLAN as wireless solutions and USB and Ethernet as wired solutions. Rs485 is currently under development. I’ve written a binding for MySensors.

Greetings
Tim

Thanks, Tim!

Yes, I’m aware of this project. My understanding that MySensors is very wireless focused, but I was looking for wired solution. I’m not that good in programming to modify the sketches provided, but if you can give a simple ‘wired relay’ example that will be great. My understanding I should have a Gateway in their terminology, so I just want to access an Arduino running Gateway software over wired Ethernet and get access to it’s on-board GPIO.

Thanks again
Andrew

What is it you don’t like about an arduino with ethernet? My experience with those, is that they are running very stable.

A RS485 network can be very stable and run for 100s of meters. I have been using RS485 for 20 years.
I would make a Arduino ethernet to RS485 gateway using MQTT between the Arduino and Openhab.
The RS485 comms can be as simple or complex as you desire.
Typically you can have up to 32 devices on a RS485 network. Each device is just a micro ie budget Arduino and can have numerous inputs and outputs. Say 8 inputs and 8 outputs, thats 256 inputs and 256 outputs.
Neil.

Arduino with Ethernet looks good but it is not plug and play product. If someone will share a simple and reliable ‘web relay’ example I will definitely give it a try. Waiting for the shield right now.

RS485 was on my list from the very beginning, using just wires instead of LAN infrastructure is a big advantage.
At the same time I’ve got a feeling that the corresponding openHAB binding is not that good at the moment, so I’m now considering HTTP over Ethernet as the main control approach for my future installation.

I guess you are not understanding my meaning.
I’m not talking about OH to RS485 binding.
OH…MQTT. …to Arduino. …then to RS485.

Ohh, I see now. Thank you for pointing this out.
OH talks MQTT to Arduino - over Ethernet, right? This means RS485 gives no value to me. I don’t need go further that this Arduino, I just want to control it’s GPIO from OH. If I will get another remote location - I will simply reproduce exactly the same setup - OH–LAN–Arduino, I see no reason to daisy chain multiple Arduinos over RS485 (beside the cost ov Ethernet shield vs. RS485 adapter).
Adding MQTT looks like an additional level of complexity and extra piece of software (broker), I would prefer a simple HTTP.
Anyway, I appreciate you comments, please let me know if I’m missing something.

Hi Andrew!

You’re right, currently the focus was on wireless solutions but this changes with the version 2.0 that is currently under development.

What you need is a MySensors gateway that has actuators but no wireless module attached. What you get is an Arduino connected via Ethernet that speaks the MySensors protocol and therefore are able to use an binding.

Combining the sketches is easier in the development version than before.

Take what is needed from:

Gateway for Wiznet 5100 Ethernet module:
https://github.com/mysensors/Arduino/tree/development/libraries/MySensors/examples/GatewayW5100

and

RelayActuator Example:
https://github.com/mysensors/Arduino/tree/development/libraries/MySensors/examples/RelayActuator

and remove everything not needed for example NRF24L01+ and so on.

Hardware needed:

  • Arduino (Uno or Nano will do)
  • Wiznet 5100 module for Ethernet
  • Relays :slightly_smiling:

The sketch would look something like this (copy & pasted, compiles but not tested):

If you’re using OH2 the development version of the binding is here:

OH 1.8 binding:

1 Like

Thanks a lot, Tim. I’ve got ENC28J60 shield and will try to test what you suggested. I already found a Gateway sketch for that module.

Andrew

Hi Tim

Just noticed (for 1.8 binding):
Features
Serial Gateway supported Only

Not Working
Ethernet Gateway (not implemented)

It seems I should either use serial or upgrade to OH 2.0 - right?

Thanks
Andrew

Hi Andrew!

Yeah, you’re right. :-/
It is possible to use the generic serial binding and rules.

Greetings
Tim

OK, have OH2 installed on Windows laptop.

Configuration:
mysensors:bridge-ser:gateway [ serialPort=“COM10”, sendDelay=200 ] {
light light01 [ nodeId=“172”, childId=“2” ]
}

Getting the error:
openhab> Failed to connect on port: COM10 exception:
gnu.io.NoSuchPortException

COM10 is working for sure as I used it to communicate with Arduino. Should I use different syntax or lower the port number?

Thanks!

Did you close the serial monitor from the arduino IDE? Maybe it’s blocking?

The configuration looks good. I haven’t tested the binding with Windows yet, but I don’t see a reason why it shouldn’t work.

Changed to COM2, reconnected, tested from the terminal - all good, no errors in OH2 too.
Please advise about nodeId and childId. As I recall it was suggested somewhere that this should be visible in the console, as binding will assign them automatically. I don’t see anything :slightly_smiling:

Are you using serial or ethernet gateway? I’m confused. :smiley:
Because if you’re using ethernet gateway, you need to specify ipAdress and port instead of the serial port and that would explain why you’re able to connect via serial but don’t see anything.

The nodeId is “0” and the childId depends on your sketch, probably “0” for the first child.

I’m testing serial gw as I don’t have an ethernet shield yet.
It seems to be working now, the issue was with ‘bridge’ before "mysensors:bridge-ser:gateway"
BTW, childid is starting from 1.

Thank you, Tim!

Ethernet gateway works as well. My understanding that ACK is not working as it should and should not be used - right?
Thanks to Tom, I’m now not that skeptic about Arduino for remote node as before :slightly_smiling:

I’m glad it is working for you.
The ACK feature of the binding does not work yet as it should. I’m working on it.

Currently we can’t use ACK with actuators directly attached to the gateway. The gateway won’t respond these ACK requests. I’m not sure if this is intended behaviour of the library or not, but my serial gw with relays attached doesn’t respond to ACK requests.