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. Troubleshooting
  3. wired RS485 sensor network does not work

wired RS485 sensor network does not work

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 2 Posters 1.4k 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.
  • wimdW Offline
    wimdW Offline
    wimd
    wrote on last edited by
    #1

    Hi,
    I build up the wired RS485 network with the gateway and motion sensor examples give on the website.
    Unfortunately it does not work. There is no commucation between the Gateway and the sensor.
    I only can capture nonsence.

    Connectins are :
    pin 8 (RX) to RO on RS485 brick.
    pin 9 (TX) to DI on RS485 brick.
    MY_RS485_DE_PIN to DE RE on RS485 brick.

    However if I check the connections with with this small program that used the same pins, the communication works correctly. What detail did I forget?

    #include <AltSoftSerial.h>
    
    AltSoftSerial altSerial;
    #define SSerialTxControl 2   //RS485 Direction control
    
    #define RS485Transmit    HIGH
    #define RS485Receive     LOW
    bool ReceiveOrSend = RS485Transmit;
    
    void setup() {
      
      Serial.begin(9600);
      Serial.println("AltSoftSerial Test Begin");
      pinMode(SSerialTxControl, OUTPUT);
      digitalWrite(SSerialTxControl, RS485Transmit);  // Enable RS485 Transmit    
      altSerial.begin(9600);
      if (ReceiveOrSend ){
          Serial.println("send mode"); 
          digitalWrite(SSerialTxControl, RS485Transmit);  // Enable RS485 Transmit 
      } else
      {
          digitalWrite(SSerialTxControl, RS485Receive);  // Enable RS485 Transmit 
          Serial.println("receive mode");
        }
    }
    
    void loop() {
      char receivedOnRS485;
      
      if (ReceiveOrSend ){
          altSerial.println(" Hello world");
          delay(2000); 
      } else
      {
    
      if (altSerial.available()) {
        receivedOnRS485 = altSerial.read();
        Serial.print("ontvagen=");
        Serial.println(receivedOnRS485);
      }
    }
    }```
    dbemowskD 1 Reply Last reply
    0
    • wimdW wimd

      Hi,
      I build up the wired RS485 network with the gateway and motion sensor examples give on the website.
      Unfortunately it does not work. There is no commucation between the Gateway and the sensor.
      I only can capture nonsence.

      Connectins are :
      pin 8 (RX) to RO on RS485 brick.
      pin 9 (TX) to DI on RS485 brick.
      MY_RS485_DE_PIN to DE RE on RS485 brick.

      However if I check the connections with with this small program that used the same pins, the communication works correctly. What detail did I forget?

      #include <AltSoftSerial.h>
      
      AltSoftSerial altSerial;
      #define SSerialTxControl 2   //RS485 Direction control
      
      #define RS485Transmit    HIGH
      #define RS485Receive     LOW
      bool ReceiveOrSend = RS485Transmit;
      
      void setup() {
        
        Serial.begin(9600);
        Serial.println("AltSoftSerial Test Begin");
        pinMode(SSerialTxControl, OUTPUT);
        digitalWrite(SSerialTxControl, RS485Transmit);  // Enable RS485 Transmit    
        altSerial.begin(9600);
        if (ReceiveOrSend ){
            Serial.println("send mode"); 
            digitalWrite(SSerialTxControl, RS485Transmit);  // Enable RS485 Transmit 
        } else
        {
            digitalWrite(SSerialTxControl, RS485Receive);  // Enable RS485 Transmit 
            Serial.println("receive mode");
          }
      }
      
      void loop() {
        char receivedOnRS485;
        
        if (ReceiveOrSend ){
            altSerial.println(" Hello world");
            delay(2000); 
        } else
        {
      
        if (altSerial.available()) {
          receivedOnRS485 = altSerial.read();
          Serial.print("ontvagen=");
          Serial.println(receivedOnRS485);
        }
      }
      }```
      dbemowskD Offline
      dbemowskD Offline
      dbemowsk
      wrote on last edited by dbemowsk
      #2

      @wimd Usually when you see RS232 or RS485 connections spitting out junk, the first thing to check is that you have your baud rate set the same on all ends/nodes.Also, sometimes if your baud rate is too high and if you have other things like debugging going on, this can cause it too. If you have full control over the baud rate, meaning if you don't have any devices that are preset to a certain rate, what I usually do is start out at 9600 baud at both ends and test the data connection. From there, keep increasing your baud rate until you have issues, then lower it by 1 level.

      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/

      wimdW 1 Reply Last reply
      1
      • dbemowskD dbemowsk

        @wimd Usually when you see RS232 or RS485 connections spitting out junk, the first thing to check is that you have your baud rate set the same on all ends/nodes.Also, sometimes if your baud rate is too high and if you have other things like debugging going on, this can cause it too. If you have full control over the baud rate, meaning if you don't have any devices that are preset to a certain rate, what I usually do is start out at 9600 baud at both ends and test the data connection. From there, keep increasing your baud rate until you have issues, then lower it by 1 level.

        wimdW Offline
        wimdW Offline
        wimd
        wrote on last edited by
        #3

        @dbemowsk Did all of these trail once again yesterday but without success.

        dbemowskD 1 Reply Last reply
        0
        • wimdW wimd

          @dbemowsk Did all of these trail once again yesterday but without success.

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

          @wimd When I built my RS485 thermostat bridge I used the SoftwareSerial library for the RS485 side which worked well for me. I see you are using the AltSoftSerial library. I have never used that one, but it looks like others have used that library with success. Can you post the sketch that doesn't work so that we can compare with the sample sketch you posted above? A few other questions, I can assume that at least one of your nodes is an arduino node, are both nodes arduino nodes? If so, are they both using the same sketch? If you have different sketches for each interface, we would need to see both sketches. If your second node is something other than an arduino node, can you elaborate on what i is?

          We will help you figure this out, we just need more information to do so.

          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/

          wimdW 1 Reply Last reply
          0
          • dbemowskD dbemowsk

            @wimd When I built my RS485 thermostat bridge I used the SoftwareSerial library for the RS485 side which worked well for me. I see you are using the AltSoftSerial library. I have never used that one, but it looks like others have used that library with success. Can you post the sketch that doesn't work so that we can compare with the sample sketch you posted above? A few other questions, I can assume that at least one of your nodes is an arduino node, are both nodes arduino nodes? If so, are they both using the same sketch? If you have different sketches for each interface, we would need to see both sketches. If your second node is something other than an arduino node, can you elaborate on what i is?

            We will help you figure this out, we just need more information to do so.

            wimdW Offline
            wimdW Offline
            wimd
            wrote on last edited by
            #5

            @dbemowsk Thank you for the reply. I searched in the meantime and found on the form that 'rs485 on nano' topic describes exactely the same issue I have. I see that you are involved there.
            I will join that chat as more people are involved.

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


            22

            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