Last year I got 229 trick-or-treaters at my house. The previous year it was 194. The year before that it was 176. The year before that I lived in a duplex that was roughly two blocks from my current house; that year I didn’t think to track how many trick-or-treaters showed up at my door – it was less than 10. The only logical conclusion we can draw from the above data is that our current house is imbued with dark Halloween voodoo. We’ve made every attempt to decorate accordingly. The first year it was spider webs and a black light. For every subsequent year we’ve tried to out-do our previous selves. In order to create an authentic movie-experience at home I own a projector (enjoy with flavacol for extra authenticity). In 2015 I discovered AtmosFearFX which is a company that produces content meant to be projected onto walls or out of windows or onto curtains. For our front-room I project a ghostly apparition onto a sheer curtain so that it roughly looks like it’s walking around inside. This has been a big hit with trick-or-treaters, so much so that I bought a(n extremely crappy) mini projector that I would never be able to use for movies, but – none-the-less – works great for projecting weird zombie hands groping for freedom on the window of our porch. This was the same year I began incorporating microcontrollers to trigger effects. I built a project with a Particle core attached to a reed switch on my front door. The Particle board sent a web request to my hue light bulb on the porch (scream sound warning): Fast-forward a few years and my setup has become even more elaborate. Sometime around 2016 I began fooling around with pneumatic pop-ups. After a few DuckDuckGos I stumbled on FrightProps and subsequently began spending too much money there. My big project this year is a pneumatic pop-up that uses an air-compressor. This is controlled by a motion-sensing Raspberry Pi. The key component is the solenoid: This controls the 30PSI (or so) coming from my air compressor to a pneumatic cylinder. The solenoid is controlled via 12V. This is more than my Raspberry Pi is capable of pushing out over GPIO. Fortunately, I have an Adafruit MotorHAT. The MotorHAT has its own 12V power supply and can be controlled by a Raspberry Pi. I also used a PIR sensor to detect motion and trigger my popup. The pop-up dummy itself is made out of 1/2" PVC tubing, zip ties, a skeleton I bought at Home Depot, and love. I control the whole contraption with some python code running on the Pi. I’ve wrapped the Adafruit MotorHAT code in (what I think is) a nicer interface for this project: Which lets me test-drive the setup pretty easily via ipython:It begins ¶
Now ¶
from Adafruit_MotorHAT import Adafruit_MotorHAT
class Pneumatic(object):
"""
Abstraction for Adafruit MotorHAT that I'm using as a weird way to drive
a pneumatic pop-up.
"""
UP = Adafruit_MotorHAT.FORWARD
DOWN = Adafruit_MotorHAT.RELEASE
def __init__(self, motor=4):
"""
:motor: Integer - 1-4. Motor output to use on the MotorHAT
"""
mh = Adafruit_MotorHAT(addr=0x60)
self.pop_up = mh.getMotor(motor)
# Max motor speed is 255
self.pop_up.setSpeed(255)
@property
def is_up(self):
return self.status == UP
def up(self):
self.status = UP
self.pop_up.run(self.UP)
def down(self):
self.status = DOWN
self.pop_up.run(self.DOWN)
>>> from scary import Pneumatic
>>> motor_output = 4
>>> popup = Pneumatic()
>>> popup.up()
>>> popup.is_up
True
>>> popup.down()
Posted