# Reading data from an ultrasonic sensor

**URL:** <https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543>\
**Category:** General\
**Tags:** node-red-node-serialport\
**Created:** [21 October 2024 11:53 UTC](https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543 "2024-10-21T11:53:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![slaaww](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/slaaww/32/95644_2.png) [@slaaww](https://discourse.nodered.org/u/slaaww)\
**Post date:** [21 October 2024 11:53 UTC](https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543/1 "2024-10-21T11:53:23Z")

</div>

Hello, I have an ultrasonic sensor MB7389 and I can't get the sensor values ​​on node-red. But I can see them on the raspberry pi by minicom. However, I selected the right parameters in the serialport node.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 October 2024 12:00 UTC](https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543/2 "2024-10-21T12:00:36Z")

</div>

Hi, welcome to the forum.

Did you close the minicom application to free up the com port?

Try closing that application and restart node-red.

Lastly, how have you configured the "serial in" node and what type of data does it send (i.e. is it a well known protocol? does it have well defined start and end marks (like STX, ETX, carriage returns? etc?)

---

<div class="post-metadata">

**Author:** ![slaaww](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/slaaww/32/95644_2.png) [@slaaww](https://discourse.nodered.org/u/slaaww)\
**Post date:** [21 October 2024 13:07 UTC](https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543/3 "2024-10-21T13:07:29Z")

</div>

Yes, even with the minicom not used, it does not work. The data is given like this: R0560 which represents a distance in millimeters. Regarding the configuration of the serial in node, here are the parameters.

 ![Screenshot 2024-10-21 150339](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3a88ad9b610f95553fb8d19e769c63d0d5f89017.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 October 2024 13:29 UTC](https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543/4 "2024-10-21T13:29:35Z")

</div>

> [@slaaww](#):
>
> The data is given like this: R0560

It is unclear id that actually includes a `newline` character.

Have you tried setting the `Split Input` to something else - like "timed" - just so see if that is inhibiting the serial node (i.e. you data might have a `\r` or `ETX` instead of a `\n`)

also worth setting it to deliver a buffer so you can closely inspect the actual characters in the data.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 October 2024 13:37 UTC](https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543/5 "2024-10-21T13:37:36Z")

</div>

Also are you seeing any errors. Is there a status shown under the serial node?

---

<div class="post-metadata">

**Author:** ![slaaww](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/slaaww/32/95644_2.png) [@slaaww](https://discourse.nodered.org/u/slaaww)\
**Post date:** [21 October 2024 14:06 UTC](https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543/6 "2024-10-21T14:06:54Z")

</div>

thanks, it works.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 November 2024 14:07 UTC](https://discourse.nodered.org/t/reading-data-from-an-ultrasonic-sensor/92543/7 "2024-11-04T14:07:36Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
