Casey Ahaus
Published

Non Intrusive Smart Lightswitch

This smart toggle switch can be installed on any light switch utilizing only the two existing screws for the plate.

IntermediateFull instructions provided10 hours14
Non Intrusive Smart Lightswitch

Things used in this project

Hardware components

SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Argon
Particle Argon
×1
3D Printer
×1
Hook Up Wire Kit, 22 AWG
Hook Up Wire Kit, 22 AWG
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1

Software apps and online services

3D Printer Slicer
Creo Parametric

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Custom parts and enclosures

Connecting rod for crank slider

Half of the enclosure

Other half of the enclosure

Constraining support for crank slider

Crank slider box

Schematics

Image of pin connections

Code

Particle Argon Code

C/C++
This code is implemented through the particle web IDE and uses events published by Alexa to operate.
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created

int pos = 0;// variable to store the servo position
int fanSwitch(String command)
{
    if(command.equals("On"))
    {
        myservo.write(22);
        return 1;
    }
    if(command.equals("Off"))
    {
        myservo.write(100);
        return 0;
    }
    else
    {
        return -1;
    }
}



void setup()
{
  myservo.attach(A3);
  Particle.function("On", fanSwitch); 
   // attaches the servo on the A3 pin to the servo object
  // Only supported on pins that have PWM
}


void loop()
{

 // for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
 // {                                  // in steps of 1 degree
  //  myservo.write(pos);              // tell servo to go to position in variable 'pos'
 //   delay(15);                       // waits 15ms for the servo to reach the position
 // }
 // for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
 // {
  //  myservo.write(pos);              // tell servo to go to position in variable 'pos'
  //  delay(15);                       // waits 15ms for the servo to reach the position
 // }
}

Credits

Casey Ahaus

Casey Ahaus

1 project • 0 followers
I am a mechanical engineering student at the University of North Carolina Charlotte. This page is a way for me to showcase my many projects!

Comments

Add projectSign up / Login