0
\$\begingroup\$

I am using an ESP32 that has a CAN transceiver on it. I want to be able to communicate with an RS485 device.

Below is a block diagram of the high-level schematic for this:

enter image description here

Can someone assist with what the "Black box" contains?

Edit 2:

enter image description here

\$\endgroup\$
9
  • 2
    \$\begingroup\$ Probably a small MCU. The protocols and timing of CAN and RS485 are very different, so you need something that can be programmed to understand both protocols and do some data buffering as well. \$\endgroup\$
    – Dave Tweed
    Jan 20, 2023 at 13:12
  • 2
    \$\begingroup\$ Why not use three spare IO on the ESP32 to communicate on RS485 (and leave the CAN interface exclusively for other CAN communications)? There are modules you can buy of course. \$\endgroup\$
    – Andy aka
    Jan 20, 2023 at 13:16
  • \$\begingroup\$ @Andyaka "Why not use three spare IO on the ESP32 to communicate on RS485" how would I do that? \$\endgroup\$
    – JoeyB
    Jan 20, 2023 at 13:28
  • \$\begingroup\$ By interfacing with an RS485 chip. Are you involved with the code creation on the ESP32? Is someone you work with creating code for the ESP32 @JoeyB \$\endgroup\$
    – Andy aka
    Jan 20, 2023 at 13:34
  • \$\begingroup\$ @Andyaka I designed the ESP32 PCB with CAN and also the code for it. So you saying I should rather use Edit 2 above? \$\endgroup\$
    – JoeyB
    Jan 20, 2023 at 13:37

1 Answer 1

3
\$\begingroup\$

I designed the ESP32 PCB with CAN and also the code for it. So you saying I should rather use Edit 2 above?

You can use either but I see no reason not to use edit 2. Maybe you have a spare UART you can use inside the ESP32 and that makes interfacing with 485 much easier. Or you can bit-bang the 485 via plenty of readily available 8 pin chips using three spare IO lines.

yes I do have a spare UART. So I just need to use a RS485 to UART converter?

Taking your slightly modified edit 2 diagram, here's how you would add a simple separate RS485 interface (if you felt it to be the right route for you): -

enter image description here

IC image from this datasheet but, there are other suppliers of very similar 485 interface chips so, don't feel limited to Maxim.

You can get isolated versions of the interface chip as well (should you be concerned about ground/earth loops). You can also get fully-full-duplex interface chips as well.

\$\endgroup\$
4
  • \$\begingroup\$ " You can also get fully-full-duplex interface chips as well." Or mount 2 pcs of MAX485 SO8. That way you get plenty of 2nd source. \$\endgroup\$
    – Lundin
    Jan 20, 2023 at 14:18
  • \$\begingroup\$ @Lundin very true. \$\endgroup\$
    – Andy aka
    Jan 20, 2023 at 14:24
  • \$\begingroup\$ This is off question, but what are ground loops? \$\endgroup\$
    – JoeyB
    Jan 20, 2023 at 21:30
  • 1
    \$\begingroup\$ An earth loop (aka a ground loop in America) is when you have two pieces of equipment that are metal-chassis earthed. Each can naturally produce occasional surges down their respective earth wires to earth and, if the two pieces of equipment were connected to each other via an RS485 cable (with a grounded/earthed shield), some of those unwanted earth surges will pass down that sensitive comms cable and disrupt data and make it unreliable @JoeyB \$\endgroup\$
    – Andy aka
    Jan 20, 2023 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.