Mcp4725 node-red flow

Hi,

I am looking for an example of using the MCP4725 in node-red.

My flow below, gives this error:
ReferenceError: stop_poll is not defined

[{"id":"445c94b2.66ff2c","type":"ncd-mcp4725","z":"b7a2e96c.0f4228","name":"","connection":"af479a17.b8d368","addr":"96","persist":"","startup":false,"eeprom_pd":0,"eeprom_dac":0,"x":1010,"y":380,"wires":[["874d4949.55c918"]]},{"id":"874d4949.55c918","type":"debug","z":"b7a2e96c.0f4228","name":"transmitter","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1210,"y":300,"wires":[]},{"id":"aaf7fa44.c8e388","type":"comment","z":"b7a2e96c.0f4228","name":"4-20mA transmitter","info":"","x":850,"y":240,"wires":[]},{"id":"175ad7a3.2b77c8","type":"inject","z":"b7a2e96c.0f4228","name":"","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":810,"y":300,"wires":[["445c94b2.66ff2c"]]},{"id":"af479a17.b8d368","type":"ncd-comm","z":"","name":"","bus":"i2c-1","commType":"standard","addr":"0","useMux":false,"muxAddr":"112","muxPort":"0"}]

Hey, sorry about that! Looks like there was an erroneous call in the library causing that, I updated the library to v1.0.3, try to new version. You shouldn’t have to alter your flow at all, just update the library

Thanks!

Sorry, 1.0.4 is the correct version

Hi,
I have updated to 1.0.4, but I get the same error.
ReferenceError: stop_poll is not defined

did you restart node-red?

Ok, a restart resolved it.
Thanks

Hi Trey,

Is it possible to link the MCP4725 (PR33-26) to a ADS1115 (PR33-7), so that they speak to eachother?

With two connections:
CTO (PR33-26) connected to GND (PR33-7)
CTO (PR33-26) connected to IN (PR33-7)

Kind regards

Absolutely, there would certainly be some configurations you’d have to play with in regards to the gain, but both nodes are fully configurable so I don’t see any issue with it

Thanks Trey,
I have wired the transmitter and the receiver and they are communicating now.

I also have a current monitor PR29-1 board.
Now, the PR29-1 is the only connection to my RPI 3B.
When I deploy a simple flow containing a ‘current monitor’ node, with debug nodes I get the a message from the current monitor node saying ‘TypeError: this.sensor.once is not a function’.

Best regards,
George

Hey George,

Try updating the current monitor package, I just pushed out a change that should solve that. Most of these node-red libraries I built in a couple weeks, so I’m glad to get some feedback! Sorry about the errors, I’ll keep fixing them as fast as I can! lol

Ok, I have updated the packages and there is no type error anymore.
I am not familiar with this board, so I cant really test it at the moment.

I do notice that the current monitor’s state is not saved. Select ‘Output on init’. If you click done and return again to the current monitor’s config, then you will find that it is deselected.

BTW, I also have an AMS 5812 0150-D pressure board. What node can I use to read the pressure?

Best regards,
George

The output on init option is a holdover that I’ll remove for the next version push. I don’t have the library for the AMS5812 finished, I’ll put an order in for a board and hopefully have one read by the end of the week

Hi Trey,

I think the node-red node for the ADS1115 has a problem.

My setup:
PR33-7(4-20mA receiver) connected to PR33-26 (4-20mA transmitter).
The transmitter sends 8mA to the receiver via my multimeter. The multimeter reads 8mA. So the transmitter works fine.
No matter what mA reading I send the debug node on the receiver keeps printing “channel_1: 20.577676”
Below my flow

[{"id":"5fd7c91e.bbefa8","type":"ncd-ads1115","z":"b7a2e96c.0f4228","name":"","connection":"af479a17.b8d368","addr":"72","interval":"2000","outputs":1,"output_all":false,"output_mult":"0.000628","channel_1":"4","channel_2":"_none","channel_3":"_none","channel_4":"_none","gain":"2","mode":1,"rate":4,"compMode":0,"compPol":0,"compLat":0,"compQueue":3,"delay":"100","x":100,"y":1220,"wires":[["c80cc019.452da"]]},{"id":"c80cc019.452da","type":"debug","z":"b7a2e96c.0f4228","name":"receiver","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":280,"y":1220,"wires":[]},{"id":"1281f267.4ec2ae","type":"comment","z":"b7a2e96c.0f4228","name":"4-20mA rx ADS1115: PR33-7 (0x48=72)","info":"","x":200,"y":1160,"wires":[]},{"id":"445c94b2.66ff2c","type":"ncd-mcp4725","z":"b7a2e96c.0f4228","name":"","connection":"af479a17.b8d368","addr":"96","persist":"","startup":false,"eeprom_pd":0,"eeprom_dac":0,"x":310,"y":980,"wires":[["874d4949.55c918"]]},{"id":"874d4949.55c918","type":"debug","z":"b7a2e96c.0f4228","name":"transmitter","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":510,"y":980,"wires":[]},{"id":"aaf7fa44.c8e388","type":"comment","z":"b7a2e96c.0f4228","name":"4-20mA tx MCP4725: PR33-26 (default 0x60=96, 0x61=97); input=0-4095","info":"","x":310,"y":920,"wires":[]},{"id":"175ad7a3.2b77c8","type":"inject","z":"b7a2e96c.0f4228","name":"","topic":"","payload":"8","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":980,"wires":[["1c7b9d4c.21c703"]]},{"id":"1c7b9d4c.21c703","type":"function","z":"b7a2e96c.0f4228","name":"","func":"const I = msg.payload;\nconst x=4095*I/26;\nmsg.payload=x.toString();\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":1080,"wires":[["445c94b2.66ff2c"]]},{"id":"af479a17.b8d368","type":"ncd-comm","z":"","name":"","bus":"i2c-1","commType":"standard","addr":"0","useMux":false,"muxAddr":"112","muxPort":"0"}]

Any advice?

Hi Trey,

I think the PCA9536 node-red node also has problems.

I have a PR33-20 (optically isolated inputs). The debug node does not show any changes when channel one changes (when I flip a switch).

Best regards,
George

Hi George,

I’ll set up some test today and check it out, I’ll let you know as soon as I have something. Thanks!

RE: the MCP4725 & ADS1115

I imported your flow and plugged in my boards and after clicking the inject node the receiver outputs 8.5 on channel 1, a little variation can be expected from board to board which is why there is a multiplier field, but reading 20 when you are only outputting 8 is a bit wild. Could you post a picture of the two boards wired together?

RE: The PCA9536

I just tested this board and it worked as expected, let me see if I can get one of the optically isolated versions so we can make sure there isn’t an electronic problem.

Re: PR33-20
the inputs of the boards are digital inputs not contact closers inputs. You could use them as contact closure inputs by doing this
connect the one input( lets say of channel one) to the voltage( you can connect to 5V).
connect the one end of the switch to Gnd and other end to the input two( of channel one).

Thanks

There is a new package that has been published, ncd-red-ams5812

Hi!
I have an adafruit mcp4725 board, i imported it successfully the mcp4725 node. The i2cdetect says that board address is 62 (or 63, A0 connected to GND or Vdd). In the mcp4725 node the selectable address is only 96 or 97. The node can’t connect the board, the status is disconnected…