Controlling NCDRelay24 with Particle and Node Red


I’m looking for some help controlling my 24 Relay board with Home Assistant. My board has the Photon header and I use Node Red within HA. Can anyone give me some pointers and/or assistance?

Also, is it possible to rename the relays from their numbers to something more user friendly?

Thank you!


So I did install the particle node and have it working. I’m able to turn relays on and off, so that is a success.

Now, I need to know how to create functions that can activate various relays. How do I do that using the existing library? Is it possible to use the relayCommand function within another function?



You can call relayCommand from within another function.

To call functions from the Node-Red Particle library (I’m not extremely familiar with the Node-Red Particle library) you should just be able to expose those functions in the code on your Particle module.


Thank you. Does the particle library allow control of the gpio and if so, how?


Can you link to the Particle library you’re using?



I’m trying to read a temperature sensor (2-wire) and not sure how I would wire it. I guess I can play with the various inputs and see what I come up with.

I’m also looking to integrate the VL53L0X distance sensor which uses 2 input pins.

What I would like to understand is if I can use the same code I"m currently using on the sensors, and if so, how the gpio is referenced on the board. For example A0, D1, D0, etc on the Photon relates to what on the NCD relay gpio section.


It looks like that library initializes those GPIOs as inputs, you’d need to alter it to set the GPIOs as outputs.

Looks like you can just add another Wire.write(0); in the group around line 32.

I can’t be sure as I don’t have a setup to test on here, but try that.

The GPIOs on the 24-Channel relay controllers don’t relate back to the photon, they are independently operated using on-board chips. They wouldn’t be much use with a temperature sensor as they only return a 1 or a 0. You would need an ADC board to get sensor values.


I was hoping I could use the inputs to read temperature, etc as the main reason I bought the board was so that I would have a clean look without a bunch of wires running directly from the photon. Is there a more elegant way to access the photon pins?


You can use the screw terminal breakout board:


That’s pretty slick. How does it connect to the relay board? Would be awesome if there was a “top hat” version that just stacked into the existing connector.

Alternatively, I might just do all my “sensors” on a separate photon and share the data between the two devices.


Right now I’m having issues with my firmware code playing nice with the NCD “cloud control” ino, so I need to figure that out first. Probably better served in a different thread.