Wireless usb modem and raspberry pi

Hi, I recently purchased the wireless usb modem and tried to connect it to my raspberry pi and started to get some errors in Node Red. As soon as I assigned the serial port I got kicked out of the server and now when trying to connect I’m getting this error:

6 Feb 18:20:36 - [error] TypeError: “path” is not defined:
at new SerialPort (/home/empiric/.node-red/node_modules/ncd-red-comm/node_modules/@serialport/stream/lib/index.js:116:11)
at NcdSerial.setupSerial (/home/empiric/.node-red/node_modules/ncd-red-comm/lib/NcdSerial.js:28:17)
at Timeout._onTimeout (/home/empiric/.node-red/node_modules/@ncd-io/node-red-enterprise-sensors/wireless.js:54:47)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)

I’m trying to further connect a 2 channel 4-20mA receiver to my network.

Thanks.

@Bhaskar or @jacob do you recall the issue with accessing the Serial Port through Node-Red on a Pi? I seem to remember there was an issue with this but do not recall the fix.

not with the USB port. the issue was with RPI4 hardware serial port.

Ok, at that point I believe this would be a permissions issue of some sort. I would check the permissions of the /dev/tty.usbserial directory created when the USB modem is connected to the Pi.

I would also ask what your nodejs version is and if you have configured a serial port in Node-Red yet.

I checked and you can get this error if you created a serial port connection, but didn’t add a path/port.

I added the permissions then created a serial node. Some information seems to be passing. But the NCD nodes for gateway/device don’t seem to connect as well.

{“payload”:“\u0003�\n”,“port”:“/dev/ttyUSB0”,“_msgid”:“4fd6e41d31fcd690”}
But the values coming in seem pretty weird.

What is the baud rate you’re using in Node-Red? Can you confirm that USB0 is the serial port of the modem?

The default baud rate is 115200 to communicate to the modem.

Hi,

I confirm it’s the right USB0, when I unplug the modem it says disconnected.

Baud rate is set to 115200
data bits - 8
parity - none
stop bits - 1
dtr/rts/cts/dsr - auto

hi, any additional thoughts on this? Trying to get it to connect.

Hi,

Can you export your flow from Node-Red and send it? You can export via the Menu in the top right (three horizontal lines) > Export > all flows > Download.

If Node-red isn’t working you can find the flow at ~/.node-red/flows.json

If you could include your package.json that may help as well. It can be found in ~/.node-red/package.json

flows (1).json (834 Bytes)
package.json (502 Bytes)

I believe these uploads should work. let me know if you can open it

This is the error code I’m getting. It looks like the port is running multiple services
[Error: Error Resource temporarily unavailable Cannot lock port]
19 Feb 11:36:07 - [red] Uncaught Exception:
19 Feb 11:36:07 - [error] TypeError: “path” is not defined:
at new SerialPort (/home/empiric/.node-red/node_modules/ncd-red-comm/node_modules/@serialport/stream/lib/index.js:116:11)
at NcdSerial.setupSerial (/home/empiric/.node-red/node_modules/ncd-red-comm/lib/NcdSerial.js:28:17)
at Timeout._onTimeout (/home/empiric/.node-red/node_modules/@ncd-io/node-red-enterprise-sensors/wireless.js:54:47)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result ‘exit-code’.
nodered.service: Consumed 8.658s CPU time.
nodered.service: Scheduled restart job, restart counter is at 3.
Stopped nodered.service - Node-RED graphical event wiring tool.
nodered.service: Consumed 8.658s CPU time.
Started nodered.service - Node-RED graphical event wiring tool.
19 Feb 11:36:29 - [info]
Welcome to Node-RED

19 Feb 11:36:29 - [info] Node-RED version: v3.1.4
19 Feb 11:36:29 - [info] Node.js version: v18.19.0
19 Feb 11:36:29 - [info] Linux 6.1.0-rpi8-rpi-v8 arm64 LE
19 Feb 11:36:30 - [info] Loading palette nodes
19 Feb 11:36:32 - [info] Settings file : /home/empiric/.node-red/settings.js
19 Feb 11:36:32 - [info] Context store : ‘default’ [module=memory]
19 Feb 11:36:32 - [info] User directory : /home/empiric/.node-red
19 Feb 11:36:32 - [warn] Projects disabled : editorTheme.projects.enabled=false
19 Feb 11:36:32 - [info] Flows file : /home/empiric/.node-red/empiric4_20ma.json
19 Feb 11:36:32 - [warn] Encrypted credentials not found
19 Feb 11:36:33 - [info] Server now running at http://127.0.0.1:1880/
19 Feb 11:36:33 - [info] Starting flows
19 Feb 11:36:33 - [info] Started flows
19 Feb 11:36:33 - [info] [serialconfig:48b81f5e359438a3] serial port /dev/ttyUSB0 opened at 115200 baud 8N1
19 Feb 11:36:33 - [warn] [csv:b0dd45f6c78b4f54] No columns template specified for object → CSV.
19 Feb 11:36:33 - [warn] [csv:5a6197a6c655822d] No columns template specified for object → CSV.
[Error: Error Resource temporarily unavailable Cannot lock port]
19 Feb 11:36:38 - [red] Uncaught Exception:
19 Feb 11:36:38 - [error] TypeError: “path” is not defined:
at new SerialPort (/home/empiric/.node-red/node_modules/ncd-red-comm/node_modules/@serialport/stream/lib/index.js:116:11)
at NcdSerial.setupSerial (/home/empiric/.node-red/node_modules/ncd-red-comm/lib/NcdSerial.js:28:17)
at Timeout._onTimeout (/home/empiric/.node-red/node_modules/@ncd-io/node-red-enterprise-sensors/wireless.js:54:47)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
nodered.service: Main process exited, code=exited, status=1/FAILURE

Hi,

It looks like there was only one node in the export. You might have skipped the all flows which should be a tab on the export modal part of the export. By default it only exports the selected node.

If Node-red isn’t working you can find the flow at ~/.node-red/flows.json

It miraculously started working. I haven’t one anything except start stop node-red. I’ll have to figure out the process steps again on a fresh install.

Nothing has changed. Unless it was maybe because the device batteries died and so no data was passing through.

EmpiricExport.json (11.8 KB)

Hi Dan,

Restarting Node-Red can be helpful and is generally recommended after library installs to reset all memory.

I did notice on the last export that the only node was a serial port node from the 3rd part node-red serial port library set to USB0. Both that node and our nodes cannot consume that serial port so they may have been butting heads over it. Even if one was removed it may have been kept in memory to use it until a restart of node-red. The error code was a bit strange for this issue, but I have never tested it.

Let me know if you have any additional issues or questions.