Notifications
Clear all

Wirelessly transport serial data stream via WIFI LAN

66 Posts
7 Users
1 Likes
3,224 Views
(@franktbrady)
Member
Joined: 3 years ago
Posts: 33
Topic starter  

@byron

The reason I'm trying to "tack on" the wireless aspect to my existing wired solution is that the existing solution has built in low latency because a single command can close/open multiple switches.

Thanks


   
ReplyQuote
(@franktbrady)
Member
Joined: 3 years ago
Posts: 33
Topic starter  

@byron

The "rub" with all of the smart relays I've reviewed is that they all have their own command schemes - I haven't seen a practical way I can substitute my command switches for their command origination schemes.  I'm stuck with my existing command origination scheme (my switches).

Thanks


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 
Posted by: @franktbrady

low latency

You don't specify low latency in terms of milliseconds, but in human terms one does not notice any latency in the operation of the relays as long as your home network is operating OK, but you would need your network to work well with whatever solution you use.  Operating these relays from an internet connection is another story of course.

I have a setup where I can press an 'override button' on a gui screen which triggers an mqtt message to switch a shelly relay that turns a light on or off (its a test rig and the light substitutes for switching a heating boiler on or off).  Anyway I do not notice any difference in switching lights on and off from a house light switch compared to clicking the button switch.  

