Communication between RS485 module and esp8266

Hello
I want to connect an RS485 module to an esp8266 and read the data coming from the RS485 module and display it on a 16 x 2 LCD. I connected the RX module pin 485 to the TX of the esp8266 and the TX pin of the 485 module to the RX of the esp8266. I also fed 5 volts to the 485 module. Are the connections correct? And what code should I write for the esp8266 module that can read the data and display it on the lcd?

Your other topic on the same subject deleted.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

D1 mini (with name upgrade to LOLIN D1 mini): https://www.wemos.cc/en/latest/d1/d1_mini.html with schematic.

The RS-485 module seems to work at 3.3V and 5V, according to websites here, here and here.
This website has a schematic:

The RX and TX on the D1 mini are used by the serial-usb chip to upload a sketch, or do you upload a sketch via Wifi ? I think the RX and TX can not be used for something else.

The pins of the ESP8266 are more-or-less 5V tolerant. It might be possible to run the RS-485 module on 5V.

The ESP32 has a extra Serial2 that works, but the ESP32 is not 5V tolerant. The RS-485 module should be powered with 3.3V.

Thanks for your help
What about MAX3485? I think it works with 3.3 volts. Can MAX3485 be serially connected to a base other than RX and TX? Thanks if you have a code about ESP8266 serial connection with me.

Is there a library for RS-485 ?
The Arduino has a official RS-485 shield: Arduino MKR 485 Shield — Arduino Official Store
Can you read the Docs and the Quickstart Guide, to see if the Arduino RS-485 library is compatible with other hardware ?

Are you talking about the bare MAX3485 chip or a module with that chip.
The module that you have now, has a circuit with protection for voltage spikes.

The ESP8266 can run SoftwareSerial to create a serial port on any pins. I heard that it is not as bad as the SoftwareSerial on a Arduino Uno.

Thank you very much for your help
I had another question that using the SoftwareSerial library I want to display the read value on a 16 x 2 LCD. This is my code. I also defined the LCD. How can I display the Read parameter on the LCD?

#include <SoftwareSerial.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);
SoftwareSerial mySerial(6, 7); // RX, TX

void setup()
{
   lcd.begin();

  // Turn on the blacklight and print a message.
  lcd.backlight();
  
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
 
  
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Native USB only
  }

  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(38400);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}



You could make a test-sketch and print variables and text on the display.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.