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

AquaNiner Pet Hydration Monitor
Intermediate
  • 342
  • 14

Full instructions

Using two Photons, IFTTT and ThingSpeak, get notifications for when your furry friend needs water and monitor how much they're drinking.

Hot Shot Hoops
Intermediate
  • 427
  • 12

Full instructions

No need to keep track of the number of baskets you make when shooting hoops. Hot Shot Hoops does the work for you.

Hot Shot Hoops

Team IOT Basketball

Temperature Mirror
Intermediate
  • 346
  • 8

Full instructions

The Temperature Mirror incorporates a digital display to allow its user to readily view time, temperature, humidity, and light.

Temperature Mirror

MEGR3171 Team 49

Pet Feeder
Intermediate
  • 368
  • 7

Full instructions

Automated pet food dispenser to feed our pets when we are not at home by using an IoT device.

Teacher Tracker
Intermediate
  • 159
  • 4

Full instructions

If you want to know when a professor comes back to his/her office so you can ask annoying questions then this an option

LightAlert
Intermediate
  • 124
  • 4

Full instructions

As the great Terry Crews once said "that's 49 cents of milk spilt over the table! Somebody's gonna drink that!" But instead... electricity.

Add projectSign up / Login
Respect project