Do you need remote site control ? even home control. Web relay solutions

I know a lot of you have some pretty far remotes that hardly see a human.
This may be for you if you have not managed methods to this point.

I have been using remote control through asterisk for more than a decade and at the point where I was expanding and wanted to update everything to what is more commonly available and on the cheap if allowed. I like my controls to be the same every location and have extras in case of failure.

So I thought I would outline what I decided and implemented on if it helps others in need.
I found it easier to use something network based for simplification of control not necessarily where the server was, even though I was controlling them from the servers. I could also issue direct command on the web by port/routing them.


On the top you will see a 16 relay board
I believe I paid about $15us ea on ebay for them. I think it can be found on Amazon as well.
Hardly worth my time to buy individual relays and ‘build’, even if I only need 3 relays.
This board is 5vdc and you might want 2-2.5 amp supply if you think you might use all 16 at once.
The relays can handle a 10 amp load so they can do serious work. But I think I would use something heavier if past 7 amp continuous.

Now to control the relays…

The board on the left is a updated wireless ESP32-s with a itx external ant connection that can be connected to your nearby wireless router for network connection. (I show it connected to a rpSMA pigtail)
Find the board by searching for WIFI MODULE ESP32 RELAY DRIVER
All the work on this module was done by Tasmota and the instruction for this is on their web.
The board will plug directly into the relay board without any wiring except for 5vdc power to the relay board.
This can be programmed with a simple serial FTDI FT232 device at 5v with only power rx & tx lines (must be swapped rx>tx & tx>rx to device set at 5vdc and write enable pins jumpered)
See their web for all the goop Tasmota Documentation - Tasmota
Apply the relay template you get from here
MTools 16 Channel ESP32 Relay Driver 5V DC Module Configuration for Tasmota

The board on bottom right is hard wired Ethernet.
Labeled HW 584 and note you will absolutely need the ‘version 2’
Find the board by searching for ENC28J60 relay module on ebay

This board will need it’s default firmware changed. It’s terrible as I found.
While I was considering tackling that myself, I found I didn’t need to. Someone else already did.

You may need to do some soldering here for pin headers and note that the pins do not perfectly align with the relay board for relay ‘number’. But the power and ground are the same 5vdc on the far pins at each end. I think if you remove the power connector on the network board, it will mount-up but the relay number and pin numbers will by off in order. But I did not try this. Wires are OK.
Trying to keep things the same and simple.

Instruction on this board is here-

how2 video from author (watch it all before you start as there is one part misordered)

For programming this, you will also need a similar device, STM32 also available on ebay for about $10 or less. I had a hunch I could use something else but did not want to chance it.

I might also point out that the author of the firmware revision also included readable inputs and Dallas 18B20 digital temperature units as well. So, you can script actions if you read the inputs periodically.

Now if you decide on one of these or both and you want a dialplan and shell scripts for control within asterisk/app_rpt/allstar let me know. Simple ‘cmd relay# on/off’
But with scripting, you can sequence timed multiple events with a command of its own.
I am still working on some of the input checking/scripting for asterisk for my locations.

I am hoping to help a few of you through so you get it and can help others do the same.
Hopefully we can solve common questions right here if you have any.

It’s a nice control set-up for at or under $50
I am using one setup (of 8) to start a diesel welder/generator sequencing the ignition glow plugs and starter when my solar controller says my batteries are low. Just one idea of use if you use your imagination. All made better with the app_rpt/asterisk interface.

You can also do a hard reset of power to your remote allstar node as long as you have internet.

Control fans based on temperature and know the status of your stuff online or by a query command.
All dependent on your needs and how you program it.

A word of caution… do not control sensitive items if your app_rpt/asterisk interface is not stable running.

Where there is a need… there is control !

Fascinating. Do you have a BOM (links would be ok…) of the boards? I can think of a long number of use cases in my shack this would be useful for (since I op remote from MA to PA half the time…): building an antenna switch…controlling an HF SS amp, shutting down cleanly my raspberry (using the shutdown circuit that is detailed on Doug’s site) with a contact closure…the uses are almost endless…:wink:

Thanks for detailing this…and for your effort!

73 de wb0yle/w2fuv

Been a while since I chatted with you OM,
(remember lincoln highway link-up?) LOL Thanks for your help on that project 8 years ago !

The best data on the Hard Wired net board was done by the Nielson fella that re-wrote the firmware.
The lack of original data on the board is just a Asian story I will not speak to here. But I have got use to it.
Here is his manual for the updated firmware and how it works type data.
https://github.com/nielsonm236/NetMod-ServerApp/releases/download/20210821.1541/Network.Module.Manual.-.Code.Rev.20210821.1541.pdf
And watch the video above.
I use the browser only version, I have no mqtt stuff. Each allow http commands I believe.

After the re-program and setup ports etc, I never use the web gui on these.
I use http strings to change or check the status in scripts. or manually for debugging.

Now the Tasmota board was evidently made just for these type purposes, with developers in mind.
Scour through their website and you will understand.

