Node-Red on Raspberry Pi

Has anyone used node-red with the node-red-contrib-i2c node? I am trying to read a 4-20 mA signal using a 4-channel 4-20 mA board (PR33-10). I can see the device on address 73, but I don’t know what command or bytes to read the value.

image

I get a value returned, but I don’t think its correct as it never changes with my device.

image

Any ideas/advice on the command and bytes options?

Hi @will

@Trey here has been doing quite a bit of work with Node-Red recently. I’ll let him comment on this. Not sure if he has done direct I2C communications using Node-Red yet or not.

I found a node that works with the ADS1115 chip that has a slightly different interface so I can use it to get a reading now. But the readings vary between 380 and 1980. I was expecting 0 to 4095.
image

After putting my meter inline I see that it is giving me a 4-20 mA reading x 100.

The node is called: node-red-contrib-ads1x15 and works for the ads1115 and ADS1015 if anyone else is interested.

Would still like some help on understanding the previous if @Trey has any insight so that I can use other I2C modules that don’t have chip specific nodes.

I haven’t personally used that node, I grabbed the package initially, but what I’m working on now is a config node to connect a device to the I2C bus that can be reused (since most devices need to be able to read and write anyway it made more sense). The 4-20 mA boards are literally my first priority once I get the current library stable, I expect to have them out this week and will let you know

If I’m not mistaken I believe the 4-20mA input boards actually read a range of 0-40mA so that is why your range is limited to 380 - 1980. @Bhaskar could you confirm on that?

this one is current loop receiver board and it reads 0- 22mA.
I think the gain is set to 1 it needs to be set at two.

Hey Will, sorry for the delay, but I did get that package released:

I want to take a little time before I tag it with node-red, so it will have to be installed through the command line, but it is working!

@Trey. Thanks. I tried giving the node a shot. I can only seem to get one channel to output and that ends up being the highest channel I have enabled. So if I have 3 channels as single ended then I only get a read on channel 3. If I have 4 enabled, I only get a read on channel 4. I tried messing around with the output all channels flag, but that doesn’t seem to make a difference. I am using version 1.0.6.

This is on a Pi Zero W.

Edit: I see that it has been updated to 1.1.0. I will update to the latest version and get back to you.

Edit 2: Even with the latest package I still see the same behavior. Only the highest value reports back in the payload.

Hey Will, sorry about that. I’ve made another update that will fix that issue, you should use v1.1.1

Let me know if you have any more issues!

No need to be sorry. I’m grateful that you are actively working on this.

Version 1.1.1 worked. Thanks.

@Trey I tried installing the 1.1.2 version on a raspberry pi Zero, similar to what I have 1.1.1 on, and I keep running into issues. The nodes show up, but won’t deploy. I get an NCD-Comm error. I looked in the list of nodes and it says installed with version 1.2.2. I made sure npm and node red were updated to the latest versions but continue to run into issues. Also when I run npm install ncd-red-ads1115 it deletes my node-red-contrib-modbus nodes.

Hi Will,

I just set up a new flow on the Pi at my desk and it worked without an issue. What’s the error you’re getting? I’m looking into the modbus nodes, but so far can’t find anything that would conflict.

I think it had to do with NPM. I ensured I was updated to the latest version of node red with update-nodejs-and-nodered and then was forcing an update, using npm i -g npm, to the latest version of npm as recommended on the install page. 5.8 I believe. This is when I would see funky behavior.

I went back and ran update-nodejs-and-nodered which reverted to npm 5.6 and things started to work fine.