Controlling NCDRelay24 with Particle and Node Red


#1

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!


#2

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?


#3

Hi,

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.


#4

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


#5

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


#6

#7

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.


#8

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.


#9

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?


#10

You can use the screw terminal breakout board: https://store.ncd.io/product/screw-terminal-breakout-board-for-particle-photon-with-power-supply/


#11

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.


#12

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.