Very simple remote control over ethernet

I would like to do the following:

Have say, 2 modules that are both connected to a network over ethernet (This must use ethernet, NOT wifi - this is important). I can flip a switch connected to one module, and this will activate a relay on the other module. OR, can activate the relay module from my computer.

This must be done strictly over LAN, not using internet in any way.

Any ideas?

If there is already a hobby-level* device that does this, I would be interested in that, but if not, please suggest how to build using Arduino or similar.

Would something like this accomplish what I need?

Amazon.com (I have no idea what this does, but appears maybe like it could be something I want for this)

*There are devices out there, but they are industrial level, have much more functionality, and are very expensive. There are cheap IoT devices for this, but all that I have seen use WIFI, not ethernet.

You can use ordinary Arduino, like Uno/Nano V3, and add Ethernet shields/modules to them.

Then write code to make one of them a Server to control the relay and the other a Client to read the switch and send any changes to the Server. Your computer can also act as a Client and send changes to the Server.

You can use HTTP protocol for the communications between them. You will need to get your Router to assign a fixed IP address to the Server.



Interesting find, I will add it to my wishlist. :). I downloaded a support package from here : OpenHacks | Open Source Hardware | Productos | LAN Ethernet 2 Channel Relay Board Delay Switch TCP UDP Controller Module

There is a very brief manual, applications and source for VB/Delphi.

It appears the module supports TCP and UDP connections, and is controlled by a 2 character text string. This should be very simple to control via either a PC, or an Arduino with an ethernet shield.

As far as I can tell, it can operate in a standalone mode without requiring internet access.

Of course, you could roll your own without much difficulty, but as an off the shelf product it is quite neat.

1 Like

@bobcousins Thanks, that helps a lot. BTW, much cheaper version through Ali-express: https://www.aliexpress.us/item/3256807660447383.html

(Weird, I tried to use a quoted reply, but it didn't include the quote.)

Assuming it is the same board (appears to be known as "SR-201") there is a write up of protocol at Switch commands · cryxli/sr201 Wiki · GitHub

1 Like

@bobcousins Knowing the SR-201 designation is quite helpful. Searching SR-201 brings up a plethora of information. It looks quite promising for my application, I have ordered one to check it out.

Here is a pretty good reference on the SR-201

My guess is that product will probably do what you need, but the gamble is how good is the documentation and will it take a month to get working.

If I were in a hurry, I'd get a Raspberry Pi Zero and a relay and go from there...

The Raspberry Pi Zero does not have an Ethernet interface.

Simplest communication protocol is called UDP, I've only used it over WiFi but it should be the same over ethernet. Get a couple of ethernet shields and try the UDP examples in the library.

Note UDP allows you send and receive data, what you use it for is for you to write code for.

With the available documentation, you could probably have it working in 30 minutes.

Huh. I thought it did. Wonder what i confused it with.

Gotta be careful with UDP though. Its not guaranteed to get to the destination. I've run into network configurations where UDP packet loss was a serious problem.

If the network is losing a lot of packets then I'd think there's something wrong with the network. Certainly something would need to be investigated.

Usually what happens is that the network prioritizes TCP because those packets must get through. If a switch or router needs to drop packets to maintain throughput then it will start by dropping UDP, especially broadcast or multicast.

A similar problem is that multicast (IIRC) UDP cant cross subnets so parts of the network might never see the packets at all.

I've seen this at enough locations to never use UDP for anything important.

I'm not sure there is really any reason to use UDP instead of TCP, in an end user application. UDP is connectionless, so perhaps it seems easier than dealing with a dropped TCP connection, but you then have to add all the features that TCP provides if you want a reliable transfer. It might seem like a simpler option, but not really.

1 Like

Yep. UDP multicast works really well when you just want to blast out a stream of packets to any interested party but don't really care if your message makes it there. It works fairly well as a one-sender-to-multiple-listeners solution as long as you're aware of the drawbacks.

I once had to deal with a system that did software updates over UDP and it was a royal pain in the a**

UDP is used for real time applications such as VoIP, where there is no point in requesting resending a lost packet because it's too late.

VoIP utilises the human layer for detecting packet loss and requesting retransmission.

A : The problem is in the *bzzzt hiss pop silence
...
B : sorry, you dropped out, can you say that again?

So people do often consider there is a point to requesting lost data and that it is not too late; either way this method only really works if you have humans in the loop. If you are doing remote machine control, that does not apply.

1 Like

Here is a list of useful links for the SR-201:

Most useful for *nix, includes Python and Perl scripts:

GitHub - cryxli/sr201: Protocol example for SR-201 Series network relay ___

Direct link to switch commands from above repo (@bobcousins posted this):

Switch commands · cryxli/sr201 Wiki · GitHub ___

Direct link to Python and Perl scripts from above repo:

sr201/scripts at master · cryxli/sr201 · GitHub ___

Nodejs module:

GitHub - dresende/node-sr201: NodeJS SR-201 Network Relay control ___

MQTT:

GitHub - andrewjstringer/sr201-mqtt at dev ___

Also, it appears that most vendors offer a download for Windows which include an .exe to control and configure the board, along with good documentation.