NodemCU Modbus RTU

I am having nodemcu unit. I have connected nodemcu unit to Modbus rtu device.
It uses 1 as device ID . operating @ various baudrate. I would like to send modbusRTU with read holding register request and convert & display on Blynk app…

Is there any library available . i found example code Here. But i dont know

  1. How device ID being selected.
  2. where all register value being stored.
  3. how to read value convert & store in buffer.

You select device ID here node.begin(1, Serial);

You’ll find more information about this library here

Weather I could able to read data for modscan32. Where I could seee the output. First I would like to send request In format 01030000000afd weather this will be send like in software. Can I see serial out result here.

I would like to Simple app. That can send Data Serially In hex format . if dtata is valid print Hello else print welcome.

My Hex Data format is 01 03 0000 0000 FD

How to Read Hex format value . What is gadget need to be Used

This look like a MODBUS query. You should not compare the entire hex. It won’t mean anything.

Your question is not related to Blynk, I’d recommend to understand a bit more how Modbus works.

Yes it is modus rtu format. I would connect my tx and rx line of nodemcu to modus device and trying to send request above format. Else another way it could able to achieve.

Why do you have two threads where you ask the same question?

Pete.

Repeat offender, repeating reputitious postings :stuck_out_tongue_winking_eye: I merged them again.

1 Like

I have planned to connect my Device in above format. I will send modbus request from nodemcu & read the value and display on blynk app;
How to proceed to execute it,
i have attached some example like this but they are using as salve , But i want to use nodemcu as master and my device as slave . Send request and deliver the response .
The slave is working on modbus RTU format.

Modbus example

This has nothing to do with Blynk yet. As I mentioned before, spend some time understanding MODBUS, the library and how to connect them together.

Just a side note, you’ll fry your board if you connect it that way you described. Again, spend some time understanding it and you’ll find out why.

yes i know about modbus. I am not giving modbus A & B to Node MCU. When i testing my modbus RTU unit i am just ensuring modbus working or not. I am Sending same format in TX & rx line of TTl through Serial monitor and its working fine. Then i connected with ADM max IC where voltage level will be in range 5V-9V .
SO i know your concern why i will end up burning controller. Since modbus RTU it takes input from Rs232 and squeeze the data and send from long distance. I am keeping my modbus format same. but inplace of ADM2483ADM _datasheet
i am tapping TTL output from here so i work like Serial in Serial out with MODBUS format , If u u want can send output file & how i connected them. But how can i use modbus library here. Nodemcu as Master .or like i am testing USB to ttl connected rx-tx & tx-rx with docklight if i send modbus format i get reply . How can i receive.

Where’s the Blynk question in all of this?

Pete.

@ajitnayak87:
Combining…

[...]
#define BLYNK_PRINT Serial
[...]

… with …

[...]
node.begin(1, Serial);
[...]

… will most likely not be the best idea.
I’d rather choose a different serial port for the debug output.

I also don’t see any … :wink:

The library you’re using is very well documented. https://github.com/4-20ma/ModbusMaster/tree/master/extras

And I woke up on a good mood, I made this: https://github.com/ldab/MODBridge-and-Blynk/

1 Like

I have attached my connection diagram.

Link of code reference.

The response shown in figure is w.r.t modbus device attached, as shown in figure.

I am testing this code as shown in example. Other links i tried as soon as connected communication wont work. with below peice of code i could able to display data like shown in video . I wanted to how is viewing data over modbus softare of nodemcu.

When i Send modbus request through USB to TTL with Comport selected I get response . That make me ensure modbus device is working well. Now i would like to see same data through nodemcu eliminating
USB to TTL converter . But i dont know how to get data from library if data received then its easy to forecast in app,

First. Again, this has nothing to do with Blynk. You should contact the library developer to find more help as people here may not be familiar with the library you’re using.

Second. Your wiring is wrong.

Thanks it started working after changing wiring , I could able to read data . I have updated salve code.

Hello, can you share the sketch?