Animatronic Owl
Owls have often been associated with wisdom and secret knowledge, especially in ancient mythology. However, the owl has also been viewed as a harbinger of impending tragedy and death in literature and folklore. For example, Shakespeare's Lady Macbeth identified an "owl that shrieked" as "the fatal bellman" that forecast the death of King Duncan (at the hand of her husband). That reputation, along with its nocturnal habits, haunting calls and silent flight make the owl an excellent symbol of the mysterious, foreboding and supernatural manifestations that roam our streets on All Hallows' Eve (aka Halloween).
After blundering through an attempt to build an animatronic crow (with twisting head and red-LED eyes) for Halloween last year based on a model by Adafruit (Thingiverse:6214449), I decided to make an animatronic owl this year. Fortunately, I was able to find a 3D-printed owl model that was well suited for transformation to an animatronic (Thingiverse:5739139). That model is nathanstenzel's remix of a remix (Thingiverse:693371) of an owl model originally created by cushwa (Thingiverse:18271).
The nathanstenzel remix separated the owl's head from the body and created a small storage space inside a 6-inch owl. My remix for the current project involved: (a) scaling the model about 170% to create a 10-inch model with a neck wide-enough to accommodate a small servo, (b) adding two small vertical posts on top of the body to keep the servo-holder in a fixed position, (c) hollowing the eyes (for RGB LEDs), and (d) adding a hole on the owl's back side for connecting wires from the servo, motion sensor, and LEDs (mounted inside the owl) to a microcontroller (located outside the owl). Based on my experience with the crow, I designed the model to allow easy access to all of the components for repair or replacement. The end result is an owl whose head will swivel to either side while its eyes flash red and orange (or any other color) whenever someone triggers the "radar" motion sensor mounted inside the owl.
I used a XIAO ESP32C3 microcontroller for this project, but any microcontroller with at least three GPIO pins will likely work. The project can be powered by an AC-to-5V DC power adapter or by a 3.7-V lithium ion battery boosted to 5V. The project requires access to a 3D printer (or printing service), soldering, and a general familiarity with using the Arduino IDE to upload program sketches to a microcontroller.
Supplies
- XIAO ESP32C3 with male headers (~$4.99 each)
- RCWL-0516 Motion Detection Sensor (~$0.91 each)
- EMAX ES08MDII Servo (~$16.33)
- WS2812B 5050SMD Addressable RGB NeoPixel 5V DC x 2 (~$0.15 each)
- Mini PCB (~$1.25 each)
- Straight Female Header Connectors for PCB (2.54 mm spacing)
- Assorted Breadboard jumper wires
- 4/40 x 1/4" machine screws (2)
- Wire, solder, heat shrink, hot glue sticks, BluTack
- PLA and TPU filament for 3D printer
For AC-to-DC power option: USB C/Type-C Power Supply Adapter, 5 Volt ($9.99)
For battery power option: 18650 Lithium Battery (~$4.50); 18650 Battery Holder (~$0.80); Adafruit MiniBoost 5V @ 1A - TPS61023 ($3.95); USB-C Male Plug Cable (~$1.80)
Tools
- wire cutter
- wire stripper
- needle nose pliers
- hot glue gun
- soldering iron
- 3D printer
Print 3D Parts
The required and optional printed parts are listed below.
- Owl Head (PLA): The head was printed with supports at a 0.38 mm layer height (20% infill).
- Owl Body (PLA): The body was printed with supports at a 0.38 mm layer height (20% infill).
- Owl Eyes (PLA): The two (2) eyes were printed with supports at a 0.18 layer height using a translucent ("natural") filament. Given the small size, you may wish to print with a brim to facilitate adhesion to the build plate.
- Servo-Holder (PLA): The servo-holder was printed with supports at a 0.25 layer height. You'll likely need to file the outside edges of the small round holes on either side of the rim so those notches will fit snugly around the cylindrical pegs on top of the owl body.
- Servo-Plug (TPU): The servo-plug was printed without supports at a 0.25 layer height (20% infill).
- Owl_Box (PLA): The box for the circuit board was printed without supports at a 0.38 layer height.
- Lid_Owl_Box (TPU): The lid for the circuit box was printed without supports at a 0.325 layer height.
For battery power option:
- 18650_Box (PLA): The battery box was printed without supports at a 0.38 layer height.
- Lid_18650_Box (TPU): The lid for the battery box was printed without supports at a 0.325 layer height.
All parts were created using Fusion 360. The STL files can be downloaded below.
Assemble the Owl
- Insert the 3D-printed eyes into the front of the hollow eye tubes on the owl's head. The eyes from my printer fit snugly but you may need to use a little glue on the shafts if the eyes are loose.
- Solder wires to the RGB LEDs: Solder long wires to the 5V, Din and gnd solder pads on one side of the first neopixel. The other ends of these wires should have male Dupont pin connectors. Solder short wires (~ 3 inches) between the solder pads on the Dout side of the first neopixel and the Din side of the second neopixel.
- Hot glue the RGB LEDs to the ends of the eye tubes on the inside of the owl's head (see picture).
- Place the servo-plug inside the owl's head as shown in the picture after threading the LED wires through one of the plug's holes near the beak side of the head. As shown in the picture, Blu Tack putty adhesive was used to hold the plug in place during initial testing. After confirming that everything works, small dollops of hot glue can be applied to more durably secure the plug..
- Solder wires to the RCWL-0516 motion sensor: Solder long wires to the Vin, Out and Gnd solder pads (see picture). This microwave "radar" device is omnidirectional and very sensitive, detecting movement at relatively long distances (~7 meters) and through walls (see this video for more information). Depending on your situation, you may want to reduce the sensitivity by soldering a resistor to the R-GN solder pads. I attached a 220 K-ohm resistor and was still able to detect movement 2-3 meters away.
- Mount the RCWL-0516 sensor inside the owl body: I covered the entire sensor with heat shrink and applied double-sided foam tape to one side. After threading the 3 connecting wires out through the hole in the owl's back, the sensor was attached to the inside front of the owl using the foam tape.
- Screw the servo onto the servo-holder as shown in the picture. Check to make sure the servo holder fits down over the vertical pegs in the owl's neck as shown in the next picture. The cutouts on the upper rim of the servo-holder will only fit around the pegs in the orientation shown in the picture. If the holder fits, the servo wires can then be threaded out through the hole in the owl's back.
- Attach the servo X-horn to the servo in the orientation shown in the picture. However, do not screw it to the servo shaft yet since the servo may not be in the 90-degree position. It can be adjusted later once the program sketch is running (see Step 5).
- Thread the RGB LED wires through the servo holder using the hole closest to the front of the owl. Then, thread the wires out through the hole in the owl's back.
- Place the owl's head down over the servo. The cutout in the servo plug should fit over the X-horn if the plug and horn are in the orientations shown in the pictures. Make sure the LED wires are routed under the servo horn. The head should rest flat on the neck with no gap. Gravity appears sufficient to keep the head from flying off when the servo rotates.
Wire the Circuit
The next step is to connect all three of the electronic components to the ESP32C3 microcontroller and power source. There should be a total of 9 wires with male Dupont connectors pins emerging from the back of the owl. Three will be connected to Ground, three will be connected to 5V, and three will be connected to these specific pins on the microcontroller: (1) the servo signal wire goes to GPIO7; (2) the RCWL-0516 output wire goes to GPIO2; and (3) the Din wire from the first RGB LED goes to GPIO20.
The approach I used for connecting everything was to hand-wire a small PCB board using the circuit diagram shown in the picture. First, three straight female header connectors were soldered to these locations on the board: (a) Columns 1-9 in Row J (9-pin connector), (b) Columns 11-17 in Row H (7-pin connector), and (c) Columns 11-17 in row D (7-pin connector). The male pin connectors from inside the owl are plugged into the connector in Row J, while the ESP32C3 is plugged into the connectors in Rows H and D, with the USB-C socket near column 17. The red and black lines in the diagram are the power connections to 5V and Ground (respectively), whereas the yellow, green and blue lines are the connections to the GPIO pins as described above.
The circuit board was then attached to the bottom of the 3D printed OWL_Box with 4/40 machine screws after using a 4/40 tap to thread the holes in the mounting posts. The wires from inside the owl were then threaded through the slit in the owl-Box-lid and inserted into the appropriate Row J connectors (see picture). Any excess wire can be pushed back up into the owl's belly.
Upload Program Sketch to ESP32C3 and Test
In addition to downloading the Arduino IDE 2.3.3 to your computer, you will need to install the files for controlling ESP32 boards using the IDE's Boards Manager and 2 Libraries using the IDE's Library Manager: FastLED (3.9.2 by Daniel Garcia) and ESP32Servo (3.0.5 by Kevin Harrington, John K. Bennett).
- Download/Install the Arduino IDE: Download HERE and install on your computer (Windows or Mac OS).
- Install the ESP32 Boards Manager: Open the IDE and click the Boards Manager icon (just below the folder icon in the left column). Search for and INSTALL "esp32 by Espressif Systems" (3.0.5).
- Install the Required Libraries: Open the IDE and click the Library Installer icon (just below the Boards Manager icon) to search for and install the two libraries named above. Type each Library name into the search window and click INSTALL when you find the correct Library.
- Download/Open the Animatronic_Owl sketch: Download the sketch to your computer and open it by double-clicking on the sketch file (.ino suffix) icon. You may need to add the suffix to these filename after downloading. The first time you try to open the .ino file, the IDE will ask if you wish to put this sketch in a folder, which you should do (i.e., click OK).
- Connect the XIAO ESP32C3 board to your computer with USB-C cable.
- Select Board and Port: Click the downward caret to open the dropdown menu on the IDE menu bar, then click "Select other board and port...". Select "XIAO ESP32C3" and the appropriate USB port in the popup menu. Click OK when finished.
- Verify the sketch to check for errors: Click the "Verify" icon in the IDE menu bar. The IDE will then attempt to compile the sketch, which should result in no error messages. Correct any errors before continuing.
- Upload sketch from computer to XIAO ESP32C3: Click on the "Upload" icon in the IDE menu bar. The IDE will compile the sketch again and upload the compiled code to the ESP32C3. If the IDE Output shows a "fatal error" telling you that "the port doesn't exist," you will need to manually put the microcontroller in upload mode as follows. Press and hold the "BOOT" button on the board while connecting it to your computer via USB. After the IDE indicates that the board is connected to the port, release the BOOT button. Alternatively, with the USB cable connected, press and hold the BOOT button while you press and release the RESET button. Once the IDE indicates the board is connected to the port, release the BOOT button.
After the sketch has successfully uploaded, the owl should respond to nearby motion by flashing the RGB LEDs and rotating its head 45 degrees in each direction before returning back to the front-facing position (90 degrees). After a 10-sec pause, the owl will go back to sleep until another signal from the motion detector wakes it. If the owl is not facing forward at the end of this sequence, unplug the USB cable from the ESP32C3 during the pause (while the servo is in the 90 degree position) and re-align the servo X-horn and/or servo plug as needed.
The sketch is pretty simple and hopefully the comments are sufficient to explain what's going on in each section. However, let me know if you have any questions or something doesn't make sense. If you used a different servo, you may need to change the pulse duration limits specified in the "my servo.attach" statement.
Downloads
Optional: Battery Power
If the owl Is not located near an AC outlet for a 5V power adapter, it can be powered by a 3.7 V lithium ion battery connected to a 5V boost module. The program sketch is intentionally "battery friendly" since it puts the owl into deep sleep in the absence of nearby motion. In my case, I soldered wires from the + and – terminals of an 18650 battery holder to the Vin and GND solder pads (respectively) on an Adafruit TPS61023 5V MiniBoost module. After threading the wires from a USB-C male plug cable through the hole in the end of the 3D-printed battery box, I soldered the + and – cable wires to the 5V and GND solder pads (respectively) on the MiniBoost. I also tightened a small cable tie around the cable inside of the box for strain relief. Finally, I hot-glued the battery holder to the inside bottom of the battery box (see picture) and covered the box with its lid.
Closing Thoughts
A couple of thoughts for future embellishments:
Since there are still a lot of unused GPIO pins on the ESP32, it would be relatively simple to enhance the owl's spookiness by adding some owl sound effects (e.g., hooting, screeching) using a DFPlayer Mini and speaker.
Another thing to consider is enclosing the circuitboard inside the owl or its base, keeping most of the wires hidden except for the power cord.
Finally, one could take advantage of the ESP32's WiFi or Bluetooth capabilities to trigger the animation remotely or to upload data on how often the animation is triggered by the motion detector.
I hope you've had a hoot reading about my owl--better yet, give a hoot and try making your own!