NCD1Relay + Particle

I’m very new to this and I’m for some answers. I have a 1 channel relay with the Photon. I loaded the CloudControl code on to it and I’m able to push functions to it.

Is there a way to remotely see what the current state of the relay is? I’m using to control it. Thanks for the help!

So the most straightforward way is to publish an event or a variable to particle. Something like Particle.publish(‘relayStatus’, relayController.readRelayStatus());

Hi there @oraclerouter ,
if you want to monitor your relay from your Android phone you may want to check this project out:


1 Like

No sure if this is asking for too much but would you walk me through this? how can i adjust the CloudControl code to publish the event?

int triggerRelay(String command);

bool tripped[7];

int debugTrips[7];

int minTrips = 5;

int relayStatus; //New Line!!

/* This function is called once at start up ----------------------------------*/
void setup()
	Particle.function("controlRelay", triggerRelay);
    Particle.variable("relayStatus", relayStatus); //New Line!!

/* This function loops forever --------------------------------------------*/
void loop()
	int status = relayController.readAllInputs();
    relayStatus = relayController.readRelayStatus(); //New Line!!
	int a = 0;

There are 3 new lines that are commented, just add those and you should see a new variable show up in Mobicle, it will be 1 when the relay is on, and 0 otherwise.

Perfect! Really appreciate it!