Spooky Town Halloween House - draft
Spooky Town Halloween House - draft
Overview:
In 2002, my wife bought a Lemax Spooky Town Black Cauldron Inn. Since then she has collected a whole village.
Over time or through normal wear and tear the power cords break. The wire in the Lemax power cords are extremely thin. Great care must be taken not to weaken or twist it. She has several items that are broken.
Sandy puts the houses back in their original boxes after every Halloween. Last year when she took it out and plugged it in, the Black Cauldron Inn no longer worked. One of the wires had broken. I assume it was the ground because nothing worked.
Instead of repairing the power wires, I thought it would be more fun to fix the Black Cauldron Inn using a Raspberry Pi Zero WH.
I also thoought I would try to use GPT (ChatGPT) on this project.
Soldering required.
Features:
The Black Cauldron has several interesting features:
The upper gazebo floor has ghosts that move in a circle
The front door opens, a witch comes oui, and after a few moments she goes back inside and the door closes
There are many led lights, some of the lights flicker
Creepy music plays and every so often a spooky laugh is heard
Parts (prices of parts and tools are in USD):
Raspberry Pi Zero WH v1.1 ($5 without headers. I am using with headers. Without headers would require a bit more soldering)
MicroCenter $14.99
AdaFruit $14.00
Lemax Black Cauldron Inn - retired, new oness are no longer for sale. I am guessing these cost about $50-$150,
Repeatable sub-steps may require additional parts
4x 330 ohm resistors (anywhere from 330 ohm to 1K ohm willl work)
4x Female-Female jumper wires (2 colors)
6x 1.55 shrink tube
5mm LED
TB6612 stepper motor controller
Tools and Services:
Soldering Iron Station, Deoxit Tip Tinner and Cleaner, and Solder
Needle nose pliers. Wire Stripper
Flat head and Phillips Head Screwdrivers
Box cutter, X-acto knife
Breadboard and jumper wires
MacBook (a PC can be used)
Notes:
Text enclosed in spades, like this ♣replace-this♣ should be replaced with an actual value
I’ve attempted to credit every source used in the references
$ indicates a command executed in a terminal window on the MacBook and usually is being executed on a Raspberry Pi
Links are to reusable steps that need to be completed
Step 1. [Optional] Download and Install Microsoft Edge
GPT is built into Microsoft Edge
GPT is accessed through the Bing icon in the upper left
Back of board
Electronics removed
Step 2. Wiring Diagram
Take apart the house and gently remove the electrnics
There is a chip on the board, which controls the electronics. Rather than trying to figure out how the chip works, I think it will be easier to replicate the audible and visible functionality.
So, cut the wires. Keep the parts.
Step 3. Setup Raspberry Pi Zero running Raspberry Pi OS
Follow the directions in the title's link.
Set hostname = BlackCauldronInn
Note these differences or important items:
Setup the RPi0 as headless
Don't put the Raspberry Pi in a case.
RPI.GPIO comes pre-installed with Raspberry Pi OS
Step 4. LED +/-
LEDs have a positive and negative leg. Once the LEDs are cut it might be difficult to tell which is positive and which is negative. The clear plastic housing of the LED has a flat side. This is the negative (aka ground or anode) side.
However, the LED by the witch had the rim of the LED trimmed off so it fits. Also, the witch's cauldron ooutside the front door hass two long leads and the LED is inside the pot. So, I cannot determine by looking which is positive or negative.
My cheat is to use a 9v battery. Briefly touch one wire to the + and the other to the - on the battery. If the LED lights up, then you got it right. If not flip it around and try again.
I marked the negative leads with a piece of tape.
330 Ohm Resistors
330 ohm resistor is needed for each LED. The LEDs will draw too much current without it and will either damage the GPIO or damage the Raspberry Pi (RPi).
The resistors can be in the range of 330 to 1K ohms. The built-in GPIO resistors are 50K, and are too large for the LEDs.
To turn the LEDs on and off, an RPi GPIO pin will supply 3.3V.
Step 5. Make LED "strings"
There are four LEDs in the Black Cauldron Inn:
Cauldron (or pot) out front
LED by door
2x on printed circuit board
A breadboard or a perf board can be used to hook everything up. However, for the LEDs, I think it is sufficient to do everything in series using shrink wrap to cover the soldered wires. The components should be soldered together.
RPi Ground: White Female Jumper to negative leg of LED (flat side)
RPi GPIO Pin: Red Female jumper to 330 ohm resistor to positive leg of LED
The shrink tube need to be put in place before any soldering.
I cut 4 Female to Female jumper wires in half (preferably two colors. I used red + and white -).
Strip off a quarter inch from the ends of each jumper wire.
Cut six pieces of 1.5mm shring tube in half. Slide shrink wrap tube over each jumper wire.
For Red wires, solder on resistor, then shrink tube
Slide on shrink wrap
Solder resistor to positive leg of LED, then shrink tube
For black wires, slide on shrink tube, solder wire to negative leg of LED (flat side), then shrink tube
Where the "strings" are soldered is brittle. So, do not try to bend the wires in those spots.
Test:
An easy way to test if the "strings" work is to connect the white wire to an RPi ground pin and the red wire to a 3.3v pin.
If the LED lights up then it works.
Step 6. GPIO Pins for LEDs
The next step is to choose GPIO pins.
The ghosts upstairs are driven by a motor, the door opens and closes using another motor, and the speaker is used for sound. Don't use pins that may be needed for other things: 0-4, 7-11, 12-15, and 18-21, which leaves: 5-6, 16-17, 22-27
GPIO 0-8 have a default state of 1 (high or close to 3.3V)
GPIO 9-27 have a default state of 0 (LOW or close to 0V)
I think it would be best if during power on and boot up, the LEDs are off. So, pick GPIOs highher than 8.
I like to have similar things in a row. So, I am choosing the inside row of GPIO Pins for the LEDs: 17, 27, 22, and 26. And the outside for GRND. But you can pick whatever you want.
GPIO 17 = witch's cauldron
GPIO 26 = witch's door
GPIO 13 = board light 1
GPIO 27 = board light 2
Troubleshooting:
One of the "strings" didn't work. I checked the connections between each component and found the LED was not working. I ordered 100 LEDs from Amazon in a variety of colors.
This is not so much troubleshooting as a duh moment. Pins are numbered from the microSD slot upwards. For some reason, I kept trying to do it the other way around and nothing worked. In the process, I blew out pin 22. So, I switched to pin 13.
Test Code:
import RPi.GPIO as GPIO
import time
CAULDRON = 17
DOOR = 26
LED1 = 13
LED2 = 27
GPIO.setmode(GPIO.BCM)
# GPIO.setwarnings(False)
GPIO.setup(CAULDRON,GPIO.OUT)
GPIO.setup(DOOR,GPIO.OUT)
GPIO.setup(LED1,GPIO.OUT)
GPIO.setup(LED2,GPIO.OUT)
def my_led(pin, name):
try:
print(name + " pin=" + str(pin) + " LED on")
GPIO.output(pin,GPIO.HIGH)
time.sleep(5)
print(" LED off")
GPIO.output(pin,GPIO.LOW)
except:
PRINT("Failed: " + name + " pin=" + str(pin))
# Witch's Cauldron
my_led(CAULDRON, "Cauldron")
# LED by witch's door
my_led(DOOR, "Door")
# LED1 that was on BCI board
my_led(LED1, "LED1")
# LED2 taht was on BCI board
my_led(LED2, "LED2")
GPIO.cleanup()
Create a file called bci.py. Copy the code above. And run using: sudo python bci.py. Note: python requires prooper spacing. Sometimes cutting and pasting code messes with the spacing. This is why I put code in github. The above should be bci_v1.py. replace this text box with a wget and instructions to run
Step 7. TB6612 Assembly
Solder the headers onto the TB6612 following the directions in the link.
Step 8. Witch's Door Motor
Follow the directions in AdaFruit's Python and CircuitPython Stepper Motors.
???simplify steps a bit??? focus on RPi0
Create USB to wire to female header pins
Create perf board with TB6612 with header pins: 2 motor, 2 motor power supply, 5 for TB6612
Solder on header for TB6612
watch videos
light behind witch blinks rapidly after door is opened for about 3-5 seconds
LEDs on-board light up right & left-side of house. I think it would be better if the cycled on and off.
spooky laugh: https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero
boo sounds, witch's brew and witch's laugh
on/off switch: https://www.makeuseof.com/tag/add-power-button-raspberry-pi/
motors:
ghosts upstairs
door open and close: Mabuchi Motor: FF-030PK what is model number?, BD310224, TB6612
Use two power adapter with TWO USB outputs both at 5.1V, use oone to drive motor
move code to github
put everything together