-->
Page 7 of 12

Re: ESP with MODBUS protocol

PostPosted: Wed Feb 22, 2017 5:29 am
by Aledav
Hello @ Reaper07,
congratulations for the library, the RS232-RS485 converter that uses allows you to overlook the DE / RE lines.
This wiring diagram that I would use for the tests with the ESP01, correct?
I just have to change in SDM.h
#define SDMSER_RX_PIN 2 // RX-D6 (Wemos) -12 - GPIO2 (ESP01)
#define SDMSER_TX_PIN 0 // TX-D7 (Wemos) -13 - GPIO0 (ESP01)
Thanks for the great job

Re: ESP with MODBUS protocol

PostPosted: Wed Feb 22, 2017 6:50 am
by reaper7
looks good :)

If You do not use a hardware serial in Your code, then You can also switch to hardware serial on TX/RX pins instead software serial on gpio0/2. It is more stable.
Simply uncomment:
#define USE_HARDWARESERIAL

On software serial I had 1-2 errors per day and the same count of strange esp resets :?
Now I switch to hardware serial and from 15 days any reading errors or esp resets :)

Re: ESP with MODBUS protocol

PostPosted: Fri Apr 28, 2017 8:51 pm
by manmoncang
Dear @ovdleun

I am from Malaysia doing same thing with you and stuck with nodemcu read info from SDM120.

May i have you code? Then i can learn and understand about SDM to nodemcu. Tqv,

Re: ESP with MODBUS protocol

PostPosted: Fri Apr 28, 2017 10:15 pm
by manmoncang
Yes... whats wrong with RS485? May Sir @Reaper07 help how to use library with RS485? tqvm and appreciate it if Sir Reaper7 can show the connection and code.

mohsh86 wrote:
ovdleun wrote:@Reaper07,

hehe sorry my bad. ;) Ok, so I hooked up everything last weekend and it works like a charm with the right converter! :D Then I discovered that my code was doing the queries too fast, so I had to put in a 500ms delay and with that, it was succesfully gathering the required information. So thank you very much for the SDM220 lib. ;)

I'll update this reply with a link to my blog post as soon as I've finished it. But for this matter, I just had the wrong RS485 converter. ;o)

KR.
Onno.



Hello,

would you mind telling me what was the wrong RS485 converter and what is the correct one ? i am using this one and am not sure where my problem is, i am using a 5v<->3.3v logic converter, assuming the MAX485 is 5v logic..