# Data from RPI with UART to NR

**URL:** <https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688>\
**Category:** General\
**Created:** [25 January 2021 05:37 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688 "2021-01-25T05:37:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [25 January 2021 05:37 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/1 "2021-01-25T05:37:08Z")

</div>

Hi, I have little problem with data transfer to NR from RPI. Have installed nodejs serialport and open serial port. I tryed read data use USB and this work perfectly. I want transfer data from Modbus with RPI. I use UART connect and NR don't accept to read and write, data debug give this error. Serial port send data to AMA0 and BT was deactivated.

Here is log and port setting on RPI.

> **[txt](https://file.fm/u/wc4dp8292)**
>
> Visit this link to download: Node-Red Log.txt and 2 other files

---

<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:** [25 January 2021 10:24 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/2 "2021-01-25T10:24:44Z")

</div>

Please don't link to exterior sites unless the text it too large to paste in here. You can paste images and text directly into the forum. When pasting logs and code use the `</>` button at the top of the forum entry window.  
From the log  
`22 Jan 05:19:14 - [error] [modbusSerialConfig:8d3002c3.2570a] Error: {"name":"Po rtNotOpenError","message":"Port Not Open","errno":"ECONNREFUSED"}`  
That suggests either the port is already in use by another application (perhaps you have been testing the port using the command line or other client) or possibly the node red user does not have permission to access the port.  
Is this running on a pi? If so then I think the node red user needs to be in the `dialout` group?

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 13:53 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/4 "2021-01-26T13:53:09Z")

</div>

Yes, i'm running NR on pi user, but give permissions NR for access dialout with command (sudo usermod -a -G dialout pi). And adduser to acces dialout with(sudo adduser pi dialout).

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 13:58 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/5 "2021-01-26T13:58:24Z")

</div>

And group on check with coomnad ` ls -l /dev/ttyAMA0` is tty.Result `crw--w---- 1 root tty 204, 64 Jan 22 11:36 /dev/ttyAMA0`

---

<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:** [26 January 2021 14:24 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/6 "2021-01-26T14:24:53Z")

</div>

That suggests you need to be in the tty group rather than dialout. I suggest rebooting after adding a user to a group to make sure the session node red is using understands that.

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 14:36 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/7 "2021-01-26T14:36:31Z")

</div>

Already do this but doesn't work. Log `26 Jan 14:33:26 - [error] serial port /dev/ttyAMA0 error: Error: Error Resource temporarily unavailable Cannot lock port 26 Jan 14:33:27 - [error] [modbusSerialConfig:8d3002c3.2570a] Error: {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"} 26 Jan 14:34:27 - [error] [modbusSerialConfig:8d3002c3.2570a] Error: {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"} 26 Jan 14:35:27 - [error] [modbusSerialConfig:8d3002c3.2570a] Error: {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"}`

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 January 2021 14:55 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/8 "2021-01-26T14:55:04Z")

</div>

Have you disabled bluetooth on the Pi? I seem to recall that needs doing to free up the port.  
I did the following;

`sudo nano /boot/config.txt`

Add to the end of the file

`dtoverlay=pi3-disable-bt`

You also need to stop BT modem trying to use UART

`sudo systemctl disable hciuart`

---

<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:** [26 January 2021 14:58 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/9 "2021-01-26T14:58:01Z")

</div>

Have you read this, including the section on disabling the linux console? Also where it says "You must also disable the system service that initialises the modem, so it does not connect to the UART". Also possibly other bits in that document. [UART configuration - Raspberry Pi Documentation](https://www.raspberrypi.org/documentation/configuration/uart.md)

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 14:58 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/10 "2021-01-26T14:58:59Z")

</div>

Yeah sure, it's first step.

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 15:00 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/11 "2021-01-26T15:00:44Z")

</div>

```auto
[all]
#dtoverlay=vc4-fkms-v3d
enable_uart=1
dtoverlay=w1-gpio
# Disable Bluetooth
dtoverlay=pi3-disable-bt

```

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 January 2021 15:04 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/12 "2021-01-26T15:04:01Z")

</div>

Mine looks like the below, and I'm accessing the port fine.

```auto
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

#Disable Bluetooth
dtoverlay=pi3-disable-bt

```

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 15:05 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/13 "2021-01-26T15:05:22Z")

</div>

Sure, when enable serial port, linux console was selected disable.

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 15:05 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/14 "2021-01-26T15:05:56Z")

</div>

your model RPI ?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 January 2021 15:07 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/15 "2021-01-26T15:07:27Z")

</div>

Raspberry Pi 3 Model B Plus Rev 1.3

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 15:10 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/16 "2021-01-26T15:10:25Z")

</div>

Give me please code on cmdline.txt

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 15:13 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/17 "2021-01-26T15:13:11Z")

</div>

Tried connect Modbus with USB he's work perfectly.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 January 2021 15:14 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/18 "2021-01-26T15:14:43Z")

</div>

> [@Easy4M](#):
>
> code on cmdline.txt

`console=tty1 root=PARTUUID=03749e36-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles`

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 15:17 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/19 "2021-01-26T15:17:13Z")

</div>

```auto
dwc_otg.lpm_enable=0 console=tty1 console=serial0(or ttyAMA0),115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

```

I have there errors ?

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [26 January 2021 15:17 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/20 "2021-01-26T15:17:58Z")

</div>

I tried delete `console=serial0(or ttyAMA0)` this same error give NR

---

<div class="post-metadata">

**Author:** ![Easy4M](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/easy4m/32/35749_2.png) [@Easy4M](https://discourse.nodered.org/u/Easy4M)\
**Post date:** [27 January 2021 09:47 UTC](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688/21 "2021-01-27T09:47:03Z")

</div>

NR don't have acces to UART port, how resolve this problem? I giving permissions with `sudo usermod -a -G dialout pi`.

[Next page](https://discourse.nodered.org/t/data-from-rpi-with-uart-to-nr/39688.md?page=2)
