Getting started with Photon and NCD 10 amp relay

I will start off like many others. I am really new to this. I am trying to find info on controlling the relay with a schedule, but am not having much luck. The end goal is to be able to set the relay to momentary for several scheduled times/day, but for now I would just settle for getting the photon set up to run one schedule just to see it work. Any suggestions on where to start?

Hi,

If you want to do this with a Particle interface board then as luck would have it I wrote an article about it here:

If you have any questions on this please let me know.
Thank you,
Travis Elliott

1 Like

Thanks @Travis. I did find this yesterday after I posted this. I had a few issues adapting it to the Particle interface 1 relay board, but I think I may have figured it out. However, when I went to Mobicle.io, the site would not load, so I have not been able to test my work. I noticed there is a thread on here now asking if Mobicle.io has been discontinued.

Hi,

Mobicle is back online now.

Hello. I had to step away from this program for a while and am just now getting back to it. I have modified the Time schedule activated Particle Photon relay controller app to work with NCD1Relay instead of the 8-relay shield. I changed the executeCommand to only have on, off, and toggle shown below:

void executeCommand(int commandID, int commandData){
    switch(commandID){
        case 0:
            //Turn On Relay
            controller.turnOnRelay();
            break;
        case 1:
            //Turn Off Relay
            controller.turnOffRelay();
            break;
        case 2:
            //Toggle Relay
            controller.toggleRelay();
            break;    
        
    }

The issue I am having now is that I can only submit one schedule at a time. Using mobicle.io I can enter in the event publisher 2019,0,0,0,24,60,0,0,1 and it will turn on the relay or I can enter 2019,0,0,0,24,60,0,1,1 and it will turn off the relay. It really doesn’t seem to matter if I put in 0, 1, or 255 in the last spot, it still works. What I really want to do is turn the relay on and then 1-5 seconds later, turn it off. But I can’t even get it to turn it off in the next minute much less the next second. I tried 2019,0,0,0,24,1,0,0,1,2019,0,0,0,24,2,0,1,1 to see if I could turn it on in minute 1 and then turn it off in minute 2 but it didn’t work. Is there a way I could edit the executeCommand to turn on the relay and then delay for 1 sec and turn back off?

@swstrib
Can you share your current version of firmware you are flashing into the Photon? If you are editing the code in Particle’s Web IDE there is a share current revision button which will give you a link you can share here.

@Travis I think this is what you are asking for. Let me know if you are needing something different.

https://go.particle.io/shared_apps/5cb38b71e26bbb00051932db

Honestly I wrote this firmware a long time ago and I don’t remember much about how it functions. Have you hooked up to the Photon over USB and monitored the serial output? It looks like I had a lot of serial prints in the firmware so that might point some information out.

No I haven’t. Got any info on how to monitor the serial output through the USB. Definite noob here.

You’ll want to install Particle’s CLI, instructions on that here:
https://docs.particle.io/tutorials/developer-tools/cli/

Once you have that installed open your Terminal/Command Prompt and enter
particle serial monitor
That should open a serial connection to the Particle module and will output the serial prints which are life saving when it comes to code debugging.