Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
NerdFatherRJ
Published © GPL3+

Cuckoo IR Alexa

Funny Cuckoo controlled by Alexa.

BeginnerShowcase (no instructions)452
Cuckoo IR Alexa

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Breadboard mini 170p
×1
Buzzer
Buzzer
×1
IR receiver (generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Jumper wires (generic)
Jumper wires (generic)
×1
4xAA battery holder
4xAA battery holder
×1
AA Batteries
AA Batteries
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Eletronics

THis picture is with Arduino Uno, but I did build with Nano board

Code

Cuckoo

Arduino
/*
 Cuckoo was inspired in Cuckoo Clocks, but it only show the bird showing through a Window
 and doing a "Cockoo Song" when it receives an command through IR remote.
 Simple as that.

 But the funny part:  If you have a personal assistant like Alexa, Google ou Siri, linked to an 
 Universal Remote, just locate the Cuckoo in a visible direction to this IR transmitter and program
 a scene when you said something like " Alexa, tell me de time." Alexa will tell you the time
 and start Cuckoo. The other scene is program Alexa to say the time and star cuckoo every hour
 or whatever you imagine.

Fabio - Nerdfatherrj at Arduino Projetc Hub.
Dec,2020. 
*/



#include <TimerFreeTone.h> //This library does not have Timers to conflict with IRremote.
#include <IRremote.h> //Library to control IR devices
#include <Servo.h> 

#define TONE_PIN 4 //digital port for Buzzer
Servo Srv;
int RECV_PIN = 8;  //digital port for IR Led
float armazenavalor;  
int Fora = 23; //Must calibrate to suit your needs.
int Dentro = 100; //Must calibrate to suit your needs.
IRrecv irrecv(RECV_PIN);  
decode_results results;  
  
void setup()  
{  
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Serial.begin(9600);  
irrecv.enableIRIn(); // Inicializa o receptor IR  
Srv.attach(7); 
delay(250); 
Srv.write(Dentro); 
}  //end setup
   
void loop()  
{  
  if (irrecv.decode(&results))  
  {  
    Serial.print("Valor lido : ");  
    Serial.println(results.value, HEX); 
    armazenavalor = (results.value);  
  
   if (armazenavalor == 0xFF30CF) //button "1" pressed  
   {  
 
// digitalWrite(LED_BUILTIN, HIGH);  this is for testing purposes. Not needed.

Srv.write(Fora);
delay(500);
TimerFreeTone(TONE_PIN,294, 100);
delay(100);
TimerFreeTone(TONE_PIN,494, 300); 
delay(700);
TimerFreeTone(TONE_PIN,294, 100);
delay(100);
TimerFreeTone(TONE_PIN,494, 300);
delay(700);
TimerFreeTone(TONE_PIN,294, 100);
delay(100);
TimerFreeTone(TONE_PIN,494, 300);
delay(700);

Srv.write(Dentro);
    
   }  
    
irrecv.resume(); //Le o próximo valor  
  }


  
} // end loop

Credits

NerdFatherRJ
5 projects • 27 followers
Contact

Comments

Please log in or sign up to comment.