Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Wouter
#68291 Hello,

I'm looking to create an RS-485 serial connection to my ESP8266 based project.
After some research I came to the MAX3485 chip, which appears to be suitable for use with the 3.3V TTL levels of the ESP8266. However I can't find any examples on how to wire the two together, or how to communicate with the MAX3485.

Please note, I'm not looking for complete modules - just the IC and any extra components as needed.

Thanks in advance!

Wouter.
User avatar
By btidey
#68305 The answer is going to depend a bit on what device (s) you are trying to talk to over RS-485.

RS-485 just defines the physical interface (like the voltage levels). It allows for configuration in bi-directional, multi-drop and master / slave arrangements. It says nothing about protocols or the data formats to be used.

In the simplest case RS-485 can be used unidirectionally to send or receive asynchronous serial data like you get from the TX and RX ports on the ESP8266. In this case you can just wir the data lines of the MAX3485 direct to the TX and RX pins and permanently enable the drivers on the MAX3485.

In more complex examples, bi-directional, multidrop etc you would need to wire the enable lines to a GPI pin and the software would have to decide when to enable these according to the protocol.

If the data is being sent synchronously then you can't use the TX and RX ports directly but would need to consider other techniques like bit banging. WHether these are feasible will depend upon the clock rate you are trying to support.
User avatar
By Wouter
#68306 On the other side is a fridge; no specifications on the connection other than RS485.

Send temperature settings to it, maybe read temperature data from it. That's it. No other devices on the line, short wires (1-2 meters or so, if that long).

Ideally indeed fixed connection to the RX/TX as long as I can still use it for regular serial communication (mostly to program the thing; I plan to enable OTA updates but need the serial interface as backup).
User avatar
By rudy
#68307
I'm not looking for complete modules - just the IC and any extra components as needed.

How do you plan on adding it to the ESP8266? Are you going to build a board for it?

What I would do is use an existing module. I would have a header connector that I could plug in the RS485 module. When I would want to do serial programming I would unplug it and plug in the USB to serial module.

But maybe software serial for the RS485 would be simpler when it comes to making changes. It all depends on how you want to do it.

Connections are pretty basic. RX and TX. And one pin for RX/TX direction switching. Then find a good library to handle the direction timing.

Image

You would not be using the 3.3 volts on the RS485 side connection. I did a quick look for an Arduino library (in case that is the framework you are using). https://github.com/madleech/Auto485 But there are others.