I am following a tutorial in book "Programming with Node-RED" by Dogan Ibrahim
Using TMP 36, MCP3002 , on Raspberry pi 3 B.
I received the error message in the subject bar above. I have been over my wiring and confirmed connections to TMP MCP3002 and Rpi GPIO.
I will do my best. I followed a tutorial that had a pi reading from a TMP 36 temperature sensor utilizing a MCP3002 ADC connected to GPIO 7,9,10,11. The output was set up to go to a dashboard with a gage and a chart. The TMP was obviously not getting read as the gage never showed anything other than 0 degrees C. I would love to clip the actual flow or a screen shot illustrating the nodes into this reply but I don't know how. The error message appeared in the sidebar as soon as the flow was deployed. I also noted that the TMP 36 was super hot, given that I verified voltages from the rpi and the ADC (3.3v) I am not running that rpi at the moment (rpi 3 B) so when I go back to it I can provide screen shots of the node setups. I am really surprised that the TMP was getting that hot with only 3.3 volts. Did not look at the current as I lack a True RMS amp probe.
I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.
An error like that is most likely coming from a Function node.
If you hover over the error message in the debug sidebar it will highlight which node logged it. If the node isnt currently visible then you should see its id in the too right corner of the debug message. Click on that should take you to the node in question.
That is the node we need details of.vifnits a function node, please share the code inside. Be sure to use the </> button in the forum window when replying to format code properly.
My guess is you have a function node trying to use msg.payload.dnum or something like that, but the property doesn't exist. If that is the case, you need to look at what messages you are passing into that node. You can do that by adding a Debug node next to the function node. It is then a case of working back from there.
Hello,
The message comes is at this point in my flow at A/D Converter Node node-red-node-pi-mcp3008 (node) - Node-RED (I see you are a Maintainer) I am assuming at this point that there may be a problem upstream in my circuit. I noticed that my temp sensor a TMP36 was over heating, which could indicate that it was not sending anything to my MCP3002 ADC? The question is would reading nothing cause a type miss-match to arise at the A/D converter node? I pulled all of the jumpers off of my bread board, and am going to run a py script to test a couple of TMP36's and match the wiring config up with that of the tutorial I was following. I use these sensors in a lot of instances and have never has this happen.
Below is the set up of the
Device: mcp3002
Input pin: A0
Device ID: CE1
SPI Bus: 0
Function Node Code For Reference:
var mV = msg.payload*3300.0/1024.0;
var T = (mV - 500.0)/10.0;
msg.payload = T.toFixed(1);
return msg;
Done. Changed Name to TempRead. This name did show up in the error message. This then indicates that either the MCP3/D3002 is not reading the TMP3002, or the 3002 is not connected to the correct GPIO pins. I don't see how the Rpi knows which GPIO it is supposed to be reading by looking at either the Function node, or the A/D Converter node?
The connections are as below:
ADC Rpi
P7. CLK GPIO 11
P5 Din GPIO 10
P6 Dout GPIO 9
P1 CS GPIO 7
P 4 GND GND
P 8 Vdd 3.3V
P2 TMP 36 Vo
Did you run raspi-config as described on the page you linked to?
When you send the node a message what do you get out? Wire it to a config [Edit: debug] node and show us what it says. You can paste a screenshot of the debug pane here.
Also please stop node red and start it again in a terminal and post the full console output here, up to the point where you send the node a message.
[Edit] Also please select the node and click Ctrl-E to export it and paste it here. When pasting use the </> button at the top of the forum entry window.
First thank you for the attention that you are giving to this process! Much appreciated.
I did run raspi-config and enabled SPI. I am afraid I was not familiar enough with process to "wire to a config node" to retrieve a message. I have copied the dialog from when I deployed the flow after restarting Node-RED>
Terminal Logs here:
28 Nov 16:49:18 - [info]
Welcome to Node-RED
===================
28 Nov 16:49:18 - [info] Node-RED version: v2.1.3
28 Nov 16:49:18 - [info] Node.js version: v14.18.1
28 Nov 16:49:18 - [info] Linux 5.10.63-v7+ arm LE
28 Nov 16:49:19 - [info] Loading palette nodes
28 Nov 16:49:23 - [info] Dashboard version 3.1.2 started at /ui
28 Nov 16:49:23 - [info] Settings file : /home/pi/.node-red/settings.js
28 Nov 16:49:23 - [info] Context store : 'default' [module=memory]
28 Nov 16:49:23 - [info] User directory : /home/pi/.node-red
28 Nov 16:49:23 - [info] Projects directory: /home/pi/.node-red/projects
28 Nov 16:49:23 - [info] Server now running at http://127.0.0.1:1880/
28 Nov 16:49:23 - [info] Active project : NodePower1
28 Nov 16:49:23 - [info] Flows file : /home/pi/.node-red/projects/NodePower1/flow.json
28 Nov 16:49:23 - [info] Starting flows
28 Nov 16:49:23 - [error] [pimcp3008:9f8295ed52ea363a] TypeError: Cannot read property 'dnum' of undefined
28 Nov 16:49:23 - [info] Started flows
28 Nov 16:51:37 - [info] Stopping modified nodes
28 Nov 16:51:37 - [info] Stopped modified nodes
28 Nov 16:51:37 - [info] Starting modified nodes
28 Nov 16:51:37 - [error] [pimcp3008:9f8295ed52ea363a] TypeError: Cannot read property 'dnum' of undefined
28 Nov 16:51:37 - [info] Started modified nodes
node.js script here: Editing previous post here==== I see below "dnum": "1", is this where the node should be reading voltage?
Just installed new version of MCP3008 what ever you did, did the trick. The dashboard worked beautifully after. Thanks ever so much for everyones help. Someday I will want to know what you changed to make the difference?