I am a supper fan of Star War and I like the R2-D2 robot which is a resourceful astromech droid, R2-D2 served Padmé Amidala, Anakin Skywalker and Luke Skywalker in turn, showing great bravery in rescuing his masters and their friends from many perils. A skilled starship mechanic and fighter pilot’s assistant, he formed an unlikely but enduring friendship with the fussy protocol droid C-3PO. I got the R2D2’s language from the r2d2 translator website.
In this project, I use a 3D printer to make a R2-D2 robot and use Re-speaker to make it “speak”, Re-speaker is a powered by the MT7688 Wi-Fi module and the built-in high performance microphone, Re-Speaker responds to your voice and recognize your speeches based on powerful online cognitive services like Microsoft Cognitive Service, Amazon Alexa Voice Service, Google Speech API, Wit.ai and Houndify.
Step 1: Prepare the stuffs
First of all, you had to find a 3D-Printer.
Then some electronic modules is needed as well:
- Re-Speaker
- Re-Speaker Grove Extension Board
- Grove – IMU 10DOF v2.0
- Speaker (8Ω 0.5W)
- Grove – Servo
- Micro SD Card(larger than 4GB)
Step 2: Wiring
Now, we should connect the Grove Modules to the Grove Extension Board for Re-Speaker.
And connect the speaker to the Re-Speaker.
Step 3: Setup the Re-Speaker
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 Re-Speaker 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 Re-Speaker
Now, using your favorite SSH Tools connect to Re-Speaker.
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 'you_key' Then reboot your Re-Speaker.
reboot To have a try ping a website to ensure your Re-Speaker have connected the internet well.
ping seeed.cc
Step 4: Upload the Arduino Code
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\
4. Launch Arduino IDE.
5. Click Sketch>Add file to add r2d2.ino file from C:\Users\Administrator\Documents\Arduino\ R2D2_ReSpeaker\Arduino_Side\r2d2\
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 software work on Arduino.
Step 5: Download the code
Insert the micro SD card to the Re-Speaker
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 <a href="https://github.com/Lee-Kevin/R2D2_ReSpeaker">https://github.com/Lee-Kevin/R2D2_ReSpeaker</a>
Step 6: Change the code
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
Step 7: 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/sh amixer sset Capture 90% cd /tmp/run/mountd/mmcblk0p1/ R2D2_ReSpeaker /r2d2 python demo.py &> /dev/console & At last, reboot your Re-Speaker.
reboot
Step 8: 3D Printing and Tint
The R2D2 model is that we got from the Internet, and do a little modifications so that we can put the hardware inside. Note that, in fact, the model is a lot of parts, pay attention when you printing.
After 3D printing, spray white paint in the surface of parts, then use blue marker tint. Finally, the scanning line with a pencil, so that the whole more three-dimensional appearance
Step 9: Fixed R2D2
Fixed R2D2 with screws and bearing, it’s no difficulty. then attention fixed servo and gear. R2D2 rotor is depends on here.
Step 10: Put hardware inside
Because of ill-considered, modify the model time to forget the punch, now use manually open a hole, then put the hardware inside, use screws fixed them all.
Step 11: The Result
Now, you can put R2-D2 on your desk, and when you’re bored, you can pat it or speaker to it, it can speak to you too. But maybe you can’t understand what he said. LOL
Step 12: 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.
Leave a Reply
You must be logged in to post a comment.