Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
James Caska
Published © MIT

Virtual Breadboard Smart Home Alexa Skill + Edge:Bit Gadget

Effortlessly roll your own smart home applications with drag-and-drop Alexa 'aware' controls in the Virtual Breadboard Microsoft Store App.

BeginnerProtip30 minutes8,480

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Seeed Studio Grove - Infrared Emitter
×1
Grove - Relay
Seeed Studio Grove - Relay
×1
Virtual Breadboard Edge:Bit
×1
Seeed Studio Grove - Infrared Receiver
×1

Software apps and online services

Virtual Breadboard App

Story

Read more

Schematics

Virtualized Test Application

The virtual breadboard layout of a Alexa endpoint, Infrared encoder and virtual arduino infrared decoder application driving a remote relay

Alexa Home Controller with infrared Edge:Bit

A deployable home controller configuration which passes through Alexa commands to a real Arduino Infrared receiver that is controlling a relay

Arduino UNO Remote Relay Controller

Schematic for configuring the real Arduino Uno with the IR and Relay modules

Code

Infrared Controlled Relay Lamp

Arduino
An Arduino Infrared receiver application to remotely control a relay which can be connected to LAMP or anything else
/***********************************************
* Infrared Controlled Relay Lamp
************************************************/
#include <IRremote.h>
const long IR_CODE_ON   = 0xFFA25D;
const long IR_CODE_OFF  = 0xFF629D;
const int PIN_IR_RECEIVE = 7; //SIG of receiver module attach to pin7 
const int PIN_LED  = 13;      //built-in led on Pin 13
const int PIN_LAMP_RELAY = 12;//Lamp Relay on pin 12 

IRrecv irrecv(PIN_IR_RECEIVE); //Creates a variable of type IRrecv
decode_results results;
void setup()
{
  pinMode(PIN_LAMP_RELAY,OUTPUT);
  digitalWrite(PIN_LAMP_RELAY,HIGH);  //turn off the Lamp - Active Low
   
  pinMode(PIN_IR_RECEIVE,INPUT);
  pinMode(PIN_LED,OUTPUT);            //set ledpin as OUTPUT
  
  Serial.begin(9600);                 //initialize serial 
  Serial.println("Starting Lamp");
  irrecv.enableIRIn();                //enable ir receiver module 
  irrecv.blink13(1);                  //Flash Pin 13 when receiving IR data 
}
void loop() 
{
   
  if (irrecv.decode(&results)) //if the ir receiver module receiver data
  { 
    Serial.print("Received Code: ");  
    Serial.println(results.value, HEX);  
 
    irrecv.resume(); // Receive the next value 
  } 
  delay(600); //delay 600ms
  if(results.value == IR_CODE_ON)//if receiver module receive OxFFA25D
  {
    digitalWrite(PIN_LAMP_RELAY,LOW);//turn on the led
    Serial.println("Alexa, Lamp On");
  }
  else if(results.value == IR_CODE_OFF)
  {
    digitalWrite(PIN_LAMP_RELAY,HIGH);//turn off the led
    Serial.println("Alexa, Lamp Off");
  }
   results.value = 0;
}
 

Credits

James Caska

James Caska

18 projects • 33 followers
Creator of VirtualBreadboard

Comments