TUTORIAL: How to make MODBUS work with ESP32 - Arduino - RS485 - Part 1

Sdílet
Vložit
  • čas přidán 12. 07. 2018
  • I was trying to get modbus to work with ESP32 for a long time. Eventually after finding no material online, I decided to look into it myself. Here is the problem and the solution.
    For those who wish to support the channel, my Patreon account is here: / antonycartwright
  • Jak na to + styl

Komentáře • 59

  • @mohamedayoubhayouni6306
    @mohamedayoubhayouni6306 Před 5 lety +1

    @Antony Cartwright
    You video was very useful for me.
    there is a solution for the issue of modbus. In fact in the last esp-df version (3.2.2) we can use RTS pin in order to control DE/RE pin of the RS485 module.
    It works fine.

    • @AntonyCartwright
      @AntonyCartwright  Před 5 lety

      Thanks for your comment! Where can I read more about this? Thanks!

  • @qzorn4440
    @qzorn4440 Před 2 lety

    very clever and practical 🥳 thank you

  • @yam6973
    @yam6973 Před rokem

    Hi Antony, you provide interesting infos regarding modbus... is there any planing to provide a link to show wiring (schematic) and/or the code (sketch) for.. that someone else can rebuild your solution? I only found the info to patreon.... Or in an older modbus video to a not working link ;-(( regards

  • @ilhamjayamahendra5810
    @ilhamjayamahendra5810 Před 4 lety

    can you help me? i have a project, if i use esp32 sim800l how to setting slave address? and how to connect with SCADA?

  • @samirtaral
    @samirtaral Před 2 lety

    Antony Cartwright, I have query about integration of ESp32 and GOT HMI with FX5U through RS485. If i connect Individually, I am able to read the data from PLC but when I connect it together (PLC,HMI and ESP32) It shows error on PLC. I am using ESP32 for data logging . Can you suggest what could be reason for error?

  • @belkocik
    @belkocik Před 2 lety +2

    Are you planning to do video with esp8266 and max485 and using a library to send a command to a slave?

  • @AQUATICSLIVE
    @AQUATICSLIVE Před 3 lety

    Dang, I need to order one of those analyzers. I am having a similar problem may be able to fix it without the tool but I really am curious to see it myself.

  • @Zapo9668
    @Zapo9668 Před 3 lety +2

    I didnt see the solution? only the problem? Have the modbus libraries corrected this since your video?

  • @girefox
    @girefox Před 2 lety

    Which code are you using? I'm trying to get started as well but have zero clue...

  • @sviesis
    @sviesis Před 6 lety +2

    easiest way is not to allow to handle DE/RE pins by esp32. Instead use mosfet or transistor, when there is tx or rx active then DE/RE are pulled low/high automatically. No library modifications necessary and this solution works for years in my setup.

    • @tsmartconsultant
      @tsmartconsultant Před 5 lety

      How exactly does this work? I like the idea but wondering if the transmit works also with the lower voltages if the esp to rs485

    • @tanmeowsoon5252
      @tanmeowsoon5252 Před 2 lety

      Hi sir use transistor can show us how it work

  • @electronic7979
    @electronic7979 Před 6 lety

    Excellent

  • @kasamravi4240
    @kasamravi4240 Před 2 lety

    why cant we connect esp32 with modbus what is the reason behind it

  • @michaelgraff6978
    @michaelgraff6978 Před 4 lety +3

    The A and B pins basically indicate a 0 or 1 by A being higher voltage than B, or the other way around.
    I would not connect a logic analyzer directly to them as they are not logic level. They can be negative and much higher than 5 V typical is +/- 7.

    • @AdrianElMeca
      @AdrianElMeca Před 4 lety +5

      Logic analyzers normally accept +-30V.

  • @erikson1882
    @erikson1882 Před 3 lety +1

    how if the esp32 work on 3.3v man?

  • @KenHeinrich
    @KenHeinrich Před 6 lety +1

    Just a note on Modbus. Modbus is not always used in the RS-485 mode, it can be use in RS-232, RS-422 or TCPIP. Modbus slave devices can only be multi dropped in RS-485, RS-422 and TCPIP.

    • @AntonyCartwright
      @AntonyCartwright  Před 6 lety

      Ken Heinrich hi Ken, I think it can be used with TTL too! :)

    • @KenHeinrich
      @KenHeinrich Před 6 lety

      Yes you can use TTL as well, it can't be multi dropped or be much farther than 6 meters away. I have work on systems where there could be 40 slave devices on an RS-485 multi drop and 600 meters away for the farthest one.

    • @AntonyCartwright
      @AntonyCartwright  Před 6 lety

      Oh cool! I've been working with Modbus for several hours today. I send a device a command, it sends on the A+ line, the device receives it and sends a reply... The reply is received (on both lines)... But the A+ lines receives the message with heavy distortion. The B- line is clean. The general result is garbage though. :-( Why would this happen?!?!

    • @KenHeinrich
      @KenHeinrich Před 6 lety

      With RS-485 the data is sent on both A+ and B- at the same time with respect to ground. One is going from ground to a positive 5 volts and the other is going from ground to a negative 5 volts. I one get messed up and the other one does not the data should get through that is the design of RS-485 to be able to go long distances with out total communications fail. Is there a second command being sent before the full message is received that would mess up the data.

    • @AntonyCartwright
      @AntonyCartwright  Před 6 lety

      Hi, There's no second command. I've just switched over to a different RS485-TTL converter and the problem is slightly different now. Now it does transmit the message on both lines, but the received message is still corrupted on the A+ line. The message from ESP32 to the converter is perfect, so this puzzles me a bit. Why would the reply be noisy on one line from the device!?!? I'm thinking the actual wire might be damaged or dirty or something.

  • @paulofernando4717
    @paulofernando4717 Před 4 lety +1

    One question, ESP32 works with 3V3 logic, can this Converter Board work with 3v3 logic level?

    • @joaoricardo_5236
      @joaoricardo_5236 Před 3 lety +1

      Paulo, procure pela interface com alimentação de 3V3 também. Assim, seu nível de tensão de equipara aos níveis do esp32.

    • @paulofernando4717
      @paulofernando4717 Před 3 lety

      @@joaoricardo_5236 Valeu pela resposta, testei com o ESP e um Arduino(lógica 5V) se comunicando, alimentei o barramento com 5V e funcionou legal.

  • @sausagehider
    @sausagehider Před 6 lety

    Hi Antony,
    Interesting video. I don't have either ESP32 or MODBUS, so not really of use but interesting none the less.
    Love the very end comment "it's really as simple as that!".. lol
    Cheers
    Martin

    • @AntonyCartwright
      @AntonyCartwright  Před 6 lety

      Hahaha! You know, I struggled with this problem for months... Hours and hours of research, hours messing about and learning. :D

  • @rickpercy87
    @rickpercy87 Před 4 lety

    Hey! I bought one of those logic analyzers. Where did you find the software, mate?

  • @VergilCola
    @VergilCola Před 5 lety +1

    Modbus is now supported on ESP32 esp-idf.

  • @SA-oj3bo
    @SA-oj3bo Před rokem +1

    the problem is not the esp32 but the program.... it should switch only from tx mode to rx mode after the serial buffer sended the last byte at the low speed which takes a while.

  • @ahmedalirm233
    @ahmedalirm233 Před 2 měsíci +1

    Part 2 pls

  • @korishan
    @korishan Před 6 lety

    AAAHHHH Get's us reeled in, laid back in my chair, and left us with a cliffhanger! :P

  • @drhdirutomich2458
    @drhdirutomich2458 Před 7 měsíci

    .ino ?

  • @quagmire3594
    @quagmire3594 Před 4 lety

    Long winded. Too many adverts.