multiple Signal to RS485

Hi everyone
I am newbie here .
I have a project of connecting sensor to arduino from a distance of about 100 mtr.
I am using BME280
and MHZ16
I am using NANO and MAX485 at Sensors with following code

#include <RS485.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include "SparkFunBME280.h"
BME280 mySensor;
char Message[maxMsgLen+1] ;
int pin = 5;
void setup() {
 Serial.begin(9600);
 pinMode(pin, INPUT); 

 if (mySensor.beginSPI(10) == false) //Begin communication over SPI. Use pin 10 as CS.
  {
    Serial.println("The sensor did not respond. Please check wiring.");
    while(1); //Freeze
  }
}


void loop() {
 
 double duration = pulseIn(pin, HIGH);
   double y = duration / 1000;
   float z = y * 48;
 
const  char resulth[8];
    float h =mySensor.readFloatHumidity();
    dtostrf(h, 6,2, resulth);
    const char resultt[8];
float t = mySensor.readTempC();
dtostrf(t, 6,2,resultt);
const char resultc[8];
dtostrf(z, 6,2, resultc);

char buffer[strlen(resultc) + strlen(resultt) + strlen(resulth) +1];
  sprintf(buffer, "%s,%s,%s", resultc, resultt, resulth);
  Serial.println(buffer);
   strcpy(Message,buffer);
    if(RS485_SendMessage(Message,fWrite,ENABLE_PIN))
  {
    Serial.print("Sending:");
    Serial.println(Message);
 
  }  

  delay(1000);  

}

At the other end I am using UNO r3 with this code

// Receive
#include <RS485.h>
#include <SoftwareSerial.h>

char message[maxMsgLen+3+1];

void setup()
{
  Serial.begin(9600);
  Serial.println("System Startup - Receiver");

  RS485_Begin(28800);
}

void loop()
{
  //if(RS485_ReadPlainMessage(fAvailable,fRead,message))
  if(RS485_ReadMessage(fAvailable,fRead, message))
  {
    Serial.print("Receiving:");
    Serial.println(message);
  }


}

Nano is showing that it is sending data to RS485 and also on Serial Monitor
But UNO is not responding
If i use example code for sender then UNO start receiving data with Same wiring
I am using following Libraries
Sparkfun BME280
RS485-Arduino-Library-master
SparkFun_BME280_Arduino_Library-master
SPI
SOFTWARESERIAL

I have used following wiring at nano

//BME280 → Arduino
// GND → GND
// 3.3 → 3.3
// CS → 10
// SDI → 11
// SDO → 12
// SCK → 13

// MAX485 NANO
// DI D2
// RO D3
// RE D4

// MHZ16 NANO
// PWM D5

and at the other end i have used this
//MAX485 ARDUINO
//DI D10
//RO D8
//RE D9

Thanks In Advance

I don't see how you connect to RS-485 in software, and why you #include SoftwareSerial. How do the libraries know which pins to use?

Thanks for replying DrDiettrich.
The libraray I am using has this file which has all the coding for pins and software serial
File attached below

RS485.h (930 Bytes)

The pins in the library header don't match what you wrote.

for this i editing header file each time i program sender or receiver of Arduinos I have verified my pins by uploading example code of library and it works but when i upload my program in sender or nano then receiver stop printing on serial and blinking of TX LED also stop Thanks Waiting for response

Hi I am Newbie here I am looking for RS485 communication bw two arduinos Both are UNOS I am to connect multiple sensor at one end and at the other end i am using LCD to show data How i can use this? I am using MAX485 no code done just tested some examples with libraries I just to compile all the readings in comma seprated string like Temperature,humidity,pressure and at the other end i wanna to show them separate Thanks in Adavnce Waiting for response

Waiting for response

Did you have a question?

To interface the RS-485 components with the Arduino UNO, you will need an RS-485 transciever, as the UNO contains a USART that speaks CMOS(TTL). Maxim Integrated makes and IC for this purpose, MAX485. Check out their documentation for implementation and more information.

Thanks everyone for replying I have already max485 I wanna to communicate arduinos with rs485 to share sensor value from one to another in the form of comma seprated string For example

Arduino one it has Sensors connected Ultrasonic Sensor and DHT22 i want that it send data in the form distance,temp,hum 15,35.5,61.3

At Arduino two It has connected a display to it and it has to show the readings like following


! Dist. Temp Hum !

! 15 35.5 61.3 !

i have tested libraries examples but they are only send byte or signal for LED on/off

This is the issue. Thanks Waiting for response

Hi,
What MAX485 do you have?
The shield or the IC?
It makes a difference.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What libraries, examples have you tried?

Can you please tell us your electronics, programming, Arduino, hardware experience?

Thanks… Tom… :slight_smile:
PS.
Is this your post too… http://forum.arduino.cc/index.php?topic=564692.0

Hi, I have reported your CrossPost. Are you using a MAX485 IC or a breakout board?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :)

Hi Thanks for replying i have used max485 breakout board with following connections //MAX485 ARDUINO //DI D10 //RO D8 //RE D9

i Have tested following Libraries RS485-Arduino-Library-master SoftwareSerial Waiting for reply