contrib-grove-capacitive-moisture-sensor

I'm starting with grove sensor and node-RED with my Raspi 3.

I already installed node-RED server. I can connect actually :

DHT11 (temp and humidity)

Ds18b20 (temp)

Relay

remote to my phone

My problem is about moisture sensor, when I use "grove capacitive moisture sensor" node, my server crash and I can see an error on log :

error: command failed : python -u /home/pi/.node-red/node_modules/node-red-contrib-grove-capacitive-moisture-sensor/grove-capacity-moisture-sensor.py 4 
at ChildProcess.exithandler (node:child_process:400:12) 
at ChildProcess.emit (node:events:513:28) 
at maybeClose (node:internal/child_process:1093:16) 
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) { code: 2, killed: false, signal: null, cmd: 'python -u /home/pi/.node-red/node_modules/node-red-contrib-grove-capacitive-moisture-sensor/grove-capacitive-moisture-sensor.py 4'

Sensor is connected to A4 like an analog sensor. I don't understand why doesn't work. I use timestamp on input like other sensor but you 're talking about trigger. Why we must to use trigger for input ? What is the the setup of the trigger ?

My setup :

Raspi 3 Grove base hat Node-RED server

Thanks for your return and your help

For context, the Stack Overflow question where we've already discussed this:

1 Like

Welcome to the forum @fenneck

What happens if you run that command in an exec node?
python -u /home/pi/.node-red/node_modules/node-red-contrib-grove-capacitive-moisture-sensor/grove-capacitive-moisture-sensor.py 4

Make sure you check the error output of the exec node.

Hi Colin,

Thanks.

Just to be sure, I must to use a timestamp connected on exec node (with the command) and a debug node ?

Yes, put the command in the exec node, make sure Append Payload is not set. Three debug nodes, with names, set to Output complete message.

Ok, I had same output : command failed. (I used one debug node)

I don't understand why I must to use three debug node on this case !!

After that, I changed file "adc.py" on dist-package on line 57 : self, address = 0x08 (before value was 0x04) on usr/local/lib/python2.7 and now, I have some value on debug node. (one debug node again)

I already do this modification on dist-package for python3.7 but not for python2.7.

So that's a good news. Now if I try with node-red-contrib-capasitive-moisture node, I haven't error on node-red-log but on the debug node I can see : payload : function

My setup : timestamp - trigger node - moisture node - debug node.

Ok, I changed trigger node to wait for 1 second and now ...... I have value on debug node and gaude node.

Do you mean all is now working?

It is best initially to not use auto trigger, trigger it manually by clicking the button when you want to test it.

The reason for the three debug nodes was so that there is one on each output and you can see what is being sent to each output

Yes moisture sensor is working.

In fact, I have a hat "MM32" and we must to change value on ADC.PY for each python version. Node-RED use python2.7.

So now, I must to find solution to turn on my relay from moisture value to activate water pump or not.

About trigger, I must to understand with more test.

Thanks for your help Colin, exec node is a good tool to test command...

The principle use is not for testing, but for calling software from node red. It is common to use it where python software exists for interfacing with hardware, for example.

1 Like

I understand.

I must to use more this software ! I like it :heart_eyes:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.