Alexa makes home smarter


Amazon Echo can control smart home devices(Philip Hue lights, Belkin’s WeMo switch system). But those things are pretty expensive.

If you have Infrared remote control lights(or other), this project brings these device to smart home device.alexa makes home smarter

How does it work?

  • Talk to Amazon Echo “Alexa, tell pi home lights on”
  • Alexa Voice Service invoke Amazon Lambda function
  • Lambda function update AWS IoT device shadow
  • Raspberry Pi recive shadow update
  • Send signal to Infrared remote control devices


Step1 – Build IR LED circuit

Connect IR reciver LED signal to GPIO 18 and IR LED to GPIO 17.

Step2 – Install and configure lirc package

sudo apt-get install lirc

edit /boot/config.txt

# Uncomment this to enable the lirc-rpi module 


sudo shutdown -r now

check device file is created

ls  -l /dev/lirc*
crw-rw---- 1 root video 244, 0 Aug 22 23:17 /dev/lirc0

test reciving IR remote

sudo /etc/init.d/lirc stop
mode2 -d /dev/lirc0 

point your remote controller and push any button. If you see output like following, it means setup is good.

space 1385566
pulse 770
space 876
pulse 1590
space 874
pulse 1589
space 1681
pulse 783

Step3 – create remote control commands

clone sample source

cd /opt
git clone 
cd alexa_home_control/raspberrypi 

capture remote control signals.

sudo /etc/init.d/lirc stop
mode2 -d /dev/lirc0 | tee lights_on.txt
(enter Ctrl + C to stop capture)

parse signal file

python lights_on.txt
770 876 1590 874 1589 1681 783 1683 782 1680 784 1683 780 ....

Repeat this step for the button you want to use on Raspberry Pi.

create /etc/lirc/lircd.conf and paste parsed signal. If the signal is longer than 80 characters, write it to the next line.

begin remote 
name living_light 
flags RAW_CODES 
eps            30 
aeps          100 
gap          200000  
toggle_bit_mask 0x0 
   begin raw_codes 
 name light_all 
770 876 1590 874 1589 1681 783 1683 782 1680 784  
1683 780 .... 
 name light_off 
778 875 1592 866 1600 1683 779 1713 751 865 1599  
865 1601 .... 
   end raw_codes 
end remote   

“living_light” is the name of remote controller. If you changed this name, rewrite the `raspberrypi/iot_shadow.js ` .

sudo /etc/init.d/lirc start  
# list remote controllers  
$ irsend LIST '' ''  
irsend: living_light  
# list commands  
$ irsend LIST living_light ''  
irsend: 0000000000000001 light_all   
irsend: 0000000000000002 light_off  
# send signal  
$ irsend SEND_ONCE living_light light_all  

“light_all” and “light_off” is the name for the parsed signal. In the sample source, these name are linked with lambda function.

test commands

If your config is correct, Raspberry Pi become a remote controller.schematic alexa makes home smarter

Step4 – Setup AWS IoT

This sample only use AWS IoT device shadow. Just setup the Thing and certificate. Follow the steps in AWS document to add the thing and certificate.

For more detail: Alexa makes home smarter

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top