I am trying to set up connection between master ESP32 and slave Arduino Uno clone(Sys pwr 3V3) with RS-485. My RS-485 module uses TI SN65HVD31DR chip (module). I only need half-duplex, but I am a bit confused how should I wire these. I have got communication working both ways but I would want to confirm correct wiring.
a Couple of questions:
Should I use one or two RS485 modules? I have used both configurations successfully to send and receive data. What is the correct way?
The data sheet says that SN65HVD31 should have only one driver connected to the bus. What does that mean?
What would happen if Uno's Sys power is switched to 5V?
I must have my eyes checked, I cannot see how you actually connected them. Please post an annotated schematic showing all connections including Power, Ground and Power Source.
ESP and Uno powered with PC usb. My Uno has both female and male pin headers for all pins so I can connect easily two wires to one pin.
With one RS-485 module:
I had trouble sending message from slave to master. So I just tested different wirings and this one seemed to work. Sending from master to slave always worked.
ESP32:
ESP32-S
RS-485
3V3
3V3
GND
GND
U1TXD(SD3)
RX
U1RXD(SD2)
TX
UNO:
Inhaus Uno LC
RS-485
RX
TX+
RX
RX-
TX
RX+
GND
GND
With two RS-485 modules:
I didn't use any resistors or twisted cables.
It appears you have Rx connected to Tx, by standard convention that is correct. Check all of your modules to validate, you should get the serial signal from Tx not Rx. What are the serial settings such as 96,N,1?
It has a permanently active transmitter, therefore it monopolizes the bus.
Other devices such as the SN65HVD33 can be be put into an idle state so multiple transmitters can take turns sending data. You need this ability if you have multiple slave devices.
My serial settings are 115200 8-N-1. To be clear I can send and receive data. I'm just wondering should I use one or two RS485 modules to do this and why I could get it working both ways.
At this point it is upto the software (protocol) to determine who is talking and who is listening. That is why I like CAN it does all of that for me and is good for several thousand feet.
Under Absolute Maximum Ratings, the datasheet says it'll survive 6v, however you'll need to read the rest of the datasheet to see if it says anything about using it above the 3.6v recommended max.