Smalls
Published

Animatronic Fox Head - Companion Bot

This animatronic fox can wiggle its ears, tilt its head and has animated eyes. All movement and animations play autonomously and at random.

IntermediateFull instructions provided8 hours1,453
Animatronic Fox Head - Companion Bot

Things used in this project

Hardware components

1.14 inch LCD Display Module IPS Screen
You can use a different sized screen if you'd like. Waveshare makes a bunch of different sizes. Make sure to adjust the right areas of the code to configure it to your screen size.
×1
Raspberry Pi Zero Wireless
Raspberry Pi Zero Wireless
I used this one from amazon: https://a.co/d/fySUAy8
×1
Pc Computer
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Audio / Video Cable Assembly, Mini HDMI Type C Plug
Audio / Video Cable Assembly, Mini HDMI Type C Plug
×1
FH-2502 Nano Servo 2g Steering Gear
×2
MG90S Servo 9G
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
AlloverPower 3V - 24V 1.5A 36W Universal Adjustable DC Power Supply
Any generic power supply able to generate 5V and connect to a breadboard will work.
×1
Arduino UNO
Arduino UNO
×1
USB-A to B Cable
USB-A to B Cable
×1
Worbla (Thermoplastic)
×1
Mounting Tape
×1
Mounting Putty
×1
Faux Fur
×1
UV Resin - Hard Type
×1
1/4" Wooden Dowel
×1

Software apps and online services

Arduino IDE
Arduino IDE
Raspbian
Raspberry Pi Raspbian
Must be 32-bit with Desktop version.
3D Slicer Program

Hand tools and fabrication machines

Heat Gun
3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
UV Resin Light
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Custom parts and enclosures

Eye Animations

All of the eye animations formatted to the right resolution for the 1.14 inch SPI LCD Screens.

Servo Mounting Brackets

Schematics

Uno and Servo Wiring

How to wire your servos to your Arduino Uno

Code

Companion Bot Servo Code

Arduino
Final code with natural movements and delays, triggers servos at random with randomized angles and delay.
#include <Servo.h>

//original code transcribed from Mike Theevil's video: https://www.youtube.com/watch?v=1doy5nNS-cg
//modified by Smalls on Nov 8 2023

Servo rear; //create servo object to control a servo
Servo lear; //create servo object to control a servo
Servo head; //create servo object to control a servo
// twelve servo objects can be created on most boards

void loop_rear() {
 int r1 = random(10, 90); //defines variable and sets servo step amount between 0 and 170 degrees
 int r2 = random(500, 2000); //defines variable and sets random delay 
 int r3 = random(2000, 10000); //defines variable and sets neutral random delay     

 rear.write(r1); //makes servo position random
 delay(r2); //triggers random relay
 rear.write(90); //resets servo to neutral position
 delay(r3); //triggers neutral random delay           
}

void loop_lear() {
 int l1 = random(90, 170); //defines variable and sets servo step amount between 0 and 170 degrees
 int l2 = random(500, 2000); //defines variable and sets random delay 
 int l3 = random(2000, 10000); //defines variable and sets neutral random delay     

 lear.write(l1); //makes servo position random
 delay(l2); //triggers random relay
 lear.write(90); //resets servo to neutral position
 delay(l3); //triggers neutral random delay           
}

void loop_doubleear() {
 rear.write(10); //right ear at 10
 lear.write(170); //left ear at 170
 delay(1000); //delay for
 rear.write(90); //makes servo position random
 lear.write(90); //resets servo to neutral position          
}

void loop_head() {
 int h1 = random(40, 140); //defines variable and sets servo step amount between 0 and 170 degrees
 int h2 = random(500, 2000); //defines variable and sets random delay 
 int h3 = random(2000, 10000); //defines variable and sets neutral random delay     

 head.write(h1); //makes servo position random
 delay(h2); //triggers random relay
 head.write(90); //resets servo to neutral position
 delay(h3); //triggers neutral random delay           
}

void setup() {
  rear.attach(9); //attaches the servo on pin 9 to the servo object
  lear.attach(10); //attaches the servo on pin 9 to the servo object
  head.attach(11); //attaches the servo on pin 9 to the servo object
}

void loop() {
  byte randNum = random(4); //max range of numbers
  switch (randNum) //switches between the random numbers assigned in this loop
  {
    case 0:
      loop_rear();
      break;
    case 1:
      loop_lear();
      break;
    case 2:
      loop_head();
      break;
    case 3:
      loop_doubleear();
      break;
  }            
}

Servos - Neutral Position

Arduino
Sets your servos to the 90 degree angle which is your middle neutral position between 0 and 180.
#include <Servo.h>

//Created by Smalls on Nov 8 2023

Servo right; //create servo object to control a servo
Servo left; //create servo object to control a servo
Servo center; //create servo object to control a servo
// twelve servo objects can be created on most boards
     
void setup() {
  right.attach(9); //attaches the servo on pin 9 to the servo object
  left.attach(10); //attaches the servo on pin 9 to the servo object
  center.attach(11); //attaches the servo on pin 9 to the servo object
}

void loop() {
  right.write(90); //resets servo to neutral position
  left.write(90); //resets servo to neutral position
  center.write(90); //resets servo to neutral position
  }            

Credits

Smalls

Smalls

6 projects • 27 followers
Making stuff, breaking stuff, and learning everything I can. IG & TT: @smallswonderworks
Thanks to Geek, The Bald Engineer, and d3Jake.

Comments