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.
Now, we should connect the Grove Modules to the Grove Extension Board for ReSpeaker.
And connect the speaker to the ReSpeaker.
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.
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.
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.
To have a try ping a website to ensure your ReSpeaker have connected the internet well.
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.
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-P1root@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.
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.
Navigate to /tmp/run/mountd/mmcblk0p1 by execute following commands:
root@mylinkit:/# cd /Media/SD-P1
Then create a file named 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.
Download the file and laser cut it.
Here's we use 3mm wood and coated paper.
Here we can use M2*10 pillars and M2 nuts Fixed ReSpeaker, *then use M2*12 fixed it to the wood.
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.
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.
Only white paper too boring, so here I draw some of my favorite things to make this remote controler more interesting~
Now, you can ask the ReSpeaker to learn your IR commands.
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: “Stop learning”
ReSpeaker: “Okay, stop learning”
Then you can ask ReSpeaker to control the appliance that you let it learn to.
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.