Тёмный

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

Antony Cartwright
Подписаться 29 тыс.
Просмотров 101 тыс.
50% 1

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

Хобби

Опубликовано:

 

12 июл 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 59   
@mohamedayoubhayouni6306
@mohamedayoubhayouni6306 5 лет назад
@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 5 лет назад
Thanks for your comment! Where can I read more about this? Thanks!
@qzorn4440
@qzorn4440 2 года назад
very clever and practical 🥳 thank you
@electronic7979
@electronic7979 6 лет назад
Excellent
@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
@sviesis
@sviesis 6 лет назад
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
@belkocik
@belkocik 2 года назад
Are you planning to do video with esp8266 and max485 and using a library to send a command to a slave?
@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.
@ilhamjayamahendra5810
@ilhamjayamahendra5810 4 года назад
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 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?
@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
@Zapo9668
@Zapo9668 3 года назад
I didnt see the solution? only the problem? Have the modbus libraries corrected this since your video?
@michaelgraff6978
@michaelgraff6978 4 года назад
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 года назад
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...
@KenHeinrich
@KenHeinrich 6 лет назад
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.
@erikson1882
@erikson1882 3 года назад
how if the esp32 work on 3.3v man?
@kasamravi4240
@kasamravi4240 2 года назад
why cant we connect esp32 with modbus what is the reason behind it
@paulofernando4717
@paulofernando4717 4 года назад
One question, ESP32 works with 3V3 logic, can this Converter Board work with 3v3 logic level?
@joaoricardo_5236
@joaoricardo_5236 3 года назад
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 лет назад
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 2 месяца назад
Part 2 pls
@AntonyCartwright
@AntonyCartwright 2 месяца назад
It's on my channel.
@SA-oj3bo
@SA-oj3bo Год назад
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 7 месяцев назад
.ino ?
@quagmire3594
@quagmire3594 4 года назад
Long winded. Too many adverts.
Далее
How to Interface RS485 Module with STM32
12:38
Просмотров 43 тыс.
Վարդավառը Գյումրիում
00:15
Просмотров 141 тыс.
ESP8266 to monitor your electricity with SDM meters
11:11
UART To RS-485 Interface  / Pro Mini / LoRa Interface
9:51
Understanding Modbus Serial and TCP IP
12:07
Просмотров 124 тыс.
Try these 16 Brilliant ESP32 projects!!!
11:18
Просмотров 548 тыс.
Cat Tommy lost his love…💔 #cat #cats
0:27
Просмотров 118 млн