Random and expensive relay behavior

I am having a problem with a new build. I made a controller to for lights and 3 sprinkler heads. the lights work fine but I have this very strange transient activation of the sprinklers. It happens after I start any of the three sprinklers, they will just randomly turn on, sometimes its all three, or two or one. I thought it was something to do with the MQTT connections, so I removed those, no change. The really strange thing is if I reboot the pi the valves will stay closed until I use one of the sprinklers then at a random time within an hour they will turn back on. The switch on the dash board shows OFF but the valves are ON. I don't expect anyone to know what the actual issue is, but how would I go about diagnosing the problem?
Here are some of the variables:
1- I believe that the issue is on the software side of the project, however the sprinklers wiring is all on the same section of a PCB I had made but I have not had any issues with that board design in the past.
2- The pi is controlling an 8 relay board and a 2 relay board.
3- The lights take up 7 of the 8 relays and the sprinklers are 1 of the 8 and 2 of the double relay.
4- this strange behavior does not show up in the lights they work as expected with MQTT control as well as turning them on with the dashboard. They stay off when told to.
5- I put a node in to send me a text when the sprinklers turn on and it works to let me know when they turn on during these random events.
6- I just changed the setting to not pass on messages on input for the dash board switches. Ill see if that helps
7- Component List:
Raspberry pi ZERO W
8 Relay PCB
2 Relay PCB
custom PCB made by OSH park
12v Power supply for lights
24v PS for sprinklers
Node Red version 0.20.7

I just rebooted the Pi and here is the log file in italics the mystery activations is in BOLD at 12:48:54 and 12:48:56 How do find out where those came from? alternatively could I make it so they won't turn on unless the ON signal last for more than a set period of time like 5 seconds? Also I removed my cell number from the outgoing text messages (it seemed prudent).

Welcome to Node-RED


3 Oct 12:01:25 - [info] Node-RED version: v0.20.7

3 Oct 12:01:25 - [info] Node.js version: v10.16.3

3 Oct 12:01:25 - [info] Linux 4.19.66+ arm LE

3 Oct 12:01:32 - [info] Loading palette nodes

3 Oct 12:02:14 - [info] Dashboard version 2.9.4 started at /ui

3 Oct 12:02:20 - [warn] ------------------------------------------------------

3 Oct 12:02:20 - [warn] [node-red-node-serialport/serialport] Error: The module '/home/pi/.node-red/node_modules/serialport/build/Release/serialport.node'

was compiled against a different Node.js version using

NODE_MODULE_VERSION 57. This version of Node.js requires

NODE_MODULE_VERSION 64. Please try re-compiling or re-installing

the module (for instance, using npm rebuild or npm install).

3 Oct 12:02:20 - [warn] ------------------------------------------------------

3 Oct 12:02:20 - [info] Settings file : /home/pi/.node-red/settings.js

3 Oct 12:02:20 - [info] Context store : 'default' [module=memory]

3 Oct 12:02:20 - [info] User directory : /home/pi/.node-red

3 Oct 12:02:20 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable

3 Oct 12:02:20 - [info] Flows file : /home/pi/.node-red/flows_PiZero1.json

3 Oct 12:02:21 - [info] Server now running at

3 Oct 12:02:22 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials

file will not be recoverable, you will have to delete it and re-enter

your credentials.

You should set your own key using the 'credentialSecret' option in

your settings file. Node-RED will then re-encrypt your credentials

file using your chosen key the next time you deploy a change.


3 Oct 12:02:22 - [info] Starting flows

3 Oct 12:02:28 - [info] Started flows

3 Oct 12:02:28 - [info] [mqtt-broker:3e69c5d4.03834a] Connected to broker: mqtt://

3 Oct 12:02:28 - [info] [mqtt-broker:61168edb.d86df8] Connected to broker: mqtt://

3 Oct 12:03:43 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570129423 z25sm3384502pfn.7 - gsmtp

3 Oct 12:03:45 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570129425 22sm3688023pfo.131 - gsmtp

3 Oct 12:03:46 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570129426 p190sm3967793pfb.160 - gsmtp

3 Oct 12:48:54 - [warn] [rpi-gpio out:Garden Beds Front 1 (06) Purple] Invalid input: NaN

3 Oct 12:48:56 - [warn] [rpi-gpio out:Water Valve 3 (19) grey] Invalid input: NaN

3 Oct 12:48:56 - [warn] [rpi-gpio out:Front Lawn and Hedge (13) Grey] Invalid input: NaN

3 Oct 12:49:01 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570132140 c128sm3890490pfc.166 - gsmtp

3 Oct 12:49:02 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570132142 f3sm3077814pgj.62 - gsmtp

3 Oct 12:49:03 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570132142 p189sm4635908pfp.163 - gsmtp

3 Oct 12:49:39 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570132179 p68sm5985059pfp.9 - gsmtp

3 Oct 12:49:40 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570132180 207sm4584435pfu.129 - gsmtp

3 Oct 12:49:42 - [info] [e-mail:@vtext.com] Message sent: 250 2.0.0 OK 1570132181 f185sm4918823pfb.183 - gsmtp

Here are some pics of the project if they help
Thank you

So NaN means not a number.

Have you thought of writing the values to a file so you can determine what you are sending which might make it easier to work out where they are coming from?

Add some debug nodes to your flow, set to send the output to the console. Give the nodes names so they can be easily identified in the output. Then when it goes wrong you can look at the log and work out where it is failing.

Solved! I'm not the best at details and I missed a big one! I have some power controlled by TIP 120 transistors and some by relays on different Pi's and different flows. Each type of device uses different numbers for on or off. The relays turn on with 0 the TIPS turn on with 1. I cut and pasted a working flow from one sprinkler system to another and changed the switch node but not the My Time Out node. The timing seemed random because the 3 sprinklers are on different timers! This issue has made me standardize my projects back to relays, I'll take the bigger form factor for my projects in exchange for more reliability and repeatability. Colin and Moose thank you for the help. Also the My Time Out sends a "Warning" message when its about to shut down that was the NAN message, I removed that too. Thank you both.

I have had a several issues using TIP120's. Any advise on a small device to switch 12v for LED projects that are reliable and tiny? I make a lot of these types of projects and would love to find something as reliable as a relay but smaller. I made a PCB to hold 5 TIPs but the holes were to small and it was a pain. I realize this is a hardware question but I thought someone might have a better mousetrap.
thanks all!

I looked up the datasheet for a TIP120 and my question would be what kind of isolation are you using? You say you are switching 12 volts so are you putting 12 volts directly on the collector? and if so are you putting 3.3 volts directly on the base? If so, you are really playing with fire. Semi's are fairly robust these days but if it does fail it would likely put 12v directly on the GPIO and when it does all the smoke will come out of the board. And you can never put the smoke back in so that the circuit works. Been there. You need to isolate the 3.3 from the 12 by some means. Opto isolator or a circuit that has an opto isolator built in. Adafruint and Sparkfun both sell logic level convertors that would do the trick. How much current is your LED's drawing? The 120 says it will handle 5 amps is that close? Is there some need to have a semi in the circuit? Are you pulsing the ouput or is it an on/off situation? There are tons of FET's that fit the bill but you really should isolate the output from the 12 volts. If you use a relay, of which there are tons of 3.3 relays you get built in isolation and most will easily handle 5 amps.

1 Like

What about some of the premade boards that use a Solid state relay (if the load is not great) such as