Things used in this project

Hardware components:
Amazon echo dot
Amazon Alexa Echo Dot
×1
Photon new
Particle Photon
×1
Mcp23008 scr8g5le 10a b%20(1)
ControlEverything.com Relay Shield for Particle Photon I²C 8-Channel SPDT 10-Amp
×1
Software apps and online services:
Particle Online build for particle photon
Gawd2jnp51w1h1ccsulo
IFTTT Amazon Alexa service
Hand tools and fabrication machines:
Screwdriver
To screw in hot leg to COM of relay
Wire cutter

Schematics

Video - Working model
RiySQOqGjFi9KlZu8cM8.mp4

Code

Code to control Relay Shield for Particle Photon I²C 2-Channel DPDT 5-Amp with WiFi and USBArduino
#if PLATFORM_ID == 6
//Photon code here

    #define MY_FUNCTION(cloudFunctionID,localFunctionName)   Particle.function(cloudFunctionID,localFunctionName) 
    #define MY_VARIABLE(cloudVariableID,localVariableName)   Particle.variable(cloudVariableID,localVariableName) 
    
    // This #include statement was automatically added by the Particle IDE.
    #include "NCD2Relay/NCD2Relay.h"
    
    /*For relay control*/
    NCD2Relay relayController;
    
   
    /*Relay number*/
    int relayNumber = 1;
    
    /*Relay status*/
    int rStatus = 0;
    /***********************************Relay END**************************************/
    
    int commandSent = 255;
 
    void setup() 
    {
        setupFunctions();
        setupRelay();
    }
    
    void loop() 
    {
       
    }
    
    void setupFunctions()
    {
        MY_FUNCTION("Relay#",setRelayNumber);
        MY_FUNCTION("RelayAction",setResetRelay);  
    }
    
    void setupVariables()
    {
    }
    
    void setupRelay()
    {
        Serial.begin(9600);
        relayController.setAddress(0,0,0);
    }
    

    
    int setRelayNumber(String command)
    {
        if (command.length() != 1) 
            return -1;
    
        relayNumber = atoi(command);
                
    }
    
    int setResetRelay(String command)
    {
        if (command.length() != 1) 
            return -1;
        
        commandSent = atoi(command);

        if (commandSent==1) 
        {
            rStatus = relayController.readRelayStatus(relayNumber);
            
            if(rStatus==0)
            {
              relayController.turnOnRelay(relayNumber);  
            }

            return rStatus;
        }
        else if(commandSent==0)
        {
            rStatus = relayController.readRelayStatus(relayNumber);
            
            if(rStatus==1)
            {
                relayController.turnOffRelay(relayNumber);
            }
            

            return rStatus; 
        }
    }


#else
    #error "*** PLATFORM_ID not supported by this library. PLATFORM should be Core or Photon ***"
#endif

Credits

T4ay8khmmkybgrh5mg54
Jay K

HMI Architect - Automotive domain

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Blynk GPS Tracker
Intermediate
  • 218
  • 5

Full instructions

Simple GPS tracker using a Particle Photon (or Electron) and an EM406 GPS module with location visible on Blynk app map.

Pool Buddy
Intermediate
  • 1,847
  • 11

Work in progress

Monitor and log water quality (pH & ORP) and temperature from everywhere.

IoT Thermometer Using Python
Intermediate
  • 1,200
  • 10

Full instructions

How to develop a simple but powerful IoT thermometer using a Zerynth-powered single-board MCU and the Zerynth App.

Particle Photon Flip Dot Clock
Intermediate
  • 2,213
  • 31

Full instructions

The flip dot display uses an electromechanical dot matrix that spin from black to yellow to display text, numbers and more!

Do You Know How Your Plants Are Feeling? [Particle+Ubidots]
Intermediate
  • 186
  • 4

Full instructions

Build and deploy a soil moisture and temperature sensor for commercial greenhouses or private garden monitoring and treatment.

Patriot iOS App
Intermediate
  • 560
  • 9

Use an old iPhone device to control and display the status of your Patriot IoT devices.

Patriot iOS App

Team Patriot

Add projectSign up / Login