Make a Voice-Control IR Remote Controller by Arduino

by Seeed Studio in Circuits > Arduino

5420 Views, 42 Favorites, 0 Comments

Make a Voice-Control IR Remote Controller by Arduino

FSMKIQLISV2DHU9.jpeg
万用遥控器

In our latest project named DIY your ReSpeaker Adapter(Voice Control), we introduced how to control adapter using your voice, but it can only control switch-signal appliances, such as table lamp fan and so on.

This time I’ll show you how to use your voice to control some complex household appliances like smart TV and air conditioner using the new thing ReSpeaker, which can allow you to interact with the world using your voice. In this case, we need to use Infrared remote controller to control them. Fortunately, the ReSpeaker has a coprocessor ATmega 32U4 which makes it compatible with Arduino Leonardo, So I use the Arduino side to learn IR Command code as well as send the IR Commands to control the complex appliances.

What Do We Need

6.png
5.png
7.png
3.png
4.png
2.png
1.png

Hardware Part:

Enclosure Part:

  • M3*10 Pillars —— 4 PCS
  • M3*20 Pillars —— 4 PCS
  • M3*35 Pillars —— 4 PCS
  • M3*12 Screws —— 8 PCS
  • M2*10 Pillars —— 3 PCS
  • M2*8 Swcews —— 3 PCS
  • M2 Nuts —— 3 PCS
  • WoodPaperScrew driver

Wiring

8.png

Now, we should connect the Grove Modules to the Grove Extension Board for ReSpeaker.

And connect the speaker to the ReSpeaker.

Setup the ReSpeaker

9.png
10.png

The software work of the social artifact consists of 2 parts, the code running on Arduino side and the python script running on the MT7688 side. The communication between the two chips are UART and SPI.

Connect ReSpeaker to your PC using micro USB cable, if your computer can’t recognize it as a USB device, you can download the driver from here.

Connect ReSpeaker

Now, using your favourite SSH Tools connect to ReSpeaker.

Baud rate: 57600

Terminal App: For windows, putty is recommend. For Linux/Mac, use screen /dev/xxx 57600

Connect MT7688 to the Internet

Modify the configure file to change MT7688 into station mode and connect to the internet.

vi /etc/config/wireless

Change the configure file as below shows.

Change the ssid and key to your own on the red box as the picture shows.

Option disabled ‘0’

option ssid‘your ssid’
option key‘your key’

Then reboot your ReSpeaker.

reboot

To have a try ping a website to ensure your ReSpeaker have connected the internet well.

ping seeed.cc

Upload the Arduino Code

11.png

1. Download demo code at GitHub.

2. Click “Download zip” button on right side of webpage to download all codes.

3. Decompress the downloaded zip files to“C:\Users\Administrator\Documents\Arduino\” and remove “-master” in decompressed file name.

4. Launch Arduino IDE.

5. Click Sketch>Add file to add irLearning.ino file from“C:\Users\Administrator\Documents\Arduino\IRLearning_ReSpeaker\Arduino_IRLearning\irLearning\”

6. Click Tools -> Board and select “Arduino Leonardo” and chose the right port, as shown in the picture below.

7. Press CTRL +U to upload codes to your board. Wait a while, there will be saying “Done uploading”.

8. Congratulations, you have already completed the whole of the work.

Download the Code

12.png

Insert the micro SD card to the ReSpeaker SD slot. Now, we should download the code from Github to your micro SD card.

root@mylinkit:/# cd /Media/SD-P1

root@mylinkit:/tmp/run/mountd/mmcblk0p1#

When navigating to /Media/SD-P1, the system will mount the SD card to /tmp/run/mountd/mmcblk0p1 automaticlly. And then execute the following commands.

git clone  https://github.com/Lee-Kevin/IRLearning_ReSpeaker

Change the Code

13.png

After download the code, you can use vi editor to change the code, in this project, we use Microsoft cognitive services, You can get the API Key from here.

And then, change the BING_KEY to your own.

vi creds.py

Setup the Startup Script

Navigate to /tmp/run/mountd/mmcblk0p1 by execute following commands:

root@mylinkit:/# cd /Media/SD-P1

Then create a file named autorun

vi autorun

And add the following code.

#!/bin/shamixer sset Capture 90%

cd /tmp/run/mountd/mmcblk0p1/IRLearning_ReSpeaker/IRLearning
python demo.py &> /dev/console &
At last, reboot your ReSpeaker. 
reboot

Laser Cutting

激光切割.png
122825500192667107.jpg
368360561315177926.jpg

Download the file and laser cut it.

Here's we use 3mm wood and coated paper.

Fixed ReSpeaker on Wood

206774006502967413.jpg
399237486216460378.jpg
708533943041077822.jpg

Here we can use M2*10 pillars and M2 nuts Fixed ReSpeaker, *then use M2*12 fixed it to the wood.

Fixed the Speaker on Wood

436889067799930741.jpg
331800413526646162.jpg

Here fixed speaker and paper on wood by two M3*10 pillars, Note this, Only use 2 pillars to fixed it now. then connect speaker and ReSpeaker.

Fixed Grove – Infrared Emitter and Grove - Infrared Receiver

730929315781128996.jpg
163370205994110318.jpg
720647995926902981.jpg
829024463368859947.jpg
309417103712711282.jpg

  1. Here we need make the cables through the hole, then use M2 screws and M2 nuts fixed grove - infrared emitter and grove - infrared receiver on wood.(Image 1-2)
  2. Then put the PCB on ReSpeaker and fixed the M3*35 pillars on wood.(Image 3-4).
  3. Fixed the wood by M3*20 pillars.(Image 5)

Fixed the Paper

650052773522375971.jpg
686094114120373695.jpg

Remember the holes we only used two~ Now at other holes we can fixed on paper and wood. then we can use double-sided adhesive to fixed the paper to wood.

Drawing on Paper

455024658468352858.jpg
789468220006031811.jpg
133591164673511573.jpg
1389218479544389.jpg
IMG_9778.JPG

Only white paper too boring, so here I draw some of my favorite things to make this remote controler more interesting~

The Result

Now, you can ask the ReSpeaker to learn your IR commands.

Me: “ReSpeaker”

ReSpeaker: “Hi”

Me: “Start learning IR command”

ReSpeaker: “Okay, start learning”

And now you can send IR command to Grove - IR Receiver using appliance ir remote controller. Then you can say.

Me: “ReSpeaker”

ReSpeaker: “Hi”

Me: “Stop learning”

ReSpeaker: “Okay, stop learning”

Then you can ask ReSpeaker to control the appliance that you let it learn to.

Me: “ReSpeaker”

ReSpeaker : “Hi”

Me: “Control the air conditioner”

ReSpeaker: “Okay, send IR command ”

And you’ll find the air conditioner will change according to the IR command.

Make. Invent. Do.
This project is made as an Open Source Project. It's a starting point. Let your creativity go wild with the mechanical, electrical and software design. Make the demo your own. Decorate it. Improve the work. No matter what, write a recipe about it.

To share and progress together.