Animated WiFi Doll
I made an animated doll with lights and sounds, controllable with my phone over WiFi and triggered by a motion sensor for Halloween. Here I will show you how to create your own using readily available components, some 3D-printed parts and a Wemos D1 mini micro-controller.
Further details are available on the website idly.cabuu.com more projects like this at cabuu.com
Parts Required
To build your own doll, the main parts you will need are:
- Doll, small, with talking feature https://amzn.to/2Mq8zCr
- Pair of hollow dolls eyes https://amzn.to/325bhE4
- 2 x SG90 Mini Servo https://www.banggood.com/custlink/mmmKgWfvSQ
- Wemos D1 Mini https://www.banggood.com/custlink/GDmv4JTGLi
- 1x WS2812B RGB LED https://www.banggood.com/custlink/KK3GBr7RcZ
- PIR Sensor https://www.banggood.com/custlink/DmGv4cuGed
- 2 x Resistors (1k in my case but may vary) https://www.banggood.com/custlink/KvGveCuKnR
- 2 x 2N222 Type Transistors https://www.banggood.com/custlink/DDm3eJ7DbH
- Custom PCB (Optional) https://www.ebay.co.uk/itm/293280571693
- 3D-Printed parts to house the servos and electronics https://www.thingiverse.com/thing:3152317
You will also need...
- Various length M2 screws
- Jumper Wires
- Micro-USB Cable
- Solder and Soldering Iron
- Glue gun
- Micro-USB Cable
- Solder and Soldering Iron
- Glue gun
- A Dremel multi-tool (or similar)
- A 3D-printer (or access to one)
A basic version can be created to provide motion and lights alone. For this you do not need the PIR sensor, transistors or either resistor.
Eye Mechanism
To construct the eyes...
- First print the five 3d-printed parts, these are available from thingiverse. You will also need 1 x SG90 servo (complete with rotor arms and screws), 2 eyes and various length M2 screws.
- Next attach the servo brackets to the top and bottom of the servo ensuring the thin part is at the top so there is sufficient room for the eye holders to move. Secure with a M2 screw.
- Place the eye holder over the bracket and feed through an appropriate length M2 screw, ensure that the eye holder can move freely and repeat for the second eye
- Attach M2 screws to either end of the long arm
- Position the arm screws within the eye holders and attach to the servo using the provided screw
- Attach eyes to the eye holders using hot glue, ensure that the mechanism moves freely
- Solder 3 wires to the input side of the LED
- Use hot glue to secure the LED to the centre of the eye mechanism
- The optional 3D-printed servo holder may be used to help position the eye mechanism within the head.
- Create an opening at the back of the dolls head using a Dremel
- Remove the existing eyes
- Position the mechanism within the head and secure in place with hot glue, adjusting the position before the glue sets if required
- Use plenty of hot glue but be sure to avoid the moving portions of the eye mechanism
Construct the Head
To construct the head...
- Find the centre of the second servo and attach the ‘double’ arm using the provided screw
- Attach the servo to the head using M2 screws
- Check the head moves freely in both directions
- Use hot glue to secure the head servo holder within the body
- Use plenty of hot glue!
- Feed through the wire and slot the head servo into the holder
Electronics
I have created two versions of this project, a simple one with movement and lights only and a more advanced version that uses a PIR sensor for motion activation and a feature to activate a speaker and/or additional devices.
The simple version is connected as shown in the first schematic.
The simple version can also be useful for diagnosis if you are having problems using the advanced circuit.
The advanced version is connected as shown in the second schematic.
Using a Custom PCB
The wiring can be simplified and compacted using a custom made PCB. They are available to purchase here. Funds from any sales will help support future projects like this one so thank-you!
If using a custom PCB...
Position and solder components in the indicated locations and orientation
Solder male and female headers, you can solder the D1 mini directly to the board if you prefer.
Trim any excess wire
Install the D1 mini and connect the servos, LED, speaker and PIR (if using), note the positions of the positive and negative pins using a multi-meter
Connecting the Speaker
Connecting the speaker very much depends on the type used, the voltage supply required etc. The doll I used is available to purchase here and contained its own speaker within the doll itself.
For mine it was connected as shown in the photo.
Arduino Sketch
Download the latest Arduino IDE and the latest Arduino sketch which can be found here.
Ensure you have the following libraries installed. These can be installed using the libraries manager from within the Arduino IDE if not. Newer versions may work but have not been tested.
- FastLED v3.3.2
- Blynk v0.6.1
- Servo v 1.1.5
The following library must be installed manually by moving its contents into the Arduino libraries folder:
- ESP8266WiFi Library v2.4.2 – https://github.com/esp8266/Arduino
Open the sketch in the Arduino IDE. Change the 3 lines shown below to reflect your own WiFi credentials and your Blynk Auth Token (see Blynk App section to locate this).
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YOUR WIFI SSD HERE";
char pass[] = "YOUR WIFI PASS HERE";
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon).
char auth[] = "YOUR AUTH TOKEN HERE";
You may wish to adjust settings for both the head and eye servos to fine tune the extent of motion.
int MotionDetectTurnAngle = 180; //Angle at which to turn head on motion activate, default to 180
int CurrentHeadAngle = 90;
int CurrentEyeAngle = 90;
Connect the D1 Mini to the PC using a micro-USB, ensure that the settings shown are used, the correct COM Port is set and upload the sketch.
The doll should now reboot and connect to your WiFi network. It will become controllable via your own mobile Blynk app after following the next section. To troubleshoot any faults, with the D1 mini connected to the PC, use the Serial monitor in the Arduino IDE to help diagnose.
Downloads
Blynk Mobile App
The doll is controlled using a Blynk web app. Blynk is an IoT platform free for prototyping/non-commercial use.
Begin by downloading Blynk from the Android Play or Apple App Store.
Create an account and Scan the QR-code above from within the app.
Under the project settings locate the projects Auth Token by emailing to your account or using the Copy all feature.
Copy the auth token to the android sketch, upload and you should be good to go!