The firmware you need to load is ‘tasmota32’ and then load the template linked above in the web gui.
It just basically makes all the outputs a relay control.(preconfig)
All of this can be reconfigured, but it’s too much for me to tackle explaining all of that here.
You would need to read the data from the tasmota site.
But here is a link to the commands for it.

It too has control via http, so you don’t have to visit the web gui to use. But you can. Ideal for scripting.
But because the format to issue commands to it contain spaces,
you need to insert %20 for that space in the URL
In the web gui, there is a local console as well for those that want to make config changes without going to firmware or http commands. Very nice.

As many interfaces I have built for such things, never has any been so easy and cheap as this.
And did I mention ‘versatile’ ?

best ham tools since copper wire !

I thought I might provide a little update on the Tasmota module programming.
I recently found that they have a web interface for programming the module online.
This would skinny many of the steps for most of you. No need to build the loader.
Plug-in your FTDI attached properly to the board with write jumper on and use the web page to program from local com port.
Any errors, just remove the ftdi and refresh web page, plug ftdi back in. But do wait for it to finish.

Use this web address:
https://arendst.github.io/Tasmota-firmware/

Notes:
Know your com port before you start.
Does not work with Firefox for me. I’m fairly sure it is because of security issues.
Microsoft Edge works fine.
I’m guessing Google Chrome will work as well in both Win and Linux flavors. But I don’t use it.
Perhaps someone will chime in and verify.

And here I will post the template for the relay gpio functions (loaded internally after programming)

{"NAME":"16ch Board","GPIO":[1,1,237,1,232,1,1,1,228,231,1,1,233,230,234,235,0,238,239,236,0,224,227,226,0,0,0,0,229,225,1,1,1,0,0,1],"FLAG":0,"BASE":1}

Which was obtained here

here is a example dialplan and shell script for the tasmota device you can build from for your own particular instance…

This method uses my infamous dialplan ‘phonepatch fudge’ by making a new/extra phonepatch command with a targeted ‘context’ set in rpt.conf to allow extra dtmf digits to be passed along in a continuous string.

65=autopatchup,context=relayctl,noct=1,farenddisconnect=1,dialtime=90000,quiet=1

going to extensions.conf… the dialplan stanza is context [relayctl]

[relayctl]
; trapping out the erroneous and sending correct numbers to relay bash script only

; read relays
exten=_X*,1,Wait,1
exten=_X*,n,SayAlpha(readw${EXTEN:0:1})
exten=_X*,n,Wait,1
exten=_X*,n,Set(stat=${curl(http://192.168.1.11/cm?cmnd=Power${EXTEN:0:1})})
exten=_X*,n,SayAlpha($stat)
exten=_X*,n,Hangup

exten=[01]X*,1,Wait,1
exten=
[01]X*,n,SayAlpha(readw${EXTEN:0:2})
exten=_X*,n,Wait,1
exten=_X*,n,Set(stat=${curl(http://192.168.1.11/cm?cmnd=Power${EXTEN:0:2})})
exten=_X*,n,SayAlpha($stat)
exten=_X*,n,Hangup

; set relays
exten=_X[01],1,Wait,1
exten=_X[01],n,SayAlpha(rw${EXTEN:0:1}${EXTEN:-1})
exten=_X[01],n,Wait,4
exten=_X[01],n,System(/etc/asterisk/myscripts/relayctl1.sh ${EXTEN:0:1} ${EXTEN:-1})
exten=_X[01],n,Hangup

exten=[01]X[01],1,Wait,1
exten=
[01]X[01],n,SayAlpha(rw${EXTEN:0:2}${EXTEN:-1})
exten=[01]X[01],n,Wait,4
exten=
[01]X[01],n,System(/etc/asterisk/myscripts/relayctl1.sh ${EXTEN:0:2} ${EXTEN:-1})
exten=_[01]X[01],n,Hangup

exten=_X.,1,Playback(error-number)
exten=_X.,n,SayAlpha(${EXTEN})
exten=_X.,n,Hangup

The dialplan calls a shell script that you may need to change the name/location of above,
but it contains the following (don’t forget to set owner/permissions of the file)

#!/bin/bash

curl “http://192.168.1.11/cm?cmnd=Power$1%20$2

exit

If you wanted to roll your own and forego the small script.
You can also directly put that line in the dialplan.
But replace $1 with the switch number 01-16 and $2 with 0/1 for off and on.
I was going to show this with input reads as well but did not get that far for examples.

Shell Execution:
It takes 2 parameters in execution. The relay number (1-16) and (1/0) 1 for on or 0 for off

You should notice that in the dialplan as well.
You will need to adjust the static ip address to match your own settings in both items.
It would be true that I may have been able to do the same strictly from the dialplan… I had my reasons.
Mainly that I use the shell script calls from many other resources outside of aterisk. You could as well.

This is just an example for you to work from. Build a better one and post it !

oh…
from dtmf execution,
you would need to use the following based on the example above…

*65 + (1-16) + (1/0)
(our command prefix) +(relay number)+(on/off)