# How to read data from gateway connected to MODBUS device using nodered

**URL:** <https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474>\
**Category:** General\
**Created:** [19 August 2019 07:50 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474 "2019-08-19T07:50:55Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [20 August 2019 10:22 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/22 "2019-08-20T10:22:20Z")

</div>

read the manual for your device and decide what information you want to return.  
It shows in the manual what you need to send to the device…

What you need to send depends on how you have configured the sensor, so no-one else will be able to tell you...

---

<div class="post-metadata">

**Author:** ![Iliyas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iliyas/32/19045_2.png) [@Iliyas](https://discourse.nodered.org/u/Iliyas)\
**Post date:** [20 August 2019 10:23 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/23 "2019-08-20T10:23:09Z")

</div>

ok thanks

---

<div class="post-metadata">

**Author:** ![Iliyas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iliyas/32/19045_2.png) [@Iliyas](https://discourse.nodered.org/u/Iliyas)\
**Post date:** [20 August 2019 12:40 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/24 "2019-08-20T12:40:39Z")

</div>

Hello once again

---

<div class="post-metadata">

**Author:** ![Iliyas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iliyas/32/19045_2.png) [@Iliyas](https://discourse.nodered.org/u/Iliyas)\
**Post date:** [20 August 2019 12:41 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/25 "2019-08-20T12:41:47Z")

</div>

There is nothing related to the device specification....Can u please help me with this....make the data readable...i.e measuring the distance

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [20 August 2019 12:46 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/26 "2019-08-20T12:46:17Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/628ddf6121e1816797b86bf6c26937a3f1351205.jpeg)

---

<div class="post-metadata">

**Author:** ![Iliyas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iliyas/32/19045_2.png) [@Iliyas](https://discourse.nodered.org/u/Iliyas)\
**Post date:** [20 August 2019 12:49 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/27 "2019-08-20T12:49:52Z")

</div>

That I have understood just give me the procedure of doing this?  
Like I have to create some function or anything else?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [20 August 2019 12:56 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/28 "2019-08-20T12:56:04Z")

</div>

I haven't got one of these sensors all I'm doing is reading the document you have posted.

But if theres a "sensor query format" my guess would be that you need to send the correct command to the sensor and it then returns the response.  
How you do that could be in the inject node or a function node. But the command you send will depend on how you have configured your sensor.

---

<div class="post-metadata">

**Author:** ![Iliyas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iliyas/32/19045_2.png) [@Iliyas](https://discourse.nodered.org/u/Iliyas)\
**Post date:** [20 August 2019 12:58 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/29 "2019-08-20T12:58:33Z")

</div>

ya I got u but what query I have to give is the main issue

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [20 August 2019 13:03 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/30 "2019-08-20T13:03:08Z")

</div>

The query will depend on the dip switches on the sensor...  
As it says in the doc you posted.

---

<div class="post-metadata">

**Author:** ![Iliyas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iliyas/32/19045_2.png) [@Iliyas](https://discourse.nodered.org/u/Iliyas)\
**Post date:** [20 August 2019 13:10 UTC](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474/31 "2019-08-20T13:10:35Z")

</div>

I have configured my device to 0X01 now and next step is to give the same query right?  
And that query has to give through injection but which type I have to give like string, number or buffer etc??

[Previous page](https://discourse.nodered.org/t/how-to-read-data-from-gateway-connected-to-modbus-device-using-nodered/14474.md?page=1)
