Phidget22 Node-RED Module Released

Supporting Browser-based Javascript and Node.js
lingvo
Phidgetly
Posts: 15
Joined: Fri Jul 16, 2021 8:43 am
Contact:

Re: Phidget22 Node-RED Module Released

Post by lingvo »

Hello

I started to get strange problem in Nodered Phidget Module with HUB5000+ADP1000 Adapter:
At some point VoltageInput Node starts to output

Code: Select all

{"code":4105,"description":"Saturation Detected."}
while in +-2V Mode (ORP Electrode connected)
The VoltageInput node settings are:
ORP.png
If I then go to Phydgets control panel in Web - it shows +-400mV range even if I didn't change it anywhere!
ORP2.png
If I manually change range to +-2V it starts working again and also in Node-RED - till next time.
ORP3.png
ORP3.png (56.2 KiB) Viewed 38181 times
What goes wrong here? Does HUB5000 reset itself and changes the range? How to make it always select +-2V range in Node-RED?
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Phidget22 Node-RED Module Released

Post by mparadis »

Hi Lingvo,

I tried to change the voltage range on the ADP1000 on my computer and had no issues- in fact, I can open the web control panel window while the flow is running and see the voltage range change from 400mV to 2V and back again when I change the node configuration and restart the flow.

The default option for voltage range on the ADP1000 is 400mV, so any time you newly open the channel it will default to that. But as long as 2V is selected in your VoltageInput node, it will change the range to 2V when your flow starts. If you stop node-red and open it in the control panel, it will re-open the channel and it'll be back to the 400mV default again.

On an unrelated note, you can keep the SensorType configuration to "VOLTAGE", because the "PN_1130_ORP" setting is only for the 1130 pH/ORP sensor. (This isn't causing any problems in your code, just creates an additional error when the flow starts since you can't set SensorType on this device)
lingvo
Phidgetly
Posts: 15
Joined: Fri Jul 16, 2021 8:43 am
Contact:

Re: Phidget22 Node-RED Module Released

Post by lingvo »

Hi mparadis
Thanks for quick reply.

In my case changing the Voltage Range in VoltageInput Node and restarting the flow doesn't have any effect for some reason. But I remember it did work at start when I was making the flow. I did FW upgrade of HUB5000 couple of times since then. Any ways to debug this?

I also tried to set voltage range manually by injecting topic

Code: Select all

setVoltageRange 
with Payload

Code: Select all

{"voltageRange":7}
into VoltageInput node.

But while this was working before, now it generates an error:

Code: Select all

setVoltageRange failed:PhidgetError: Device not Attached
Perhaps this has something to do with my problem?

Currently this range resetting happens almost every day and is very annoying.
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Phidget22 Node-RED Module Released

Post by mparadis »

If you're getting a "device not attached" error when trying to send a message in, the channel must have detached at some point, or it never attached to begin with. If you click on the "debug messages" box in the VoltageInput configuration, you should see a message "VoltageInput Opened" when you start the flow, if it successfully opens. If you get "Open failed:PhidgetError: Open Timed out" then it probably means the channel is being held by another program. Sometimes I've found that node-red itself can somehow lock up a channel at which point terminating the node-red process and restarting it can sometimes help.
lingvo
Phidgetly
Posts: 15
Joined: Fri Jul 16, 2021 8:43 am
Contact:

Re: Phidget22 Node-RED Module Released

Post by lingvo »

mparadis wrote: If you get "Open failed:PhidgetError: Open Timed out" then it probably means the channel is being held by another program. Sometimes I've found that node-red itself can somehow lock up a channel at which point terminating the node-red process and restarting it can sometimes help.
Yes I get it often. Is it possible to add automated restoring of that channel in node-red when it locks? Or some retry mechanism?

At least I never get such issues in Node-red with other lockable hardware, like serial port for example.
lingvo
Phidgetly
Posts: 15
Joined: Fri Jul 16, 2021 8:43 am
Contact:

Re: Phidget22 Node-RED Module Released

Post by lingvo »

Found another problem with Node-RED module:

If wireless VINT hub (I use HUB5000) drops off the network (for example loss of power) and then returns back, node-RED module doesn't re-establish connection to it automatically. I have to manually restart Node-RED instance, which is annoying.

Is it possible to fix it? I don't see much activity on Phidget Node-RED Module. Is is still supported by developers?
kcamenzind
Fresh meat
Posts: 1
Joined: Wed Apr 12, 2023 10:54 am
Contact:

Re: Phidget22 Node-RED Module Released

Post by kcamenzind »

Hi, would it be possible to put the node-red-contrib-phidget22 source code publicly on github so that it can be contributed to? I am interested in making some improvements (at a minimum, fixing the issue of not being able to reconnect to the server), and it would be nice to integrate the fix into the existing package rather than creating a fork / needing to publish as a different npm package to install from the palette.

If this isn't possible, please let me know! Thanks!
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Phidget22 Node-RED Module Released

Post by mparadis »

You can find the source code at:
https://www.npmjs.com/package/node-red- ... -phidget22

If you want to contribute, tell me your npm account and I can add you as a collaborator.
nsmaree
Fresh meat
Posts: 2
Joined: Tue Aug 29, 2023 2:29 pm
Contact:

Re: Phidget22 Node-RED Module Released

Post by nsmaree »

Hi mparadis

I'm using Node-Red in an industrial application. I have, on occasion, found that a certain node disconnects. Is there a way of reconnecting a node or the entire connection on timeout?

Thanks, Neil
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Phidget22 Node-RED Module Released

Post by mparadis »

Normally when a channel disconnects, it will reconnect automatically once the channel becomes available again. For example, if you try unplugging and plugging back in a device, it should come back without restarting the flow.

If the node disconnects and stays that way, there must be something else causing the channel to be unavailable. Make sure all of your devices are on the newest firmware version and ensure there are no other programs running that may be looking to open the channel when it becomes available.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest