DIY Marty the Robot
Marty the Robot is a robot designed and manufactured by myself. Marty is 3D printed and is controlled by a Raspberry Pi and 9 servos. The robot could be used for programming education purpose.
I used Siemens NX for CAD and 3D printed all the parts. Control system was based on Raspberry Pi and PCA9685 with I2C protocol. Marty was able to perform face detection with OpenCV and walk towards its owner. High level API was implemented for controlling the robot such as walk(),dance()
etc.
System Implementation
1. Setup
Hardware:
- 8mm*M3 screws
- a 3D printer with plenty of PLA
- SG90 Servo *9
- PCA9685 module
- Raspberry Pi 3 B+
- Pi Camera
- 500 mAh, 11.1 V Li-battery
- voltage reduction module 11.1 V to 6 V
Software:
When you buy a raspberrypi, it’s just a bare board without any operating system. Let’s assume you have already installed latest Raspbian OS on your raspberrypi and and have succesfully remote control your pi. If you haven’t yet finished, please follow the instruction below to initialize your raspberrypi:
http://yesyzq.github.io/2016/01/09/raspberry/
Make sure that you have network environment for raspberry pi to work properly.In case you are not familiar with Linux command:
http://yesyzq.github.io/2016/01/17/Linux%E5%91%BD%E4%BB%A4%E4%BB%A5%E5%8F%8A%E5%BF%AB%E6%8D%B7%E9%94%AE%E6%95%B4%E7%90%86/
You may also refer to any other guide online. There are always abundant resources waiting for you to explore on the internet.
2. Implementation:
Hardware:
I 3D printed all the parts that are needed to build Marty. The parts are designed using UG NX 10.0 and are exported to .stl files. Then those .stl files are used to generate .gcode or .pcode using slicing softwares.
That is what marty is going to look like. (I’m too lazy to assemble another leg …)
The following are all the files:
You need to export *.prt files to *.stl files for 3D printing.
You need to print:
- 12 pieces of MMarty1.prt - connecting bar
- 8 pieces of marty4.prt —– supporting plate
- 4 pieces of marty3.prt —– servo connecting bar
- 2 pieces of marty2.prt —– third servo
- 2 pieces of marty5.prt —– feet of marty
- 2 pieces of marty6.prt —– second servo
- 2 pieces of marty7.prt —– first servo
- 2 pieces of shou.prt ——- arms of marty
- 2 pieces of yanjing.prt —- eyes of marty
- 1 piece of body.prt ——— body of marty
Then with the parts, you can assemble marty:
I also added a speaker on Marty:
Software:
I. Install OpenCV
To make Marty capable of face detecting, we install openCV-3.0.0 in Pi 3. The tutorial is mainly based on this tutorial Notice you need to run this line of code to solve the depencence problem. sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff5-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libeigen2-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libeigen3-dev
II. Driver
To drive Marty, I wrote a library that contains basic instructions to control Marty.
1 | Main files: |
III. Open i2c communication
Search i2c at /boot/config.txt
and change the item to ‘on’. Then reboot. Check you have open i2c successfully by sudo i2cdetect -y 1
3. DEMO
face detection by opencv:
walking:
turning:
singing:
dancing:
pretend busy programming:
face detecting, when marty see me, it will turn to my direction and move forward.
however, his head is too heavy that he cannot move fluently.