There are a couple of videos covering the features, demo and build process for HeyBot.
Spooky Scary Skeleton RobotThis 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.
MicroPython CodeDownload or clone the code here: https://www.github.com/kevinmcaleer/bare_bones
Rangefinder.pyBelow 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)
AssemblyBottom sectionThe first part to start with is the bottom
section.
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 thecog
- Push the
servo Horn
onto thecog
- Make sure the servo is at the minimum rotation position (turn it clockwise until it doesn’t turn any more)
- Push the
cog
onto theservo spindle
. - Ensure the cog can turn correctly and doesnt catch on any rough 3d printed parts
- Slide the jaw into place under the cog - the jaw should be in the closed position
- Slide the Eyebrows into place under the cog - the eye brows should be in the closed position
- 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
- 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
- Screw the Range finder into place using the M2 bolts - they wont go all the way in, which is expected
- 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).
- 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 3 male to femail Dupont cables from the
servo
to the5v
,GND
and the signal line toGPIO15 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
Connect 4 male to male Dupont cables from the range finder
to:
- the
VCC
to the3v
on the Pico - the
GND
to aGND
on the Pico (there are a few to choose from) - The
Trigger
toGPIO00 pin
on the pico - The
Echo
toGPIO01 pin
on the pico - Connect 4 male to male Dupont cables from the
range finder
to:theVCC
to the3v
on the PicotheGND
to aGND
on the Pico (there are a few to choose from)TheTrigger
toGPIO00 pin
on the picoTheEcho
toGPIO01 pin
on the pico
There are a few parts to download and print:
top.stl
- the top sectionbottom.stl
- the bottom sectionskull.stl
- the front skullcog.stl
- the servo cogeyebrows_v2.stl
- the eye browsjaw.stl
- the jawgasket_v3.stl
- the gasket
If you want the Pumpkin version here are the STL files you’ll need (the electronics are exactly the same).
Pumpkintop.stl
- the top sectionbottom.stl
- the bottom sectioncog.stl
- the servo coggasket_v3.stl
- the gasket (you may need x2 of these)eyebrows_v2.stl
- the eye browsjaw.stl
- the jawpumpkin.stl
- Pumpkin faceeyemask.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!)
Comments