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. Development
  3. RS485/RS232/Serial transport class for mysensors.org

RS485/RS232/Serial transport class for mysensors.org

Scheduled Pinned Locked Moved Development
rs485 serialrs485
143 Posts 27 Posters 102.8k Views 27 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.
  • L LeoDesigner

    Hi everyone !

    I needed a wired solution for my several nodes.
    Here is the serial rs485/rs232 wired network transport for mysensors.
    https://github.com/leodesigner/mysensors-serial-transport
    It is based on the Majenko ICSC serial library.
    Can you please test it? It is a beta version - but it is working for me.
    (However, I am still waiting for my rs485 boards to arrive)
    You can find more technical information at
    http://sourceforge.net/p/arduino-icsc/wiki/RS-485/

    To use it, you have to:

    1. Put SerialTransport.cpp and SerialTransport.h to folder/directory/path SerialTransport in your library.
    2. Add #include <SerialTransport.h> to your .ino sketch
    3. Replace transport class with:
      MyTransportSerial transport(Serial,0,-1); // serial port, node, dePin (-1 disabled)

    Please let me know about bugs and how it is working for you.

    skatunS Offline
    skatunS Offline
    skatun
    wrote on last edited by
    #91

    @LeoDesigner
    Hi, I am trying to do almost the same, but I would like to use softwareSerial instead of altsoft. The reason why I would do this is that i can barely fit the arduino nano inside my case, and an additional rs485 module would not fit and that I have 8 nodes connected on the softwareserial . I have tested software serial on arduino and it seems to work fine up to 15meters, I also adjusted the baudrate to 9600 since my node does not send out/receive large amount of data. I read that you did some work on software serial and were wondering if you could take a look at this thread.

    1 Reply Last reply
    0
    • CrankyCoderC Offline
      CrankyCoderC Offline
      CrankyCoder
      wrote on last edited by
      #92

      Is there any how-to's on this transport class as far as the hardware goes? How does it work with multiple nodes? Is it like a ring pattern? or do all the nodes have to have a dedicated connection to the gateway.

      Home Automation Tinkerer
      www.CrankyCoder.net

      Controller: HomeAssistant in Kubernetes
      Gateway: MQTTClientGateway
      MySensors: 2.3

      1 Reply Last reply
      0
      • tbowmoT Offline
        tbowmoT Offline
        tbowmo
        Admin
        wrote on last edited by
        #93

        Depends on your physical transport layer. I would say a multidrop link where everything is in parallel..

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hausinger
          wrote on last edited by
          #94

          Is it possible, to built a esp8266 wifi gateway and communicate GW to node with rs485?
          In altsoft esp8266 is not decleared, so i can't use it out of the box.

          Btw: I tested my_rs485 with nano as GW and Pro Mini as node, and it worked great. Thank you :)

          1 Reply Last reply
          0
          • hekH Online
            hekH Online
            hek
            Admin
            wrote on last edited by
            #95

            @hausinger I don't think so. I haven't heard of anyone trying. I guess you'd have to replace alt-soft-serial with something else.

            1 Reply Last reply
            0
            • scalzS Offline
              scalzS Offline
              scalz
              Hardware Contributor
              wrote on last edited by scalz
              #96

              @hausinger if you know about coding..

              • plain C lib for esp8266, it can be adapted to work with Arduino Esp: https://github.com/plieningerweb/esp8266-software-uart
              • or use stock arduino esp8266 software serial lib (https://github.com/plerup/espsoftwareserial), and inspire yourself from lib above, and code your CE pin management..
              1 Reply Last reply
              0
              • BartB Offline
                BartB Offline
                Bart
                wrote on last edited by
                #97

                Hi,

                Any reason why this lib is not using Serial1 or Serial2 on Arduino Mega 2560 instead of AltSoftSerial?

                1 Reply Last reply
                0
                • hekH Online
                  hekH Online
                  hek
                  Admin
                  wrote on last edited by
                  #98

                  @Bartek-Celary
                  No, not really. Just that not many that uses 2560.

                  1 Reply Last reply
                  0
                  • BartB Offline
                    BartB Offline
                    Bart
                    wrote on last edited by Bart
                    #99

                    How about adding the following define to use the Serial1/2 on Mega. I have not tested yet but assuming the AltSoftSerial lib has the same interface/functionality it should work.

                    #define MY_RS485_SERIAL Serial1
                    
                    diff --git a/core/MyTransportRS485.cpp b/core/MyTransportRS485.cpp
                    index 814f721..ea35c9e 100644
                    --- a/core/MyTransportRS485.cpp
                    +++ b/core/MyTransportRS485.cpp
                    @@ -92,7 +92,11 @@ unsigned char _recSender;
                     unsigned char _recCS;
                     unsigned char _recCalcCS;
                     
                    +#if defined(MY_RS485_SERIAL)
                    +HardwareSerial& _dev = MY_RS485_SERIAL;
                    +#else
                     AltSoftSerial _dev;
                    +#endif
                     
                     
                     unsigned char _nodeId;
                    
                    1 Reply Last reply
                    0
                    • hekH Online
                      hekH Online
                      hek
                      Admin
                      wrote on last edited by
                      #100

                      Looks like a neat solution. If it verifies ok, please create a pull request agains the development branch.

                      1 Reply Last reply
                      0
                      • lanL Offline
                        lanL Offline
                        lan
                        wrote on last edited by
                        #101

                        I understand that the RS485 is a separate gateway to communicate. Is it also possible to have the wireless gateway and RS485 gateway combined?

                        1 Reply Last reply
                        0
                        • hekH Online
                          hekH Online
                          hek
                          Admin
                          wrote on last edited by
                          #102

                          Currently, no..

                          lanL 1 Reply Last reply
                          0
                          • hekH hek

                            Currently, no..

                            lanL Offline
                            lanL Offline
                            lan
                            wrote on last edited by
                            #103

                            @hek Thanks for the quick response. I'm looking for some direction (this might not be the right forum).
                            I want to create a node to control my Itho Ecofan ventilation box. I now have a working program (thanks to the help of Rogier Reedijk The nodo now uses a CC1101 transceiver to control the box and thus uses the SPI bus. I'm looking for some direction to use this transmitter as part of my sensor network so I can control it from my Domoticz. Hope you can give me some directions how to proceed.

                            1 Reply Last reply
                            0
                            • hekH Online
                              hekH Online
                              hek
                              Admin
                              wrote on last edited by
                              #104

                              Why do you need to hook it up to RS485 wired network? Can't you just forwards commands to the CC11001 from any radio node or the gateway?

                              1 Reply Last reply
                              0
                              • lanL Offline
                                lanL Offline
                                lan
                                wrote on last edited by
                                #105

                                Is it then possible to use the two radio's on one node and share the SPI bus?

                                1 Reply Last reply
                                0
                                • hekH Online
                                  hekH Online
                                  hek
                                  Admin
                                  wrote on last edited by
                                  #106

                                  Yes, if the CC11001 behaves correctly.

                                  1 Reply Last reply
                                  0
                                  • lanL Offline
                                    lanL Offline
                                    lan
                                    wrote on last edited by
                                    #107

                                    Thanks, will try that

                                    1 Reply Last reply
                                    0
                                    • elektro12345E Offline
                                      elektro12345E Offline
                                      elektro12345
                                      wrote on last edited by elektro12345
                                      #108

                                      Hello,
                                      I have a problem running gatewayserial to rs-485 and the node with the usual lightsensor.
                                      NODE # 1 as a gateway and tried to upload a sketch of the library 2.0 and 1.5.4, and the monitor serial I can not see any data, I use to check on the serial PuTTy com6 because the converter rs-485 to USB is connected to the PC.

                                      NODE # 2 as a light sensor, during the upload Sketch by arduino programmer for serial monitor can see the data being sent but after plugging arduino to rs-485 as below no longer visible.

                                      My question is whether I have something wrong with the connection or sketch, can someone show an example of a complete sketch for the gateway, and a node?

                                      Connection mine looks like this:
                                      TX and RX Connect was to pins 0 and 1 in arduino or 8 and 9, DE is always PIN 2.

                                      alt text

                                      BartB 1 Reply Last reply
                                      0
                                      • hekH Online
                                        hekH Online
                                        hek
                                        Admin
                                        wrote on last edited by
                                        #109

                                        Looks like you got the pins to the Arduino wrong.

                                        Pin 9 >>> DI
                                        Pin 8 >>> RO
                                        Pin 2 >>> DE and RE

                                        elektro12345E 1 Reply Last reply
                                        0
                                        • hekH Online
                                          hekH Online
                                          hek
                                          Admin
                                          wrote on last edited by
                                          #110

                                          I need a nice picture done in fritzing (or similar) for an article on the main site on how to connect the RS485 module (atmega 328 enough I guess).

                                          Anyone volunteering in making one?

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


                                          15

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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