Spooky Scary Skeleton A fun Halloween Robot 9 October 2022 7 minute read By Kevin McAleer Share this article on Table of Contents Spooky Scary Skeleton RobotBill of MaterialsMicroPython CodeRangefinder.pyBare Bones - a simple Skeleton programAssemblyBottom sectionServoCogJawThe Eye BrowsThe GasketTop SectionThe Range FinderThe SkullThe PicoWiring up the Robot - plug and playConnect the servoConnecting the HC-SR04 Range FinderThe STL filesSkeletonPumpkin Tags: Raspberry Pi Pico W Pico Pico W Robot MicroPython Halloween 3D Printing Difficulty: Intermediate Category: micropython pico halloween robot 3dprinting Code: https://www.github.com/kevinmcaleer/bare_bones Home Blog Spooky scary skeleton Spooky Scary Skeleton A fun Halloween Robot 9 October 2022 | 7 minute read | By Kevin McAleer | Share this article on Videos For every project I create, I often make a corresponding YouTube video. Sometimes, there might be more than one video for a single project. You can find these videos in this section. Explore more through these this dedicated videos. 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 first part to start with is the bottom section. Servo Screw in the servo using 2 M2 bolts. The servo spindle should be towards the middle of the robot. Cog Cut the servo horn with a pair of wire cutters so that it fits into the cog Push the servo Horn onto the cog Make sure the servo is at the minimum rotation position (turn it clockwise until it doesn’t turn any more) Push the cog onto the servo spindle. Ensure the cog can turn correctly and doesnt catch on any rough 3d printed parts Jaw Slide the jaw into place under the cog - the jaw should be in the closed position The Eye Brows Slide the Eyebrows into place under the cog - the eye brows should be in the closed position The Gasket The gasket adds a little extra room for the cog without affecting the flat underneath of the top section It means we can print out other sizes if this doesn’t work correctly Top Section Push the captive M3 nuts into the nut-holes on the bottom section. Use plyers to gently push them into place Screw the 3 M3 bolts into place The Range Finder Screw the Range finder into place using the M2 bolts - they wont go all the way in, which is expected The Skull Glue the skull into place but applying superglue onto the raised box section - (adult supervison required!) Wait for the glue to set before moving onto the next step (30 minutes for fast setting glue). The Pico 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 Connect the servo Connect 3 male to femail Dupont cables from the servo to the 5v, GND and the signal line to GPIO15 pin on the Pico The middle wire is the 5v line The brown wire is the GND line The orange wire is the signal line Connecting the HC-SR04 Range Finder 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: top.stl - the top section bottom.stl - the bottom section skull.stl - the front skull cog.stl - the servo cog eyebrows_v2.stl - the eye brows jaw.stl - the jaw gasket_v3.stl - the gasket If you want the Pumpkin version here are the STL files you’ll need (the electronics are exactly the same). Pumpkin top.stl - the top section bottom.stl - the bottom section cog.stl - the servo cog gasket_v3.stl - the gasket (you may need x2 of these) eyebrows_v2.stl - the eye brows jaw.stl - the jaw pumpkin.stl - Pumpkin face eyemask.stl - Eye mask (goes behind the pumpkin face, best printed in Black PLA) If you enjoy these files, please consider buying me a coffee (it took a while to design these!) Code View Code Repository on GitHub - https://www.github.com/kevinmcaleer/bare_bones Liked this article? You might like these too. Bluetooth remote controlled robot Learn how to build your own Bluetooth remote controlled robot using a Raspberry Pi Pico and MicroPython Pomodoro Robot! Build your own cute Pomodoro Desk Robot - HeyBot! Using a Raspberry Pi Pico W and Pimoroni Display Pack 2.0 Simple Robot Arm 3D print a simple robot arm you can control over Wi-Fi using Phew! and the Pimoroni Inventor 2040 W BurgerBot V2 - Quick on the Draw Add a Sharpie to Burgerbot and learn how to draw with a robot! BurgerBot - a simple 3D Printable Robot Build your own 2 motor, Pico W-based, 3d printable robot Pi to Pico W Bluetooth Communication
Spooky Scary Skeleton A fun Halloween Robot 9 October 2022 7 minute read By Kevin McAleer Share this article on Table of Contents Spooky Scary Skeleton RobotBill of MaterialsMicroPython CodeRangefinder.pyBare Bones - a simple Skeleton programAssemblyBottom sectionServoCogJawThe Eye BrowsThe GasketTop SectionThe Range FinderThe SkullThe PicoWiring up the Robot - plug and playConnect the servoConnecting the HC-SR04 Range FinderThe STL filesSkeletonPumpkin Tags: Raspberry Pi Pico W Pico Pico W Robot MicroPython Halloween 3D Printing Difficulty: Intermediate Category: micropython pico halloween robot 3dprinting Code: https://www.github.com/kevinmcaleer/bare_bones
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 first part to start with is the bottom section. Servo Screw in the servo using 2 M2 bolts. The servo spindle should be towards the middle of the robot. Cog Cut the servo horn with a pair of wire cutters so that it fits into the cog Push the servo Horn onto the cog Make sure the servo is at the minimum rotation position (turn it clockwise until it doesn’t turn any more) Push the cog onto the servo spindle. Ensure the cog can turn correctly and doesnt catch on any rough 3d printed parts Jaw Slide the jaw into place under the cog - the jaw should be in the closed position The Eye Brows Slide the Eyebrows into place under the cog - the eye brows should be in the closed position The Gasket The gasket adds a little extra room for the cog without affecting the flat underneath of the top section It means we can print out other sizes if this doesn’t work correctly Top Section Push the captive M3 nuts into the nut-holes on the bottom section. Use plyers to gently push them into place Screw the 3 M3 bolts into place The Range Finder Screw the Range finder into place using the M2 bolts - they wont go all the way in, which is expected The Skull Glue the skull into place but applying superglue onto the raised box section - (adult supervison required!) Wait for the glue to set before moving onto the next step (30 minutes for fast setting glue). The Pico 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 Connect the servo Connect 3 male to femail Dupont cables from the servo to the 5v, GND and the signal line to GPIO15 pin on the Pico The middle wire is the 5v line The brown wire is the GND line The orange wire is the signal line Connecting the HC-SR04 Range Finder 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: top.stl - the top section bottom.stl - the bottom section skull.stl - the front skull cog.stl - the servo cog eyebrows_v2.stl - the eye brows jaw.stl - the jaw gasket_v3.stl - the gasket If you want the Pumpkin version here are the STL files you’ll need (the electronics are exactly the same). Pumpkin top.stl - the top section bottom.stl - the bottom section cog.stl - the servo cog gasket_v3.stl - the gasket (you may need x2 of these) eyebrows_v2.stl - the eye brows jaw.stl - the jaw pumpkin.stl - Pumpkin face eyemask.stl - Eye mask (goes behind the pumpkin face, best printed in Black PLA) If you enjoy these files, please consider buying me a coffee (it took a while to design these!)