Face With Animatronic Eyes, Motion Detection and Voice
by MertArduino in Circuits > Arduino
8628 Views, 138 Favorites, 0 Comments
Face With Animatronic Eyes, Motion Detection and Voice
Are you ready to create something both eerie and captivating? This project combines 3D printing, servo motors, a PIR sensor, and a DFPlayer MP3 module to bring to life an animatronic Squid Game boss face. With Halloween right around the corner, this DIY project is the perfect spooky addition to your home or event. The face's animatronic eyes move in response to motion detection, and a haunting sound is played, making it both visually impressive and interactive.
This project is a great starting point, especially for those who want to control eye movements and play certain audio files. By coordinating the movements detected with the help of the PIR sensor, the movement of the servo motors, and the audio playback of the DFPlayer, you can achieve a great animation.
3D Printed Parts
The animatronic eye parts and the mask itself were printed using a standard 3D printer with PLA filament. The parts were printed with medium quality, but for those wanting a more polished look, feel free to sand and paint the pieces for a smoother finish.
3D Printed Components:
- Mask (Face)
- Two eyeballs
- Two eyelids
- Servo holder (to hold all 5 servos in place)
- Universal joints (to enable smooth movement for the eyes)
- Two bars to support the mask’s internals
- A backplate to cover the electronics and allow for easy wall mounting
Feel free to use different colors for the eyes or even hand-paint them after printing. The universal joints play a critical role in the smooth motion of the eyes, allowing them to mimic realistic movements.
Assembling the Animatronic Eyes
Now that we have the 3D printed parts, it’s time to assemble the animatronic eyes. For this, we’ll use five MG90S servo motors to control both the eyelids and the eyes' movement. Here’s what you’ll need:
Components:
- 5x MG90S Servo Motors
- Metal wire (we used a few paperclips to form the connecting rods)
- Pliers and wire cutters (for shaping and cutting the paperclips)
Assembly Process:
- Center the Servos: Make sure all servos are positioned at 90 degrees to start. This is critical to ensure the movements are calibrated properly.
- Mount the Servos: Place each servo into the 3D printed servo holder. Two servos will control the left-right movement of the eyes, two for the up-down movement, and one for the eyelid.
- Attach the Eyes: Connect the servos to the eyes using the paperclip wires, shaped into linkage rods. This will transmit the servo’s rotation to the eye movement. Universal joints are added to ensure the eye movements are smooth.
- Attach the Eyelids: The final servo will control the eyelids, giving your mask the ability to blink or close its eyes. The same wire and paperclip method is used to attach the eyelids to the servo.
Animatronic eyes move thanks to the servos manipulating them in two axes (up-down and left-right). Each eye's movement is controlled by two servos, while the eyelids are controlled by a single servo for opening and closing.
Testing the Animatronic Eyes
Before we move on to the rest of the project, it's important to test the animatronic eyes to make sure everything is working correctly. Here’s a simple circuit setup for testing:
- Connect the servo motors to a breadboard.
- Upload a simple servo control code that moves the eyes in all directions and blinks the eyelids.
Upload shared code using the Arduino IDE, and observe the movements. You can adjust the angles and delay times to fit your needs.
Servo Motor Connections
The first part of our setup involves wiring five servo motors to the Arduino Nano. These servos will control the following movements:
- Servo1: Horizontal movement of the left eye.
- Servo2: Vertical movement of the left eye.
- Servo3: Controls the eyelids.
- Servo4: Vertical movement of the right eye.
- Servo5: Horizontal movement of the right eye.
Here are the IO pin assignments:
- Servo1: Digital 2
- Servo2: Digital 3
- Servo3: Digital 5
- Servo4: Digital 6
- Servo5: Digital 9
Make sure your servos are powered by an appropriate external power source, as the Arduino’s onboard 5V supply is insufficient for powering multiple servos.
Code Explanation: The servo control code utilizes the Servo library to manage the movements of each servo. It defines specific angles for left and right movements, as well as up and down for the eyelids. The setup initializes each servo, sets the initial position, and includes a loop that allows for smooth transitions between the defined angles. The eye movements are triggered based on the conditions set in the code, ensuring the animatronic eyes behave as intended.
Downloads
Printed Circuit Board
A printed circuit board (PCB) was designed to integrate all components, including the DFPlayer, PIR sensor, servo motors, speaker, and Arduino Nano. The goal is to create a more stable circuit and prototype.
- Arduino Nano (main controller)
- DFPlayer MP3 module (for sound)
- PIR sensor (motion detection)
- 5x servo motor inputs
- Speaker for audio output
PCBWay was chosen for the PCB fabrication. You can find the Gerber file and circuit diagram for PCB fabrication at this link: https://www.pcbway.com/project/shareproject/The_Face_maker101_c4124445.html Also, if you have no soldering experience, you can use PCBWay's assembled PCB service.
I also participated in PCBWay's 7th design contest, if you want to support the project, you can vote for the project from the same link. Thank you.
The component list includes capacitors for power requirements, resistors for servo motor digital inputs, terminal blocks for the sensor and speaker, and female and male headers for the DFPlayer and Arduino Nano.
- Resistors and capacitors (for power regulation)
- Terminal blocks (for the sensor and speaker connections)
- Male/female headers (for the DFPlayer, Nano, and servos)
I soldered all the components in place using a soldering iron and solder wire. This setup ensures that the entire project runs smoothly and that the wiring doesn’t get messy.
Main Code for the Face
Integrating the PIR Sensor and DFPlayer
Now that everything is assembled, it’s time to upload the main code into the Arduino Nano. This code integrates the PIR sensor, servo motors, and the DFPlayer MP3 module. The idea is simple: when the PIR sensor detects motion, the servos will move to open the eyelids and make the eyes move while the DFPlayer plays a sound.
Key Components of the Code:
- The PIR sensor triggers when it detects motion.
- The DFPlayer plays a sound file stored on an SD card.
- The servos control the eye and eyelid movement.
DFPlayer Mini and Speaker Setup
The DFPlayer Mini is a simple, low-cost MP3 player that can play audio files stored on a microSD card. In this project, it will play a sound file when motion is detected by the PIR sensor.
- Connect the RX pin of the DFPlayer to Digital 11 and the TX pin to Digital 10 on the Arduino Nano.
- Attach a speaker to the SPK+ and SPK- pins of the DFPlayer for sound output.
PIR Motion Sensor Connection
- The PIR sensor will detect motion and trigger the servo movements and audio playback.
- Connect the PIR sensor’s output pin to Digital 7 of the Arduino Nano.
Use a 9V external power supply for the circuit to ensure stable performance. Once the wiring and coding are complete, it’s time to test your project.
- Upload the code to your Arduino Nano.
- Ensure the PIR sensor is placed in a location where it can easily detect motion.
- When the PIR sensor detects movement, the servos controlling the eyelids should open, and the DFPlayer should play the pre-loaded sound file.
- The servos will then make the eyes move in a coordinated sequence.
Code Overview: The main code utilizes the DFPlayer library to control audio playback while coordinating with the PIR sensor's output. When motion is detected, the code triggers the servos to move the eyes and simultaneously starts the audio file. This synchronization enhances the effect, making the animatronic eyes appear more lifelike and engaging. The code efficiently handles various scenarios, ensuring seamless transitions between eye movements and sound playback.
Note: The attached file “1.mp3” contains the sound “I see you” used in the project. Simply upload the audio file to the SD card (SD card format must be FAT32)
Final Assembly
Now it’s time to put everything together in the mask. Follow these steps:
- Insert the Bars: Attach the two support bars to the back of the mask.
- Mount the Servo Holder: Secure the servo holder (with the servos and eyes attached) to the bars using hot glue.
- Install the PIR Sensor: Drill a small 6mm hole in the front of the mask to place the PIR sensor. It’s a mini PIR sensor, so it fits perfectly into the hole.
- Place the Speaker: Position the speaker inside the mask, ensuring it’s hidden from view.
- Attach the PCB: Secure the PCB inside the mask and make all the necessary connections.
- Seal the Mask: Once everything is connected and in place, use the back cover to enclose the electronics.
Finally, mount the mask on the wall using double-sided tape or other methods. Power the mask using a 9V power supply, and you’re all set!
This project combines creativity, technology, and a bit of spookiness, making it perfect for the Halloween season. With a few tweaks, you can customize this mask to your liking, adding different sounds or even more complex eye movements. Happy making!
An extra idea, add LED lighting: If you want to make your project even more engaging, you can add LED lights that turn on when motion is detected, enhancing the visual effect.