fredilarsen / ModuleInterface

Easy config and value sync between IoT modules, database and web pages
Other
70 stars 12 forks source link

Oversampling strategy for wireless devices/modules #2

Closed jistathought closed 6 years ago

jistathought commented 6 years ago

Hi there, Just looking at what you've created here and it meets all my requirements for a project I have for a freind, bar the fact that I would like to be pushing distances of up to several kilometers. Unfortunately that range is difficult to achieve with any wifi connections and ESP8266's but it is easily obtained with the new LoRa radio modules.

However BitBashSoftware is not suitable for this and really I need to be using OS (Over Sampling) which of course you would already know.

Being a tottering beginner in the world of IOT/Ardiuno etc, despite a background of PLC's etc, I thought I would ask if you were looking to add that support in the future and if not maybe give some pointers as to what would be required to make this system work with the OS Strategy?

Again I must say I am impressed by the simple design and structure you have used to build this. I do not obviously have the knowledge/skill and mainly experience to put it together so well. And of course PJON needs a BIG pat on the back too.

thanks for your time and knowledge...

fredilarsen commented 6 years ago

Hi,

The Link class is used for being able to use any PJON strategy, including Oversampling. So in any example, just replace PJONLink<SoftwareBitBang> with PJONLink<OverSampling> or PJONLink<ThroughLoRa>.

The ASK modules supported by OverSampling can also reach far, gioblu says about 5km with line of sight with the good quality stx/srx882 modules. But I suppose LoRa is a safer bet with longer distances.

I have focused testing and examples on local setups (not using PJON bus ids) so far, to minimize packet sizes. But if you are depending on using a bus id to avoid mixing wireless packets with the neighbors, this should work as well, just set the bus id on the PJON bus that is available as a member of the PJONLink. I will set up a case using bus ids to verify that this is working fine, and will report back here when I have tested.

I am working on a MultiLink which allows a master to talk to devices spread on multiple buses or media, so you can have some devices connected with a wire using SWBB and some via OS or LoRa, and some via Ethernet or WiFi etc. The same can also be currently obtained by adding routers to the one bus connected to the ModuleInterface master. See the new Switch/Router functionality I contributed to PJON master recently.

Thanks for good feedback.

fredilarsen commented 6 years ago

I found a couple of issues with using bus ids, so I suggest you start out in local mode (just device ids, no bus ids). That should work fine. Which of the relevant PJON strategies you use does not really matter.

I will continue testing setups using bus ids, and push changes as soon as I am content.

I also ordered some LoRa modules so I can verify that everything works as designed with the PJON ThroughLoRa strategy which I have not tested yet :-) It may take some weeks before they arrive.

fredilarsen commented 6 years ago

I am closing this issue, as support for all PJON strategies is in place.

I will fix the issues with the bus id support, but everything should work fine in local mode even with segmented buses through a switch or router.

I also aim to add an example with a group of SWBB connected devices connected through a LoRa router. I have no time schedule for this, but it can be set up quite easily with existing functionality.

Do not hesitate to add more issues. I hope you find this project useful. I am also available as @fredilarsen on gitter.

fredilarsen commented 6 years ago

I have completed testing of the use of bus ids. If you want to use bus ids you will ned to use Master, or v2.2 when released.

jistathought commented 6 years ago

Excellent. I have just done some more research and have discovered that there is a possibility of using ssl on the new esp32 chip with new arduino core for esp32.

There is a new library on it called embedssl I think or similar and allows you to encrypt http connections. So I'm thinking that it would allow the http link from the master to the web server to be encrypted to secure that link properly.

I don't have an ESP32 so I am looking to get my hands on one. Olimex have a nice ESP32 gateway board with a wired connection rather than wifi connection.

On the note of security I had a bit of look and it seems to me that all communication is initiated from the master end and the web server just waits for those connections. Therefore a gateway can sit behind a firewall with no port forwarding required for communication. This would allow a cloud based web server to be used like a digital ocean droplet or similar. Is my surmising correct or is things a little more involved? Excellent. I have just done some more research and have discovered that there is a possibility of using ssl on the new esp32 chip with new arduino core for esp32. There is a new library on it called embedssl I think or similar and allows you to encrypt http connections. So I'm thinking that it would allow the http link from the master to the web server to be encrypted to secure that link properly. I don't have an ESP32 so I am looking to get my hands on one. Olimex have a nice ESP32 gateway board with a wired connection rather than wifi connection. On the note of security I had a bit of look and it seems to me that all communication is initiated from the master end and the web server just waits for those connections. Therefore a gateway can sit behind a firewall with no port forwarding required for communication. This would allow a cloud based web server to be used like a digital ocean droplet or similar.Is my surmising correct or is things a little more involved?