# Node-red-node-serialport, can't get data, only connected

**URL:** <https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779>\
**Category:** General\
**Created:** [6 December 2022 17:48 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779 "2022-12-06T17:48:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [6 December 2022 17:48 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/1 "2022-12-06T17:48:05Z")

</div>

I have a Raspbery pi3+ with debian 11. I want to connect with the P1 port of the smartmeter over USB port, so I tried with `node-red-contrib-smartmeter` package to connect with smartmeter. But it didn't work what so ever. So then I tried to read with `node-red-node-serialport` Here I can do more settings I thought and see what happens. But all I get here is a connected status when I use `/dev/ttyAMA0` or `/dev/serial0` But no data from the node whatsoever.

I know my USB to serial cable is OK, because I have a standard smartmeter programm on an sd-card, If I remove sd card with node red, and put this card in, it works very well. So no problem with the cable I would think.

I read many articles about this subject, but none of them gave me a way out of this problem. Maybe @knolleary or @dceejay you guys have one or more hints? Would appreciate that 🙂

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 December 2022 17:50 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/2 "2022-12-06T17:50:49Z")

</div>

can you talk to it from the pi without node-red ? eg using picocom or another serial port command line ? Have you got the speed set correctly ? Does it just send data or do you have to send a command first ? If so have you terminated the command correctly (usually "\r" or "\n") ? etc

AMA0 and serial0 are not USB ports.. they usually show up as /dev/ttyUSB0 and so on.

---

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [6 December 2022 17:58 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/3 "2022-12-06T17:58:22Z")

</div>

The speed is correct 115200 baud. 8N1. As far as I know the smartmeter gives a data telegram every second, so I only have to listen, I think.

> [@dceejay](#):
>
> AMA0 and serial0 are not USB ports.. they usually show up as /dev/ttyUSB0 and so on.

I don't get connected with /dev/ttyUSB0.

I will try talk/listen with picocom.

---

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [6 December 2022 18:13 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/4 "2022-12-06T18:13:40Z")

</div>

@dceejay Ok I get readings from minicom.

minicom -b 115200 -D /dev/ttyUSB0

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/e/ce5c50659e989ab09f1a74c4522f8bd5c9fb73a3.png)

That looks correct.

But why not from serial node then?

Every time I start minicom I get 5 to 10, mostly broken messages now, and then it just stops.

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/a/7a4ba4ea95c396fbac518bbb1eaac0857d56db63.png)

---

<div class="post-metadata">

**Author:** ![PiMo131](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pimo131/32/34978_2.png) [@PiMo131](https://discourse.nodered.org/u/PiMo131)\
**Post date:** [6 December 2022 19:12 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/5 "2022-12-06T19:12:16Z")

</div>

Does it start automatically or do you need some kind of initiating command?

How is the serial node configured, when is the node supposed to return data. On character or after a timeout?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/77b1112549d38cc39b7c7686d0576d5965ad30c4.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 December 2022 19:15 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/6 "2022-12-06T19:15:22Z")

</div>

set the split input to be on char \n or \r rather than time 50mS

---

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [6 December 2022 19:16 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/7 "2022-12-06T19:16:58Z")

</div>

@PiMo131 It start automatically. The smartmeter spits out a message about every sec.  
I think I only have to listen.

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/725e13f513b4948263fa5dfb413dc1849f1737fa.png)

![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/a/7a940b1b0bd075ae42cf1e853026c40c312d09a8.png)

And sometimes (after deploy) I get this report in debug window:  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e08a07d2465e65e848a2d3c1f540f39aab471eb0.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 December 2022 19:21 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/8 "2022-12-06T19:21:16Z")

</div>

that error usually means something else is already talking to that port... did you close minicom first ?

---

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [6 December 2022 19:22 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/9 "2022-12-06T19:22:25Z")

</div>

@dceejay Yes, I did. I think nothing else is talking to that port, as far as I know.  
But I have several communications via eth0 running.

If I stop Node-RED. And let only minicom run on command:

`minicom -b 115200 -D /dev/ttyUSB0`

Then minicom works perfectly.

---

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [6 December 2022 19:36 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/10 "2022-12-06T19:36:43Z")

</div>

@PiMo131 @dceejay  
Well unbelievable. I restarted Node-RED again. And now all over sudden it is connected and running!!!!

I didn't do anything else!!! 🙃

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 December 2022 19:55 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/11 "2022-12-06T19:55:18Z")

</div>

well whatever was making Node-RED think the port was in use presumably went away on reboot.

---

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [7 December 2022 12:51 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/12 "2022-12-07T12:51:20Z")

</div>

> [@dceejay](#):
>
> /dev/ttyUSB0

I think my fault was using /dev/ttyAMA0 and /dev/ttyserial0 as they produced a connect status. After restart node-red it is running now.  
I also tried `node-red-contrib-smartmeter`, but this node I didn't get to run, but I am happy node `node-red-node-serialport` is running, I can work from there.

So thanks, you guys @dceejay and @PiMo131 for all your help.

---

<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:** [21 December 2022 12:51 UTC](https://discourse.nodered.org/t/node-red-node-serialport-cant-get-data-only-connected/71779/13 "2022-12-21T12:51:30Z")

</div>

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