Authorized Online Retailers:

AMAZON
AMAZON
amzuk

Introduction
In this lesson, we’ll teach how to use Raspberry Pi get signal from IR remote controller and use IR controller to remote control 1602 LCD, DHT11, buzzer.

Hardware Preparation
1 * Raspberry Pi
1 * Breadboard
1 * IR Receiver(VS1838B)
1 * Infrared Remote Controller
1 * DHT11
1 * IIC 1602
1 * buzzer
1 * Resistor(10kΩ)
Several jumper wires
1 * T-Extension Board with 40-Pin Cable(optional)

Software Preparation
Note:
1. In this lesson, we remotely control raspberry pi via PuTTy on PC. To learn how to config raspberry pi, please visit lesson 1: getting started with raspberry pi.
2. When the remote controller can’t work, please connect your raspberry Pi with Ethernet cable

Experimental Principle
When press the key of controller to IR receiver, corresponding device will take the action according to the program. For example, when pressing “1”, 1602 LCD will turn on, when pressing “2”, the 1602 LCD will turn off. The following table is key, corresponding device, and corresponding action:

Key corresponding device corresponding action

Key Corresponding device Corresponding action
1 IIC 1602 Turn on
2 IIC 1602 Turn off
3 DHT11 Display Temperature and Humidity in LCD
4 Buzzer Turn on/off

Connection Graph

Software
Note:
Step 1)Please be sure installation i2c python library and smbus. To learn more about setting and testing LCD1602, please review our lesson 13.

Step 2) If you have not enabled I2C, please run following command to enable I2C.

sudo raspi-config

Then select Interfacing Options->I2C->Yes->Ok->Finish

Step 3) Download  lesson20.py python code file by typing the following commands in pi terminal:

wget http://osoyoo.com/driver/pi3_start_learning_kit_lesson_20/lesson20.py

Step 4)Run the python code by following command:
python lesson20.py

Step 5) Test project result
Please press controller to IR receiver. When pressing “1”, 1602 LCD will turn on, when pressing “2”, the 1602 LCD will turn off. When pressing 3, the 1602 LCD will show temperature and humidity. When pressing 4, the buzzer will turn on/off.

To exit the program, press Ctrl-X and then press any key in your IR remote.