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

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ค. 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
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 59

  • @mohamedayoubhayouni6306
    @mohamedayoubhayouni6306 4 ปีที่แล้ว +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  4 ปีที่แล้ว

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

  • @qzorn4440
    @qzorn4440 2 ปีที่แล้ว

    very clever and practical 🥳 thank you

  • @yam6973
    @yam6973 ปีที่แล้ว

    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

  • @electronic7979
    @electronic7979 6 ปีที่แล้ว

    Excellent

  • @AQUATICSLIVE
    @AQUATICSLIVE 3 ปีที่แล้ว

    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.

  • @belkocik
    @belkocik 2 ปีที่แล้ว +2

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

  • @samirtaral
    @samirtaral 2 ปีที่แล้ว

    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?

  • @Zapo9668
    @Zapo9668 3 ปีที่แล้ว +1

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

  • @sviesis
    @sviesis 6 ปีที่แล้ว +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 5 ปีที่แล้ว

      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 2 ปีที่แล้ว

      Hi sir use transistor can show us how it work

  • @ilhamjayamahendra5810
    @ilhamjayamahendra5810 3 ปีที่แล้ว

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

  • @michaelgraff6978
    @michaelgraff6978 4 ปีที่แล้ว +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 4 ปีที่แล้ว +4

      Logic analyzers normally accept +-30V.

  • @rickpercy87
    @rickpercy87 4 ปีที่แล้ว

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

  • @girefox
    @girefox 2 ปีที่แล้ว

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

  • @erikson1882
    @erikson1882 3 ปีที่แล้ว +1

    how if the esp32 work on 3.3v man?

  • @sausagehider
    @sausagehider 6 ปีที่แล้ว

    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  6 ปีที่แล้ว

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

  • @KenHeinrich
    @KenHeinrich 6 ปีที่แล้ว +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  6 ปีที่แล้ว

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

    • @KenHeinrich
      @KenHeinrich 6 ปีที่แล้ว

      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  6 ปีที่แล้ว

      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 6 ปีที่แล้ว

      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  6 ปีที่แล้ว

      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.

  • @kasamravi4240
    @kasamravi4240 ปีที่แล้ว

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

  • @paulofernando4717
    @paulofernando4717 4 ปีที่แล้ว +1

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

    • @joaoricardo_5236
      @joaoricardo_5236 3 ปีที่แล้ว +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 3 ปีที่แล้ว

      @@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.

  • @VergilCola
    @VergilCola 5 ปีที่แล้ว +1

    Modbus is now supported on ESP32 esp-idf.

    • @MysteryElectronicz
      @MysteryElectronicz 5 ปีที่แล้ว

      Wish people would do idf tutorials to explain that code.

  • @korishan
    @korishan 6 ปีที่แล้ว

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

    • @AntonyCartwright
      @AntonyCartwright  6 ปีที่แล้ว

      Haha, sorry, but it was released today. :-)

  • @ahmedalirm233
    @ahmedalirm233 หลายเดือนก่อน +1

    Part 2 pls

  • @SA-oj3bo
    @SA-oj3bo ปีที่แล้ว +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.

  • @drhdirutomich2458
    @drhdirutomich2458 6 หลายเดือนก่อน

    .ino ?

  • @quagmire3594
    @quagmire3594 4 ปีที่แล้ว

    Long winded. Too many adverts.