Spooky Scary Skeleton

Build your own cute Spooky Scary Skeleton Robot for Halloween - Using a Raspberry Pi Pico/Pico W, HC-SR04 Ultrasonic Range finder, and an SG90 Servo

9 October 2022 by Kevin McAleer


Table of Contents


Videos

There are a couple of videos covering the features, demo and build process for HeyBot.


Spooky Scary Skeleton Robot

This is a rather bare bones robot for Halloween, but its loads of fun! It uses an Ultrasonic range finder to detect people in front of it to activate its scared stiff expression. The Servo moves a mechanism inside to raise the eye brows and lower the jaw.


Bill of Materials

Part Description Qty Cost
Raspberry Pi Pico The $4 microcontroller from Raspberry Pi 1 £4.00
Servo A low cost SG90 Servo 1 £3.00
Ultrasonic Range Finder HC-SR04 3.3v version 1 £2.00
M2 Bolts Securely attach the Pico W and Ultrasonic Rangefinder using M2 Bolts 8 £0.80
M3 Bolts and nuts Securely attach the top section to the bottom 3 £0.60
Female to Female Dupont cables For attaching the Pico to the servo and Range finder 4 £1.00
Male to Female Dupont cables For attaching the Pico to the servo and Range finder 3 £1.00

Prices and availability may vary.


MicroPython Code

Download or clone the code here: https://www.github.com/kevinmcaleer/bare_bones

Rangefinder.py

Below is a simple MicroPython class for measuring distance with a range finder:

# Range finder
from machine import Pin
from time import sleep, sleep_us, ticks_us

class RangeFinder():
    
    def __init__(self,trigger_pin:int = 0, echo_pin:int = 1):
        self.trigger = Pin(trigger_pin, Pin.OUT)
        self.echo = Pin(echo_pin, Pin.IN)
        
    def distance(self):
        """ Returns the distance in cm """
        
        # set the signal on & off times to zero
        signalon = 0
        signaloff = 0
        
        # reset the trigger
        self.trigger.low()
        sleep_us(2)
        
        self.trigger.high()
        sleep_us(5)
        self.trigger.low()
        
        while self.echo.value() == 0:
            signaloff = ticks_us()
        while self.echo.value() == 1:
            signalon = ticks_us()
            
        elapsed_microseconds = signalon - signaloff
        self.duration = elapsed_microseconds
        self.distance_to_object = (elapsed_microseconds * 0.343) / 2
        return round(self.distance_to_object / 10 ,1) 

Bare Bones - a simple Skeleton program!

Here is a simple program that detects the presence of a person and then triggers the scared stiff expression:

"""
This project uses the Pimoroni MicroPython build

https://github.com/pimoroni/pimoroni-pico/releases

"""
# Scared
# October 2022
# Kevin McAleer
from servo import Servo 
from range_finder import RangeFinder
from time import sleep

MAX_ANGLE = 70
MIN_ANGLE = 10
SCARED_DISTANCE = 30.0

class BareBones():

    rangefinder = RangeFinder()
    def __init__(self):
        self.servo = Servo(16)
        
    def scared_face(self):
        """ Open the Jaw and raise the eyebrows """
        
        self.servo.value(MAX_ANGLE)
        print('I\'m scared!')
        
    def not_scared_face(self):
        """ Close the Jaw and lower the eyebrows """
        
        self.servo.value(MIN_ANGLE)
        print('I\'m not scared anymore')

    def is_scared(self):
        if self.rangefinder.distance() <= SCARED_DISTANCE:
            return True
        else:
            return False
    

# Main Program
skeleton = BareBones()

while True:
    if skeleton.is_scared():
        skeleton.scared_face()
    else:
        skeleton.not_scared_face()
    sleep(0.25)

Assembly

Bottom section

The Base

The first part to start with is the bottom section.

Servo

The Servo

Screw in the servo using 2 M2 bolts. The servo spindle should be towards the middle of the robot.

Cog

The Cog

  1. Cut the servo horn with a pair of wire cutters so that it fits into the cog
  2. Push the servo Horn onto the cog
  3. Make sure the servo is at the minimum rotation position (turn it clockwise until it doesn’t turn any more)
  4. Push the cog onto the servo spindle.
  5. Ensure the cog can turn correctly and doesnt catch on any rough 3d printed parts

Jaw

The Jaw

  1. Slide the jaw into place under the cog - the jaw should be in the closed position

The Eye Brows

The Eye brows

  1. Slide the Eyebrows into place under the cog - the eye brows should be in the closed position

The Gasket

The Gasket

  1. The gasket adds a little extra room for the cog without affecting the flat underneath of the top section
  2. It means we can print out other sizes if this doesn’t work correctly

Top Section

The Top section

  1. Push the captive M3 nuts into the nut-holes on the bottom section. Use plyers to gently push them into place
  2. Screw the 3 M3 bolts into place

The Range Finder

The Range Finder

  1. Screw the Range finder into place using the M2 bolts - they wont go all the way in, which is expected

The Skull

The Skull

  1. Glue the skull into place but applying superglue onto the raised box section - (adult supervison required!)
  2. Wait for the glue to set before moving onto the next step (30 minutes for fast setting glue).

The Pico

The Pico

  1. Flip the robot over and attach the Pico using 4 M2 bolts

Well done - you’ve assembled the robot, next to wire it up


Wiring up the Robot - plug and play

Wiring Diagram

Connect the servo

  1. Connect 3 male to femail Dupont cables from the servo to the 5v, GND and the signal line to GPIO15 pin on the Pico
  2. The middle wire is the 5v line
  3. The brown wire is the GND line
  4. The orange wire is the signal line

Connecting the HC-SR04 Range Finder

  1. Connect 4 male to male Dupont cables from the range finder to:
    • the VCC to the 3v on the Pico
    • the GND to a GND on the Pico (there are a few to choose from)
    • The Trigger to GPIO00 pin on the pico
    • The Echo to GPIO01 pin on the pico

The STL files

Skeleton

There are a few parts to download and print:

If you want the Pumpkin version here are the STL files you’ll need (the electronics are exactly the same).

Pumpkin

If you enjoy these files, please consider buying me a coffee (it took a while to design these!)

Did you find this content useful?


If you found this high quality content useful please consider supporting my work, so I can continue to create more content for you.

I give away all my content for free: Weekly video content on YouTube, 3d Printable designs, Programs and Code, Reviews and Project write-ups, but 98% of visitors don't give back, they simply read/watch, download and go. If everyone who reads or watches my content, who likes it, helps fund it just a little, my future would be more secure for years to come. A price of a cup of coffee is all I ask.

There are a couple of ways you can support my work financially:


If you can't afford to provide any financial support, you can also help me grow my influence by doing the following:


Thank you again for your support and helping me grow my hobby into a business I can sustain.
- Kevin McAleer