To set the shelly up to work one connects to it from a web browser, its really simple to do.  Apart from my 'clever 😎 ' bit of gui button stuff, I also downloaded the shelly app on my iPad which also shows a button that is pared to the shelly relay and this too works with no noticeable lag.  The app also makes it possible to group buttons (multiple shelly's) together to switch all connected shelly's on simultaneously. Likewise a grouping could also be programmed into one own gui and of course one could also use mechanical buttons as a trigger as well.   

Bottom line, no noticeable latency, can be easily set up with no programming - just configuration and using an app, or one can get clever and construct a program with a lot of lovely logic to do whatever.

Anyway I hope you find a good solution and I'm sure theres plenty of other way to achieve what you want with you existing setup too. 😀 

This post was modified 3 years ago by byron

   
ReplyQuote
(@franktbrady)
Member
Joined: 3 years ago
Posts: 33
Topic starter  

@byron

Hi - thanks for the post - the toughest part about this project research is finding someone to talk to.

Essentially, the only latency for my current command vs action is the serial transmission time of a couple of command characters from the PC USB-Serial port at 19.2 baud rate.  A single command transmission to my relay controller board opens/closes 8 controller board output switches simultaneously.  Those 8 switches connect or break a 12 vdc supply to 8 RF switching relay coils.

If I understand your suggestion, I would replace my USB-Serial port cable and the relay control driver board with 8 smart relays.  I would also replace the PC VB.NET Visual Basic application code that sends the relay control commands with new code that controls the smart relays.

That is a lot of modification and I don't know what the "new code" portion is and whether or not my application can execute the "new code".

Is that a fair translation of your suggestion?

Frank

 


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 
Posted by: @franktbrady

Is that a fair translation of your suggestion

Yes, thats summarises it well.  The smart relay that I'm using (a shelly 1) can be sent commands over wifi in one of 2 ways, either mqtt messages or http messages (the shelly is a little web server).   So if you were to use your existing VB program you would have to send mqtt messages or http messages so I guess you would have to find a library for one of these options that you could use from VB.  

The mqtt option would also need an mqtt broker program to run somewhere on your network, though this could also be on the same computer where you run your VB from and this is usually just a matter of downloading and then running the broker program.  I have brokers running on linux an a mac computer, but not on a PC, though there should not be any problem.

However HTTP messages may be the best option to consider.  Its been many a year since I played with good old VB but I'm sure that  it would be easy to send http 'post' messages. (in fact a quick google finds a few examples).  So this may be the easiest option for you to consider.   

If it was me, I would get hold of a single shelly or sonoff (having read the info to see which may best suit your particular needs) and have a play.  If is doesn't work out for you then not much is lost and you could repurpose the relay to switch on an outside light from you smartphone (or even donate it to me 😀).  I liked the shelly 1 so much that when I played with one I got a few more for future projects.  If you were in the UK I would send you one to try.  


   
ReplyQuote
(@franktbrady)
Member
Joined: 3 years ago
Posts: 33
Topic starter  

@byron

When you have time, could you send me a blurb describing what, exactly happens when I "send mqtt messages or http messages"?  My app sends all kinds of http URLs to the local browser to read data from a web site.  Is that how the mqtt/http messages are sent in your scheme?  Is the "broker" code the destination for those messages?  There are lots of things I do all the time without really understanding how they are processed.

Thanks, Frank


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@franktbrady

The simplest way to show the commands is to explain what I would put into the address line of my browser to send a command to the shelly 1

The shelly, like your computer or other devices you connect to your network, will be assigned a unique network address usually something like 192.168.1.51 or whatever.   You will need to know what ip address your shelly 1 gets assigned to (a lan scanner of some sort, though I think the shelly makes this easy to find another way, I cant remember just now).  Usually you want the same address to be allocated to your shelly relay each time the network starts up and you can configure this in your router.

In my case my shelly has an ip address of 10.0.1.68.  So to switch the relay on or off I can type the following into the address line of my browser

http://10.0.1.63/relay/0?turn=on

http://10.0.1.63/relay/0?turn=off

http://10.0.1.63/relay/0?turn=toggle

Now how you send these http commands from VB you will have to find out, although it seems you may already be doing this sort of thing.   If I was doing this in Python I would be using the Requests library.

The only thing you have to do in setting up your shelly is to use your browser to connect to it via its  Access Point with a given IP address, enter the details of your home network, and take it out of its Access Point mode.

And if you want to delve in deep here is a link to the shelly documentation.

https://shelly-api-docs.shelly.cloud/?shell#shelly1-1pm-relay-0

 


   
ReplyQuote
(@franktbrady)
Member
Joined: 3 years ago
Posts: 33
Topic starter  

@byron

Thanks very much for that - especially the shelly doc link.  The only thing I still don't have a handle on is the "broker" app.  Or maybe that's explained in the shelly doc.

tks agn, Frank


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 
Posted by: @franktbrady

The only thing I still don't have a handle on is the "broker" app

The broker app is applicable if you choose to communicate with the shelly via MQTT.   I suggest you forget about the mqtt option for now and just go with the option of communicating via HTTP as in the example I just gave. 

I fear I may have confused this issue a bit by waffling on about the 2 different methods of communicating with the shelly, where it is now clearer to me that the HTTP is the one most suitable for your setup. So no brokers to worry about 😎 !


   
ReplyQuote
(@franktbrady)
Member
Joined: 3 years ago
Posts: 33
Topic starter  

@byron

YAY ! I just submitted my order for one Shelly1  $18.81


   
ReplyQuote
(@franktbrady)
Member
Joined: 3 years ago
Posts: 33
Topic starter  

@byron

I ordered a shelly 1 and today I received a Shelly 1PM I don't know if they are interchangeable bit I am confused about what powers the device?  I am going to be switching 12vdc to my corresponding RF relay coil.  From what I see so far there is no power supplied to the shelly 1pm circuitry.  Is it passive (no power required)?

Sorry I'm not up to speed yet.

Frank


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 
Posted by: @franktbrady

I ordered a shelly 1 and today I received a Shelly 1PM

I think you will have to return the Shelly 1PM sent in error.  I just had a look at the manual for this and it states power requirements of 110 - 240 volts AC or 24 - 60 volts DC. (it also has power monitoring facilities).

The Shelly 1 power requirements are 110 - 240 volts AC / 12V DC / 30 - 50 volts DC.  A jumper setting selects the voltage.   So as you are looking to control 12 volts it seems you will need the Shelly1 you ordered and the Shelly1PM will not be any good for you.  

I attach a pdf file of the manual for the Shelly1.

I also give you a link to the uk shop where I get my shelly's from, and you can download the manuals for the various options from that site.

https://shellystore.co.uk/shop

 


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@franktbrady

When you get your replacement and get a Shelly1 you connect your 12v battery (assuming a battery power supply) to the (+) and (-) of the Shelly1 as indicated in the diagram in the manual.   Your load will be connected as follows.  The (-) direct to the (-) of your battery and the + to the Shelly1(0) connection.  The Shelly1(1) connection is then also is connected to the (+) of your battery.

Then with commands via http your Shelly1 will switch on to allow volts to flow from the (0) and (1) connections.   In addition you can wire up a manual switch with a connection between the (+) connection on your Shelly1 and the SW connection which will enable you to manually switch to power to your load as well as switching it with the http commands.

Have fun 😀 


   
ReplyQuote
(@franktbrady)
Member
Joined: 3 years ago
Posts: 33
Topic starter  

@byron

Ahh - so it IS powered by the switched load source power.  I assumed that, but it didn't make sense with the wrong device.  I'll return it for what I ordered.

Thanks  - I hope you don't mind if I have further question when I get the right shelly - I don't see the wifi configuration steps in windows 10 - I'm going to be asking others first, I just don't want to lose you as a source.

Frank


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@franktbrady

Hi Frank, feel free ask further questions.  The way to configure the shelly is with a browser so it should not make any difference whether your computer is a windows 10 PC, a Mac or a Linux computer.  So the theory goes 😎.  

When its first powered up is creates a wireless Access Point so you will need to connect your computer to the access point called Shelly1-xxxx where xxxx is its serial number.  You should be able to pick it up if you scan for all the networks your computer can connect to, and you will have to temporarily connect to the shelly instead of your normal router to do the configuration telling the shelly what your normal network SID and PW is. 

This post was modified 3 years ago by byron

   
ReplyQuote
Page 2 / 5