Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. Concept of a flexible but simple smart network

Concept of a flexible but simple smart network

Scheduled Pinned Locked Moved General Discussion
25 Posts 6 Posters 4.3k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gohanG Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #3

    That resembles pretty much computers' network stack, am I wrong?

    1 Reply Last reply
    0
    • axillentA Offline
      axillentA Offline
      axillent
      Mod
      wrote on last edited by axillent
      #4

      in details it is very different but by the idea it looks like TCP/IP stack
      Also by addressing, I assume 16 bit global address allows you to address any devices on the same network or other network through bridge or router. And there is no any requirement to have a controller. Devices are able to communicated directly. Controller is a device able to manage network config.uration by assigning ID's (very similar to DHCP). But. ID can be assigned manually and it is also possible to run ID-less configuration by using local or global broadcasts. For example wall switch can be configured to send Scene ID to LightScene brodcast address, and any lighting devices can receive this by brodcast and be activated based on scene ID instead of network address.
      Just to illustrate idea in more details I have other picture
      0_1509723823794_swi_network_types.jpg

      sense and drive

      1 Reply Last reply
      2
      • axillentA Offline
        axillentA Offline
        axillent
        Mod
        wrote on last edited by
        #5

        based on this concept I make a text based console which is actually Super Application, application one is 3 wire physical interface with manchester encoding, application 2 is UART console connected to VT220 terminal. Super Application bridges to networks together. By adding Broadcast with accept to All messages broadcast I allow Bridge to pass all the messages between two networks

        // --- bridge application
        typedef Application::Bridge<msg_type, w3p_appl, uart_appl>						bridge_appl;
        
        
        //------------------------------------------------------------------------------
        // Variables
        //------------------------------------------------------------------------------
        
        //------------------------------------------------------------------------------
        // Main
        //------------------------------------------------------------------------------
        int main()
        {
        
          mcu::Init();
        
          ep_id::SetDefault(Message::ID(THIS_NET_SEGMENT_ID));
          ep_key::Set();
        
          bridge_appl::Init();
        
          timer::Start();
          led2.Set();
        
          mcu::InterruptEnable();
        
          uart_transl::SetID(ep_id::Get());
          uart_transl::Print("\n\n\x1b[31m--- Console v1.0 started\x1b[30m");
        
          while(1) {
        
        	bridge_appl::Loop();
            mcu::InterruptWait();
        
          }
        
        }
        

        All is plug & play. Etc. it requires NO modification of basic library to create this console. A typical session bellow:
        0_1509803641402_2017-11-04_16-48-43.png

        sense and drive

        1 Reply Last reply
        0
        • axillentA Offline
          axillentA Offline
          axillent
          Mod
          wrote on last edited by
          #6

          Not that important. But there is no stick to Arduino. It is multiplatform based thing-set. Atmel + STM8 + STM32 are supported. ESP is comming

          sense and drive

          1 Reply Last reply
          0
          • gohanG Offline
            gohanG Offline
            gohan
            Mod
            wrote on last edited by
            #7

            If you can find a way to make a "router" between different mysensors networks, you could make many people happy 😁

            dbemowskD 1 Reply Last reply
            0
            • gohanG gohan

              If you can find a way to make a "router" between different mysensors networks, you could make many people happy 😁

              dbemowskD Offline
              dbemowskD Offline
              dbemowsk
              wrote on last edited by
              #8

              @gohan Wouldn't that be handled in the bridges that he has shown in this image?
              0_1509815372555_upload-c8029759-6a17-4ce1-b04d-3f48014cbd36

              Maybe I am thinking of this wrong, but I would think of it in the sense of a MySensors gateway being the bridge or router that would translate the communication from the local computer network to the different types of devices. Instead of connecting that gateway to a controller like Vera, Domoticz or OpenHAB, it would connect to the IP network. It is basically converting the data from one transmission media such as nRF24L01 or RFM69, over to ethernet.

              Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
              Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

              1 Reply Last reply
              0
              • gohanG Offline
                gohanG Offline
                gohan
                Mod
                wrote on last edited by
                #9

                you could use bridges but you would need to have unique IDs throughout all the networks if you want nodes to talk to each other across networks, if I understood right.

                dbemowskD 1 Reply Last reply
                0
                • gohanG gohan

                  you could use bridges but you would need to have unique IDs throughout all the networks if you want nodes to talk to each other across networks, if I understood right.

                  dbemowskD Offline
                  dbemowskD Offline
                  dbemowsk
                  wrote on last edited by
                  #10

                  @gohan Wouldn't you need that anyway? How else would you address a node?

                  Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                  Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                  1 Reply Last reply
                  0
                  • axillentA Offline
                    axillentA Offline
                    axillent
                    Mod
                    wrote on last edited by
                    #11

                    yes, to address devices across different network segments you need a global ID
                    but there is a trick... Please see the first picture. It is a layer called Translator.
                    it is possible to translate non-global ID to global and back and this will allow to create a bridge

                    sense and drive

                    dbemowskD 1 Reply Last reply
                    0
                    • axillentA axillent

                      yes, to address devices across different network segments you need a global ID
                      but there is a trick... Please see the first picture. It is a layer called Translator.
                      it is possible to translate non-global ID to global and back and this will allow to create a bridge

                      dbemowskD Offline
                      dbemowskD Offline
                      dbemowsk
                      wrote on last edited by
                      #12

                      @axillent Isn't that in a sense a broad definition of what a bridge does? Translating information between two different types of networks.

                      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                      axillentA 1 Reply Last reply
                      0
                      • dbemowskD dbemowsk

                        @axillent Isn't that in a sense a broad definition of what a bridge does? Translating information between two different types of networks.

                        axillentA Offline
                        axillentA Offline
                        axillent
                        Mod
                        wrote on last edited by
                        #13

                        @dbemowsk each layer does it's job
                        bridge just creates a bridge
                        will it do a translation between depends on translation layer
                        translation job can be about translation of address or translation of data form or even both
                        all this depends on the goal but brings wide flexibility

                        sense and drive

                        1 Reply Last reply
                        0
                        • axillentA Offline
                          axillentA Offline
                          axillent
                          Mod
                          wrote on last edited by axillent
                          #14

                          some more details about addressing

                          0_1536409602976_7a19d573-f5ea-45c6-9a10-1ce2bba4bd14-изображение.png

                          global adress is 16 bit number. 12 most significant bits are defining network segment number while 4 less significant bits are providing nodeID

                          section 0xFE00-0xFEFF is reserved for local broadcasting, 0xFF00-0xFFFF - for global broadcasts. Etc. 256 broadcasts of each type

                          segments and differenciation between local and global broadcasts are needed for efficient support of bridging and routing.

                          bridging is a simplified version of routing. bridging is connecting network segments on different physycal inrterfaces while routing can assume to bypass many physical interfaces between (routing throuth).
                          one of the bridge example is a link between wired interface and MQTT.
                          one of the routing example is a link between 2 wired interfaces across public Internet

                          each network segment can have 15 nodes. nodeID = 0 is a special local segment broadcast addressing all devices in segment.

                          each physical interface can have several segments, etc. there is no limitation to have 15 nodes on physical interface. you just add as many segments to interface as you need to have devices

                          sense and drive

                          1 Reply Last reply
                          0
                          • alowhumA Offline
                            alowhumA Offline
                            alowhum
                            Plugin Developer
                            wrote on last edited by
                            #15

                            Is encryption built in?

                            1 Reply Last reply
                            0
                            • Z Offline
                              Z Offline
                              Zeph
                              Hero Member
                              wrote on last edited by
                              #16

                              What is W3P? Is this some sort of CANBUS?

                              axillentA 1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                kimot
                                wrote on last edited by kimot
                                #17

                                I think your addressing concept do not respect hardware - microcontrollers and radio modules we are using.
                                Some hardware ( RFM69, serial in 9bit mode, etc. ) can filter incoming messages itself and do not disturb controller when
                                receive different address then node own ID or broadcast.
                                For example with RFM69 you can store node ID and broadcast address in radiomodule and it will receive only messages with this specific addresses.
                                But your address schema uses 4 lower bits for node ID ( 0-16 ) and lower 8 bits in all combination for broadcast too.
                                Your node must receive all 16 bits to distinguish - if it is node addressed message or broadcast call.
                                So you cannot use addressing features of our hardware.
                                I think, better is divide 16 bits to 8 bit node ID and 8 bits network ID.
                                Network filtering and routing then make gateway and distribute messages to connected nodes or other networks.

                                axillentA 1 Reply Last reply
                                0
                                • Z Zeph

                                  What is W3P? Is this some sort of CANBUS?

                                  axillentA Offline
                                  axillentA Offline
                                  axillent
                                  Mod
                                  wrote on last edited by
                                  #18

                                  @zeph yes and no. it is very very simple hardware, similar to LocoNet. allows to transfer a few kbit/sec on single wire (w3p - 3 wire VCC + Signal + GND) using 1 npn transistor + 4 resistors at absolute minimum

                                  sense and drive

                                  1 Reply Last reply
                                  0
                                  • K kimot

                                    I think your addressing concept do not respect hardware - microcontrollers and radio modules we are using.
                                    Some hardware ( RFM69, serial in 9bit mode, etc. ) can filter incoming messages itself and do not disturb controller when
                                    receive different address then node own ID or broadcast.
                                    For example with RFM69 you can store node ID and broadcast address in radiomodule and it will receive only messages with this specific addresses.
                                    But your address schema uses 4 lower bits for node ID ( 0-16 ) and lower 8 bits in all combination for broadcast too.
                                    Your node must receive all 16 bits to distinguish - if it is node addressed message or broadcast call.
                                    So you cannot use addressing features of our hardware.
                                    I think, better is divide 16 bits to 8 bit node ID and 8 bits network ID.
                                    Network filtering and routing then make gateway and distribute messages to connected nodes or other networks.

                                    axillentA Offline
                                    axillentA Offline
                                    axillent
                                    Mod
                                    wrote on last edited by
                                    #19

                                    @kimot the main idea of all my project is to manage network abstraction layer regardless hardware
                                    only translation + driver layers are hardware related, but them allow to transfer logical layer data throuth any physical hardware
                                    my 16bit addressing could be translated to addresses used by your hardware to keep handle communication based on hardware advantages.

                                    I just launched a network with translation throuth Ethernet/TCP with application server running on orangepi
                                    Working pretty well. On logical level it is always 16bit addressing with broadcasting support.
                                    developing device you should not take care how message will reach another device
                                    this is handled while developing appropriate translations/drivers on bridge side.

                                    bridge - a device connecting 2 or more different physycal layers.

                                    it is also allows to crate a building blocks.
                                    For example I'm running ESP8266 with TCP interface to network on one side and UART&JSON interface on other side
                                    attaching MCU to ESP by UART a can connect any kind of network to my network

                                    sense and drive

                                    1 Reply Last reply
                                    0
                                    • axillentA Offline
                                      axillentA Offline
                                      axillent
                                      Mod
                                      wrote on last edited by
                                      #20

                                      just to illustrate how translation is working
                                      you do not need direct logic match between abstract layer and the layer of used interface

                                      here is how translation is working between my network and MQTT broker:

                                      0_1541172446514_91ed42fc-c745-43ba-a897-c7cca1244feb-изображение.png

                                      bellow is initialization of 2 different nodes attached to 2 different interfaces, one to TCP/IP network, other to MQTT broker
                                      it is a code from linux application server

                                      //-----------------------------------------------------------------------------------------
                                      // Nodes
                                      //-----------------------------------------------------------------------------------------
                                      // --- inet
                                      typedef Smartlets::Common::RouteTableFile									RouteTable;
                                      typedef STAVRP::Linux::TCPDrv<0>											TCPDrv;
                                      typedef Smartlets::Interface::Translator::INet<Message, TCPDrv, RouteTable>	TranslINet;
                                      typedef Smartlets::Interface::P2P<Message, TranslINet, 16, 16>			InterfaceINet;
                                      typedef Smartlets::Node::NodeBasic<Message, InterfaceINet, ApplInet>		NodeINet;
                                      
                                      // --- mqtt
                                      typedef Smartlets::Interface::Translator::Mqtt<Message>				TranslMqtt;
                                      typedef Smartlets::Interface::P2P<Message, TranslMqtt, 16, 16>			InterfaceMqtt;
                                      typedef Smartlets::Node::NodeBasic<Message, InterfaceMqtt, ApplMqtt>		NodeMqtt;
                                      

                                      Inside Translator:Mqtt the following is used for example inside TX method (sending message):

                                      	static bool TX(const Message& msg) {
                                      
                                      		char key[128];
                                      
                                      		if( msg.header.tx.IsBroadcast() )
                                      			sprintf(key, "/%s/bc/o/%d/%d/%d/%d", data.swi_domain.c_str(), msg.header.tx.GetBroadcastID(), msg.header.rx.GetNetSegment(), msg.header.rx.GetNetDevID(), msg.header.type.type);
                                      		else
                                      			sprintf(key, "/%s/m/o/%d/%d/%d/%d/%d", data.swi_domain.c_str(), msg.header.tx.GetNetSegment(), msg.header.tx.GetNetDevID(), msg.header.rx.GetNetSegment(), msg.header.rx.GetNetDevID(), msg.header.type.type);
                                      
                                      		std::string	payload = json_ext::FromMessage(msg);
                                      		data.drv.TXPut(STAVRP::Linux::MqttEntry(key, payload));
                                      
                                      		return true;
                                      	}```
                                      
                                      and this is how it is finally bridged between:
                                      
                                      
                                      while(1) {
                                      
                                      	//---------------------------------------------------------------------------
                                      	// loop inet
                                      	//---------------------------------------------------------------------------
                                      	if( NodeINet::Loop() ) {
                                      
                                      		Message msg = NodeINet::RX();
                                      
                                      		Logger::root() << log4cpp::Priority::DEBUG << "inet-> tx=" << msg.header.tx.id;
                                      
                                      		NodeINet::CommitRX(false);
                                      
                                      		// --- routing
                                      		if( NodeINet::TX(msg) ) {
                                      			Logger::root() << log4cpp::Priority::DEBUG << "inet->inet TX OK";
                                      			// delayed queue
                                      		} else {
                                      			Logger::root() << log4cpp::Priority::ERROR << "inet->inet TX failed";
                                      		}
                                      
                                      		if( NodeMqtt::TX(msg) ) {
                                      			Logger::root() << log4cpp::Priority::DEBUG << "inet->mqtt TX OK";
                                      		} else {
                                      			Logger::root() << log4cpp::Priority::ERROR << "inet->mqtt TX failed";
                                      		}
                                      
                                      	}
                                      
                                      	//---------------------------------------------------------------------------
                                      	// loop mqtt
                                      	//---------------------------------------------------------------------------
                                      	if( NodeMqtt::Loop() ) {
                                      
                                      		Message msg = NodeMqtt::RX();
                                      
                                      		Logger::root() << log4cpp::Priority::DEBUG << "mqtt-> tx=" << msg.header.tx.id;
                                      
                                      		NodeMqtt::CommitRX(false);
                                      
                                      		if( NodeINet::TX(msg) ) Logger::root() << log4cpp::Priority::DEBUG << "mqtt->inet TX OK";
                                      		else Logger::root() << log4cpp::Priority::ERROR << "mqtt->inet TX failed";
                                      
                                      	}
                                      
                                      	sleep(1);
                                      
                                      }```
                                      

                                      sense and drive

                                      1 Reply Last reply
                                      0
                                      • axillentA Offline
                                        axillentA Offline
                                        axillent
                                        Mod
                                        wrote on last edited by axillent
                                        #21

                                        made a few steps forward

                                        launched ESP8266 node & bridge and STM32 bridge and TCP/IP router based on linux (orangepi)
                                        bellow is my working example
                                        list of supported platforms:

                                        • STM8S/IAR
                                        • STM32F0/Keil - draft
                                        • ATMEL/Atmel studio - draft
                                        • Arduino ESP8266
                                        • Arduino STM32
                                        • Linux/g++

                                        i;m working on 2 libs. first is to handle platform dependant things. second is platform independant smart devices network
                                        regardless platform and regardless communication hardware the framework allows to transfer messages using RX/TX notation with 16 bit global addressing.
                                        Addressing is organized as 4096 segments where 4094 are 15 node segments each and 2 segments are for broadcadsting

                                        framework allows to connect potentially absolutelly different communication hardware
                                        currently i'm running:

                                        • simple one wire (1 wire signal + 2 wire power) network
                                        • wifi based nodes
                                        • twisted pair connected ethernet devices

                                        bridge between different types of network is organized on TCP/IP application server running currently on linux
                                        etc. potentially allows to connect network segments regardless physicall location, only internet connection is required

                                        why i'm doing this? mostly for fan but also to implement 2 principles:

                                        • application layer to be independant from hardware and transport. message format is universal and is the same regardless platform and communication hardware. Addressing is also universal. Application should not take care about intermediate specific, this is handled by other components
                                        • avoid a central unit. each device can communicate with each device. the only central component is application server. but is is very simple, robust and reliable. failover is supported

                                        My example:
                                        0_1542366195599_swi_network_example1.png

                                        sense and drive

                                        1 Reply Last reply
                                        0
                                        • axillentA Offline
                                          axillentA Offline
                                          axillent
                                          Mod
                                          wrote on last edited by
                                          #22

                                          for esp8266 i made an universal bridge application
                                          it can be used for both:

                                          • single node, esp8266 is running a final application. on the photo above my thermostats to measure room temperature, report it and to send ON/OFF commands to heaters

                                          • bridge. can be used to connect other type networks wirelessly to application server. UART is used for this + json translation. currently this is implemented to connect heating controllers located on each floor

                                          0_1542367097091_swi.png

                                          main and failover servers can be configured
                                          also each node is configured to handle from one to a few network segments. this allows simple routing from application server back to node
                                          esp8266 is using ArduinoOTA and zero hardcording.
                                          after fresh programming esp creates AP and smartphone can be used to preconfigure a node
                                          any updates are keeping configuration except major updates there stored structure can be affected

                                          application server is also support MQTT translation
                                          etc. it looks like a routing between my network and MQTT server
                                          RX/TX adresing are mapped to MQTT topic while message is translated into JSON:
                                          0_1542367488414_b02f627d-a80b-4837-9c39-335bcb337667-изображение.png

                                          sense and drive

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          19

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular