First Prize in the Instructables Wheels Contest, Second Prize in the Instructables Arduino Contest, and Runner up in the Design for Kids Challenge. Thanks to everyone who voted on us!!!
Robots are getting everywhere. From industrial applications to underwater and space exploration. But my favorite ones are those used for fun and entertainement! In this project a DIY robot was designed to be used for entertainment in children's hospitals, bringing some fun to the kids. The project is focused in sharing knowledge and promoting technological innovation to assist NGOs that carry out charitable work in children's hospitals.
This instructable shows how to design a remotely operated humanoid robot, controlled over a Wi-Fi network, using an Arduino Uno connected to an ESP8266 Wi-Fi module. It uses some servomotors form head amd arms movements, some DC motors for moving small distances, and a face made of LED matrices. The robot can be controlled from an ordinary internet browser, using a HTML designed interface. An Android smartphone is used to broadcast video and audio from the robot to operator's control interface.
The tutorial shows how the structure of the robot was 3D printed and assembled. Electronic circuit are explained, and Arduino code is detailed, so that anyone can replicate the robot.
Some of the techiniques used for this robot were already published on Instructables. Please take a look at the following tutorials:
Special thanks to the other team members involved in the above mentioned project, responsible for the first version of the code presented in this tutorial:
- Thiago Farauche
- Diego Augustus
- Yhan Christian
- Helam Moreira
- Paulo de Azevedo Jr.
- Guilherme Pupo
- Ricardo Caspirro
Find more about the project:
How can you help?
This project is funded by team members and small donations from some enterprises. If you liked it, there are some ways you can help us:
- Donation: you can send us tips if you want to support the construction of the robot and its future improvements. The tips will be used to buy supplies (electronics, 3d printing, filaments, etc.) and to help the promotion of our interventions in children's hospitals. Your name will de added to the credits of the project! You can send tips from our design in Thingiverse platform: https://www.thingiverse.com/thing:2765192
- Like: Show us how much you appreciate our project. Give us a "like" on the platforms we document our project (Facebook, Hackster, Hackaday, Maker Share, Thingiverse...).
- Share: Share the project on your favorite social media website, so that we can reach more people, and inspire more makers around the world.
Step 1: A Little Bit of History...
'Robô da Alegria' ('Joy Robot') project was born in 2016, in Baixada Santista region (Brazil), with the objective of developing technology and attracting the community to the maker movement. Inspired by voluntary projects carried out by NGOs in children's hospitals, the project seeks to develop a robot, using open hardware and apen software tools, capable of bringing a little fun to children's hospital environment and contribute to the work of other organizations.
The seed of the project was planted at the end of 2015. After a talk about the creation and development of technology promoted by the Association of Startups of Baixadas Santista (ASEBS). It was idealized a project, without prize in money, but that presented a subject in which people would get involved in an altruistic way, with the goal of helping other people.
The robot underwent diverse transformations from its initial conception until the present state. From just one head, with mechanical eyes and eyebrows, to its present humanoid form, several iterations were performed, testing different constructive materials and electronic devices. From an acrylic prototype and laser-cut MDF, we moved to a 3D printed body. From a simple interface with two servo motors controlled by Bluetooth, to a body composed of 6 servomotors and 2 motors DC command by a web interface using a Wi-Fi network.
The robot structure has been entirely produced with 3D printing using Fusion 360. In order to enable the production of robot replicas in makerspaces or fab labs, where the maximum time of use of the printers is crucial, the design of the robot was divided in pieces smaller than three hours of printing each. The set of parts is glued or bolted for body mounting.
The face, made up of LED arrays, give the robot the ability to express emotions. Servomotors-driven arms and neck give the small automaton the necessary mobility for interaction with users. In the control center of the robot, an Arduino Uno interfaces with all peripherals, including communication with an ESP8266 module, which gives the user the ability to command expressions and movements through any device connected to the same Wi-Fi network.
The Robot also has a smartphone installed in its chest, which is used for transmission of audio and video between the operator of the robot and the children. The device screen can still be used for interaction with games and other applications designed to interact with the robot body.
Step 2: Tools and Materials
The following tools and materials were used for this project:
- 3D printer - The whole body of the robot is 3D printed. Several hours of 3d printing were needed for building the whole structure;
- PLA filament - White and black PLA filaments where used for printing the body;
- Screw driver - Most of the parts are connected using bolts;
- Super glue - Some of the parts were attached using super glue;
- Pliers and cutters
- Solder iron and wire
- Arduino Uno (link / link) - It's used as the main controller of the robot. It sends signals to the motors and communicates with the WiFi module;
- ESP8266-01 (link / link)- It's used as a 'WiFi modem'. It receives signals from the control interface to be performed by the Arduino Uno;
- SG90 servomotors (x6) (link / link) - Four servos were used for the arms, and two for head movements;
- DC motors with reduction and rubber wheels (x2) (link / link) - They allow the robot to travel small distances;
- L298N dual channel H-bridge (x1) (link / link) - It converts Arduino digital outputs into power voltages to the motors;
- 16 channels servo controller (link / link) - With this board one can control several servomotors using only two Arduino outputs;
- MAX7219 8x8 LED display (x4) (link / link) - They are used as the face of the robot;
- Micro USB cable - Used for uploading the code;
- Female-female jumper wires (some);
- Male-female jumper wires (some);
- Smartphone - A Motorola 4.3" Moto E smartphone was used. Others with similar size might work as well;
- 18650 battery (x2) (link) - They were used to power the Arduino and other peripherals;
- 18650 battery holder (x1) (link / link) - They hold the batteries in place;
- 1N4001 diodes (x2)
- 10 kohm resistores (x3)
- 20mm on/off switch (x1)
- Protoshield (link) - It helps wiring up the circuit.
- Ball wheels (x2)
- M2x6mm bolts (+-70)
- M2x10mm bolts (+-20)
- M2x1.5mm nuts (x10)
- M3x40mm bolts (x4)
- M3x1.5mm nuts (x4)
The links above are a suggestion of where you can find the items used in this tutorial and support the development of this project. Feel free to search for them elsewhere and buy at your favorite local or online store.
Step 3: 3D Printing
The robot structure was entirely produced with 3D printing using Autodesk Fusion 360. In order to enable the production of robot replicas in makerspaces or fab labs, where the maximum time of use of the printers is crucial, the design of the robot was divided in pieces smaller than three hours of printing each. The set of parts is glued or bolted for body mounting.
The model is composed of 36 different parts. Most of them was printed without supports, with 10% infill.
- Head top (right/left)
- Head bottom (right/left)
- Head side caps (right/left)
- Face back plate
- Face front plate
- Neck axis 1
- Neck axis 2
- Neck axis 3
- Neck center
- Arm (right/left)
- Shoulder (right/left)
- Shoulder cup (right/left)
- Shoulder cap (right/left)
- Arm axis (right/left)
- Bust (rigth/left)
- Chest (right/left/front)
- Wheels (right/left)
- Phone holder
- Back (right/left)
- Knobs (right/left)
- Locker (right/left)
The procedure for mouting the robot is described on the following steps.
You can download all the stl files on the following websites:
This is a experimental prototype. Some of the parts need some improvements (for later updates of the project). There are some known issues:
- Interference between the wiring of some servos and the shoulder;
- Friction between the head and the bust;
- Friction between the wheels and the structure;
- The hole for some screws is too tight, and need to be enlarged with a drilling bit or a hobby knife.
If you don't have a 3D printer, here are some things you can do:
- Ask a friend to print it for you;
- Find a hacker/maker space nearby. The model was divided in several parts, so that each parts individually takes less than four hours to print. Some hacker/maker spaces will only charge your for the materials used;
- Buy your own 3D printer. You can find an Anet A8 for only $169.99 at Gearbest. Get yours: http://bit.ly/2Hhkpz8
- Interested in purchasing a DIY Kit? If enough people are interested, I might be offering a DIY kits on Tindie.com. If you would like one, send me a message.
Step 4: Overview on the Circuits
The robot is controlled using an Arduino Uno at it's core. The Arduino interfaces an ESP8266-01 module, which is used to remote control the robot over an Wi-Fi network.
An 16-channel servo controller is connected to the Arduino using I2C communication and controls 6 servomotors (two for the neck and two for each arm). An array of five 8x8 LED matrices is powered and controlled by the Arduino. Four Arduino's digital outputs are used for the control of two DC motors, using an h-bridge.
The circuits are powered using two USB power banks: one for the motors and one for the Arduino. I've tryed to power the whole robot using a signle power pack. But ESP8266 used to lost connection due to spikes when DC motors turned on/off.
The chest of the robot has a smartphone. It's used to broadcast video and audio to/from the control interface, hosted on an ordinary computer. It can also send commands to the ESP6288, thus controlling the body of the robot itself.
One might notice that the components used here might not be optimised for its purpose. A NodeMCU might be used instead of the Arduino + ESP8266 combination, for instance. A Rapsberry Pi with a camera would replace the smartphone and controll the motors as well. It's even possible to use an Android smartphone as the "brain" for your robot. That's true...
An Arduino Uno was choosed because it's very accessible and easy to use for everyone. By the time we started this project, ESP and Raspberry Pi board where still relatively expensive in the place we live... once we wanted to build and inexpensive robot, Arduino boards where the best choise at that moment.
Step 5: Assembling the Face
Four 8x8 LED matrix were used on robot's face.
The structure was divided in two parts (face back plate and face front plate) 3D printed using black PLA. It took me around 2.5 hours for 3D printing them, with 10% infill and no supports.
Due to space limitations, the connectors of the LED matrixes had to be dessoldered and had their position changed as described bellow:
- Remove the LED matrix;
- Dessolder input and output connectors;
- Re-solder thanon the other side of the circuit board, with the pins pointing the center of the board.
You can see the final result in the images.
The four LED matrixes were then attached to the backplate, using 16 M2x6mm bolts. The pins were connected according to the schematics.
The first matrix was connected using a 5 wire male-female jumper. The male end was later connected to Arduino pins. The female end is connected on matrix input pins. The output of each matrix is connected to the input of the next one using a female-female jumper.
After the connection of the matrixes, the front plate is installed using four M2 bolts. Wrap the jumpers around the back and front pannels, so that there's no loose wires.
The face module is later installed inside the robot's head, as it will be explained on the next steps.
Step 6: Mounting the Head
The head of the robot was divided in eigth 3d printed parts, all of them printed in white PLA with 0.2mm resolution, 10% infill and no supports:
- Head top (right and left)
- Head bottom (right and left)
- Head cap (right and left)
- Neck axis 1
- Neck axis 2
It took me almost 18 hours for printing the 130 mm in diameter structure.
The top and bottom of the head are divided in two parts. They're glued together using super glue. Apply the glue and let it rest for some hours.
The side caps are then mounted using bolts attached to the sides of head's top and bottom. This way, the head can be disassabled for repair by removing screws attached to head top parts. Before closing the head, assemble the face of the robot (described in previous step), and the bust (discribed in next steps).
Servomotor #5 was attached to Neck axis 1. I positioned the servo in the middle of the axis, then attached the horn and used a screw to lock its position. I used two M2x6mm bolts to mount Neck axis 2 on that servo motor. Servomotor #6 is attached to Neck axis 2 the same way.
Neck axis 2 was later connected to Neck center, as it's show on next step.
The face module is installed inside the head.
Step 7: Assembling the Burst and Shoulders
Bust and shoulder took me around 12h to be printed.
This section is made of five different parts:
- Bust (right/left)
- Shoulders (right/left)
- Neck center
- Neck axis 3
The bust parts were glued using superglue. Shoulders were attached on the sides using M2x10mm bolts, and the servomotors (Servomotor #2 and #4) were installed on each side. They pass through a rectangular hole on each shoulder (the wire is actually quite difficult to pass), and are attached using M2x10mm bolts and nuts.
Center neck has a rectangular hole, in which the Neck axis 3 part is inserted. Four M2x6mm bolts were used to link those two parts. After that the center neck was attached to the shoulders. It uses the same bolts used to mount the shoulder on the bust. Four M2x1,5mm nuts are used to lock its position.
Servomotor #6 was connected to Neck axis 3 using two screws. Then I installed Neck axis 3 inside Neck center rectangular hole, and used four M2x6mm bolts to lock its position.
Step 8: Assembling the Arms
It took me around 5 hours to print each arm.
Each arm is made of four pieces:
- Shoulder cup
- Shoulder cap
- Arm axis
Arm axis is centralized and mounted on the arm itself using three M2x6mm bolts. A servo horne is attached at the other end of the axis.
A servomotor (#1 and #3) is installed inside the Shoulder cup using some screws, and then have its horned (the one attached to the arm axis) installed. There is a hole on the cup for the installation of other horne, which is attached to the servo (#2 and #4) already mounted on the shoulders, as it was shown in previous step.
There's another hole on the Cup (and on the Shoulder) for passing the cables of the servos. After that, the Cap is installed to close the shoulder of the robot, with two M2x6mm bolts.
Step 9: Mounting the Chest
The chest is the part that links the bust to the bottom (wheels and base) of the robot. It's made of only two parts (right and left parts. I printed them in 4 hours.
The shoulders of the robot fits on upper part of the chest. There is a hole for a bolt that helps the alignment and fixation of thos parts. Although it's recomended to glue those two parts.
The bottom of this parts have six holes, which are used for the connection to the wheels, as it will be shown later.
At this point I labelled the servomotors with some stickers, in order to make the connection of the circuits easier.
Step 10: Assembling the Wheels
The wheels of the robot uses three 3d printed parts:
- Wheels (left/right)
It took me around 10h to print those parts.
I followed the following steps for assembling the wheels:
- First I had to solder some wires to DC motors connectors. Those wires were later used for powering the motors using a H-bridge circuit;
- The motors were then attached to the structure using two M3x40 bolts and nuts for each. Actually a shorter bolt might be used (but I found none online);
- After that I glued the front pannel, which links the other parts of the structure;
- This part has some holes on its top. They are used for its attachment to the chest, shown previously. Six M2x6mm bolts were used for the connection of both sections.
Step 11: Phone Holder
The phone holder is a single 3d printed part, and it takes around 1 hour to print.
The robot has a smartphone at it's belly. It was designed for a Motorola Moto E. It has a 4.3" display. Other smartphones with similar size might fit as well.
The phone holder part is used to hold the smartphone in the desired position. First the smart phone is positioned, then it's pressed against the body of the robot using the phone holder and four M2x6mm bolts.
It's importart to connect the USB cabe to the smartphone before tightening the bolts. Otherwise it will be hard to connect it later. Unfortunatly the space is very limited, so I had to cut part of the USB connector away... :/
Step 12: Mounting the Base
The base has only one 3D printed part. It took me around 4h to print that part.
It has several holes for the installation of other components, like the ball wheels, and circuit boards for instance. The following procedure was used for assembling the base:
- Install the 16 channel servo controller using four M2x6mm bolts;
- Install the L298N h-bridge circuit using four M2x6mm bolts;
- Install the Arduino Uno using four M2x6mm bolts;
- Install the protoshield on the top of the robot;
- Wire up the circuits (as it's described a couple steps later);
- Installe the ball wheels using two screws for each one. The wires were arranged so that they are traped between the base and the screws used in the installation of the wheels;
- Base was attached to wheels section using some screws.
Step 13: Back and Power Pack
The back cover of the robot was designed so that one can easilly open it for accessing the circuits, recharging the batteries, or turning the smartphone on/off.
It's made of six 3d printed parts:
- Back (left/right)
- Knobs (x2)
- Locks (left/right)
It took me around 5h30 for printing the parts. Right and left back parts were glued using superglue. Wait until the glue is completly dry, or the cover will break easilly.
The power pack consists of two 18650 batteries and a battery holder. I had to solder some wires (between battery #1 negative pole and battery #2 positive pole). The negative pole of the power pack was connected to Arduinos GND (using some wires and jumpers). A on/off swich was installed between the positive pole and Arduino's Vin input.
The on/off switch was attached to back 3d printed parts using a M2x6mm bolt and M2x1.5mm nut. The battery holder was attached to the back using four M2x6mm bolts.
The cilindrical part of the locks had to be sanded with a sand paper for a better fitting. They pass through the holes on the cover. The knobs are connected and glued on the other side.
The cover fits to the back of the robot. The knobs can be turned for locking the lid, protecting the insides of the robot.
Step 14: Wiring Up the Circuits
The circuit was wired up according to the schematics.
- Arduino pin D2 => L298N pin IN4
- Arduino pin D3 => L298N pin IN3
- Arduino pin D6 => L298N pin IN2
- Arduino pin D7 => L298N pin IN1
- Arduino pin D9 => MAX7219 pin DIN
- Arduino pin D10 => MAX7219 pin CS
- Arduino pin D11 => MAX7219 pin CLK
- Arduino pin D4 => ESP8266 RXD
- Arduino pin D5 => ESP8266 TXD
- Arduino pin A4 => SDA
- Arduino pin A5 => SCL
- Arduino pin Vin => Battery V+ (before diodes)
- Arduino pin gnd => Battery V-
- ESP8266 pin RXD => Arduino pin D4
- ESP8266 pin TXD => Arduino pin D5
- ESP8266 pin gnd => Arduino pin gnd
- ESP8266 pin Vcc => Arduino pin 3V3
- ESP8266 pin CH_PD => Arduino pin 3V3
- L298N pin IN1 => Arduino pin D7
- L298N pin IN2 => Arduino pin D6
- L298N pin IN3 => Arduino pin D3
- L298N pin IN4 => Arduino pin D2
- L298N pin +12V => Battery V+ (after diodes)
- L298N pin gnd => Arduino gnd
- L298N OUT1 => Motor 1
- L298N OUT2 => Motor 2
MAX7219 (first matrix)
- MAX7219 pin DIN => Arduino pin D9
- MAX7219 pin CS => Arduino pin D10
- MAX7219 pin CLK => Arduino pin D11
- MAX7219 pin Vcc => Arduino pin 5V
- MAX7219 pin gnd => Arduino pin gnd
MAX7219 (other matrixes)
- MAX7219 pin DIN => MAX7219 pin DOUT(previous matrix)
- MAX7219 pin CS => MAX7219 pin CS (previous matrix)
- MAX7219 pin CLK => MAX7219 pin CLK (previous matrix)
- MAX7219 pin Vcc => MAX7219 pin VCC (previous matrix)
- MAX7219 pin gnd =: MAX7219 pin gnd (previous matrix)
16-channel servo controller
- Servo controller pin SCL => Arduino pin A5
- Servo controller pin SDA => Arduino pin A4
- Servo controller pin Vcc => Arduino pin 5V
- Servo controller pin gnd => Arduino pin gnd
- Servo controller pin V+ => Battery V+ (after diodes)
- Servo controller pin gnd => Arduino pin gnd
Some say the Sg90 servo can be powered between 3.0 and 6.0V, others between 4.0 and 7.2V. To avoid trouble I decided to put two diodes in series after the batteries. This way, the voltage for servos is 2*3.7 - 2*0.7 = 6.0V. The same is applied to the DC motors.
Notice this is not the most efficient way, but it worked for me.
Step 15: Arduino Code
Install the latest Arduino IDE. No library was needed for communication with ESP-8266 module or control of the DC motors.
I'll need to add the following libraries:
- LedControl.h: library used to control the LED matrixes;
- Adafruit_PWMServoDriver.h: library used to control the servo motors.
Arduino code is divided in 9 parts:
- RobodaAlegria.ino: this is the main sketch, and it call the other parts. Libraries are imported here. It also define and initialize global variables;
- _05_Def_Olhos.ino: this is where the matrixes for each eye are defined. Each eye is represented by a 8x8 matrix, and 9 options where defined: neutral, wide-eye, closed up, closed down, angry, borred, sad, in love, and dead eyes. There is a different matrix for right and left eyes;
- _06_Def_Boca.ino: this is where the matrices for the mouth are defined. The mouth is represented by a 16x8 matrix, and 9 options where defined: happy, sad, very happy, very sad, neutral, tongue out, open, wide-open, and disgusted mouth;
- _10_Bracos.ino: predefined movements for arms and neck are defined in this file. Nine movements, mov1() to mov9(), were configured;
- _12_Rosto.ino: in this file there are some functions for updating the face of the robot, combining the matrixes defined in _05_Def_Olhos.ino and _06_Def_Boca.ino;
- _13_Motores_DC: it defines the functions for ther DC motors;
- _20_Comunicacao.ino: a function for sending data to ESP8266 is defined in this file;
- _80_Setup.ino: it runs on Arduino power up. It set the inicial face and position of the motors of the robot. It also send commands for the connection to a given Wi-Fi network;
- _90_Loop: main loop. It looks for incoming commands from ESP8266 and call specific functions to control the outputs.
Download Arduino code. Replace the XXXXX by your wifi router SSID and YYYYY by router password on on '_80_Setup.ino'. Please check the baudrate of you ESP8266 and set it properly in the code ('_80_Setup.ino'). Connect the Arduino board to your computer USB port and upload the code.
Step 16: Android Apps
An Android smartphone was used to broadcast the video and audio from the robot to the control interface. You can find the app I used on Google Play store (https://play.google.com/store/apps/details?id=com.pas.webcam).
The screen of the smartphone may also be transmited to the control interface, so that the operator can see what's on the screen. You can also find the app I used to mirror the screnn on Google Play store (https://play.google.com/store/apps/details?id=com.ajungg.screenmirror).
An Android video game was also designed to interact with the robot. It's not yet very stable, so it isn't available for download.
Step 17: Control Interface
A html interface was designed for the control of the robot.
Download interface.rar and extract all the files to a given folder. Then open it on Firefox. The interface is divided in two blocks. To the left there are displays for the camera and screen mirror. To the right there are controll buttons for the commands.
Textbox forms are used in that interface to enter IP address of the ESP8266 module ('Endereço IP Arduino:'), video/audio server from Android IP Webcam app ('IP Webcam (IP):') and Screen Mirror IP address ('Screen Mirror (IP):').
Keyboard arrow keys are used for moving the robot forward or backward, and to rotate left or right.
When the interface is started, a warning is displayed, asking if the user wants to share the microphone. If this option is selected, sound intensity of the microphone will be used to send a preconfigured command to the robot. This command will trigger an animation, simulating speech movement on robot's face. A settings button on upper right corner might be used to set the sensitivity of the microphone.
This settings menu might also be used to configure the speed of arms and neck movements.
Step 18: Have Fun
Power it up and have fun!
If you still don't follow my tutorials, take a look at those other projects in which I explain a little bit about internet of things, robotics and 3D printing. I hope you enjoy them too!
Liked any of my projects? Please consider supporting my future projects with a small Bitcoin donation! :D
BTC Deposit Address: 1FiWFYSjRaL7sLdr5wr6h86QkMA6pQxkXJ
First Prize in the
Wheels Contest 2017
Runner Up in the
Design For Kids Challenge
Second Prize in the
Arduino Contest 2017