Introduction: Blippi_toy-bot: Animatronics Face
The animatronics is a robotic face of Blippi that uses an ultrasonic sensor to actuate a DFplayer mp3 mode and a servo motor to move the mouth. The digital touch sensor (TTP223B) is used to actuate a second servo motor that moves the nose, while a third servo motor is actuated by another TTP223B to rotate the eyes using two spur gears guided by a center pin attached to the spur gear.
Supplies
Attachments
Step 1: Supporting Structure
- Create a preliminary sketch of the frame and build a supporting structure out of plastic cardboard using a scrap tray. Design a rough box with horizontal members to provide support for the plastic structure(fig 1-4).
- I have used Solidworks to create a 3D model of the frame and 3D print it using plastic as the printing material(fig 5).
- Measure the horizontal distance between the eyes, the distance between the center of the eyes and the nose, and the distance between the nose and mouth to ensure proper fitment.
Step 2: Joint Design
We have guided the two gears to rotate the eyeballs, with another gear rotated by the servo motor, and a common pin connects the servo and center spur gear(rotary joint with gear mechanism)(fig 6-8), for the nose another pin which is attached to the cardboard nose through the screws and other ends of the pin fixed with servo motor (rotary joint). The lower jaw moves, the joint is the same as a hinge joint and the axis pin is just fixed with the lower jaw, which is rotated by the third servo.
Step 3: Actuators
- Connect the ground wire of each servo motor to the ground rail of the breadboard, and connect the power wire of each servo motor to the 5V rail of the breadboard. Connect the signal wire of the ultrasonic servo motor to pin 9 of the Arduino board.
- Connect the DFPlayer Mini MP3 Player Module on the breadboard to the Arduino board using jumper wires. Connect the TX pin of the DFPlayer to digital pin 10 and the RX pin to digital pin 11. Connect the VCC and GND pins of the DFPlayer to the 5V and ground rails of the breadboard, respectively.
- Attach the nose and eyes to their respective servo motors. The nose should be attached to the servo motor controlled by the first TTP223B touch sensor (pin 5). While the eyes should be attached to the servo motor controlled by the second TTP223B touch sensor(pin 6).
- The speaker's red wire goes to SPK_1, and the black wire to SPK_2.
Step 4: Sensors
- Connect an ultrasonic sensor, and two TTP223B touch sensors to the breadboard and the Arduino Uno R3 board.
- Connect the signal wire of the ultrasonic servo motor to pin 9 of the Arduino board, and connect the ultrasonic sensor's Trig pin to digital pin 2 and the Echo pin to digital pin 3.
- Connect the signal wires of the two TTP223B touch sensors to the Arduino board. Connect one TTP223B signal wire to digital pin 7 and the other TTP223B signal wire to digital pin 8.
Step 5: Programming
Upload the code to the Arduino board. The code will use the ultrasonic sensor to detect the distance of the object in front of it(within 5 cm). If the object is within a certain distance range, the DFPlayer will play an audio file, and the servo motor controlling the mouth will move in the loop. The touch sensors will also actuate their respective servo motors to move the nose and eyes. Power up the Arduino board and the servo motors through pins. Test the animatronic face by moving your hand close to the ultrasonic sensor. The mouth should move, and the nose and eyes should move accordingly when the touch sensors are high.
Algorithm code:
1. Include the required libraries: SoftwareSerial, DFRobotDFPlayerMini, Servo, and NewPing.
2. Define the pin numbers for the ultrasonic sensor's TRIG_PIN and ECHO_PIN, and the maximum distance MAX_DISTANCE.
3. Create a SoftwareSerial object to communicate with the DFPlayer Mini module, and a DFRobotDFPlayerMini object to control the audio playback.
4. Create Servo objects for the ultrasonic and touch servos and a NewPing object for the ultrasonic sensor.
5. In the setup() function, initialize the serial communication, the software serial communication, and the DFPlayer Mini module. Attach the ultrasonic and touch servos to their respective pins.
6. In the loop() function, use the ultrasonic sensor to measure the distance to an object.
7. If an object is detected within 5 cm, play an audio file using the DFPlayer Mini module, and move the ultrasonic servo motor from 0 to 30 degrees while the audio is playing. After the audio has finished playing, move the ultrasonic servo motor to 90(default) degrees.
8. If the touch sensor is pressed, it swipes the touch servo motor from 45 to 135 degrees and then back to 90 degrees.
9. If the new touch sensor is pressed, swipe the 3rd servo motor from the default position to 60 degrees and then back to 120 degrees.
Attachments
Step 6: The final Product
Step 7: Lessons Learnt
- Using libraries: The code utilizes several libraries to simplify the implementation of different functionalities. Beginners can learn how to include and use these libraries in their own projects.
- Using sensors: The code demonstrates how to use an ultrasonic sensor to measure the distance to an object. Beginners can learn how to interface and program different sensors in their projects.
- Using servos: The code also demonstrates how to use servo motors to control the movement of physical objects. Beginners can learn how to interface and program servos in their projects.
- Conditional statements: The code uses if statements to check the status of sensors and execute specific blocks of code. Beginners can learn how to use conditional statements to control the flow of their program based on specific conditions.
- Looping statements: The code uses for loops to control the movement of servo motors. Beginners can learn how to use looping statements to perform repetitive tasks in their projects.
- Debugging: The code may have errors or issues that need to be resolved to make it work properly. Beginners can learn how to debug their code by analyzing error messages and modifying their code accordingly.
- Circuit design: The code requires a circuit to interface with the sensors and motors. Beginners can learn how to design and assemble circuits for their projects.
- Structure design: The process of designing and building a physical structure to support the animatronic face.
- Integrating Mechanical with electronics engineering: We honed our skills in mechanics, and experiment with more advanced sensors and actuators to create more complex movements and behaviors for the animatronics face
Step 8: Troubleshooting
- Double-check your wiring: Make sure that all wires are properly connected to the correct pins and that there are no loose connections or short circuits.
- Check your code: Review your code and ensure that it is free of errors. Make sure that all the libraries are installed correctly and that the code is properly uploaded to the Arduino board.
- Check your power source: Make sure that you are using a reliable power source that can provide enough voltage and current to power the entire circuit. If you are using a battery, make sure that it is fully charged.
- Test your sensors and actuators: Test each sensor and actuator separately to ensure that they are functioning properly. This will help you isolate any problems.
- Troubleshoot one component at a time: If you encounter an issue, try troubleshooting one component at a time. This will help you pinpoint the source of the problem.
- Use debugging tools: Arduino has built-in tools for debugging, such as Serial Monitor, which can help you identify issues with your code.
- Consult the documentation: If you are unsure how to use a specific component or library, consult the documentation or online forums for help.
Step 9: Challenges
- Synchronizing the audio track with the servo was one of the challenging tasks, we try to sync every word possible with the audio with proper delay.
- Even though the wiring and coding were good, however in the end Arduino has some power issues which proved to be more difficult than everything else that was done.
- The accuracy and precision of the 3D-printed holes and parts were not ideal, and sandpaper could be used to sand down the pins and internal holes to ensure proper fitment.
Step 10: Suggestions
- The face used for the project was a picture pasted on cardboard, one can use 3D mask as face.
- Incorporating ear and spectacle movements using sensors like Infrared Receiver, Temp and humidity module, Tilt switch module, Photo-resistor module, 7 color flash module, High-sensitive voice, Sensor joystick module will surely further improve the project.
- Please ensure that your servos are connected to PWM pins, servo motors require a PWM signal to control their position, speed, and direction. The PWM signal determines the duty cycle and frequency of the signal, which in turn determines the position of the servo motor. Without a PWM signal, the servo motor will not be able to accurately determine its position and will likely move erratically or not at all.
- In case you don’t get the sound in the speaker try interchanging the RX, with TX, doing so I got the desired output.