I’ve had this idea for Halloween for a few years now. I wanted to make my porch display into an escape room for trick or treating. The kids would have to solve an environmental puzzle to get their candy. Of course, if they fail they get a trick. In this case, the mummy sits up and scares everyone.
This project was quite complicated and had several components to it. The components I want to focus on in this project description are the Egyptian God statues. The two statues are Sobek, the God of the Nile (crocodile), and Hathor, the Goddess of love (cow).
For their functionality I wanted them to be the receptacle for two colored Gems. These gems would be analyzed for their color using a PiicoDev VEML6040 color sensor. I wanted the eyes of the statue to glow as if by magic the same color as the inserted gem. If the correct color for each statue is determined to be present then the Raspberry Pi Pico would return a true value to the main system controller. If the incorrect color is present then the Pico returns a false value.
Parts:
- PiicoDev Colour Sensor VEML6040
- 2 RGB LEDs
- Raspberry Pi Pico
- ABS Filament
- 8oz epoxy resin hardener
- 8oz epoxy resin
- Latex gem mold
- Red and blue food coloring
- AA Battery Pack
I started by making the gems:
These gems I made using a large diamond mold and 2 part epoxy resin with food coloring. It took me a couple of failed attempts to get a good cast but eventually, I did it. It was difficult to get the resin to be free of bubbles. In the future, I am planning to buy a pressure tank to keep them compressed and bubble-free.
Then I modeled the statues:
I need to establish the correct scale for the modeling. I used my digital calipers to measure the actual components I would be using. The color sensor, Gem, RGB LED, and the pico. I then modeled to scale these components in MAYA.
Next, I designed and modeled the statues in Zbrush.
Next I printed the models:
For this stage I had to prepare the models for print by breaking them up and orienting them to print such that overhanging geometry would be self supporting. I used Prusa slicer to create the gcode.
My printer is a Creality 10S. It does a pretty good job. This print was using a 0.4 mm nozzle with a layer height set to 0.16 mm at a 10% infill. The print took almost 2 days to print. Nothing failed thank goodness.
Time for assembly and electronics:
I glued, sanded, and joined the components together.
Then I wired the electronics together.
Here is the code for the project, make sure you have the PiicoDev VEML6040 and PiicoDev Unified Libraries installed on your Raspberry Pi Pico.
# PiicoDev VEML6040 minimal example code # This program reads light data from the PiicoDev VEML6040 Colour Sensor # Displays Raw Data, and classifies colours as fruits from PiicoDev_VEML6040 import PiicoDev_VEML6040 from PiicoDev_Unified import sleep_ms # cross-platform compatible sleep function import machine import utime R_LED = machine.PWM(machine.Pin(26)) R_LED.freq(1000) G_LED = machine.PWM(machine.Pin(27)) G_LED.freq(1000) B_LED = machine.PWM(machine.Pin(28)) B_LED.freq(1000) Switch = machine.Pin(14,machine.Pin.IN,machine.Pin.PULL_UP) Sobek = machine.Pin(13,machine.Pin.OUT) Gem_Color = 0 Fade_Rate = .0001 V=0 # Associate a hue value with a fruit name GemList = { "RedGem":27, "RedGem":28, "Neither":30, "Neither":70, "BlueGem":83 } colourSensor = PiicoDev_VEML6040() # initialise the sensor while True: ### Example 1: Print Raw RGB Data data = colourSensor.readRGB() # Read the sensor (Colour space: Red Green Blue) red = data['red'] # extract the RGB information from data grn = data['green'] blu = data['blue'] # print(str(blu) + " Blue " + str(grn) + " Green " + str(red) + " Red") # Print the data. Printing as BGR so the Thonny plot-colours match nicely :) ### Example 2: Classify the colour being shown - eg. a fruit sorting machine data = colourSensor.readHSV() # Read the sensor (Colour space: Hue Saturation Value) hue = data['hue'] # extract the Hue information from data label = colourSensor.classifyHue(hues=GemList) # Read the sensor again, this time classify the colour print(str(label) + " Hue: " + str(hue)) # Show the label and the corresponding hue sleep_ms(100) R_LED.duty_u16(0) G_LED.duty_u16(0) B_LED.duty_u16(0) utime.sleep(.2) GemColor = str(label) #print(GemColor) if GemColor == "RedGem": Sobek.value(0) #Red LED while V <= 65535: V += 3 R_LED.duty_u16(V) utime.sleep(Fade_Rate) while V > 0: V -= 3 R_LED.duty_u16(V) utime.sleep(Fade_Rate) elif GemColor == "BlueGem": Sobek.value(1) #Blue LED while V <= 65535: V += 3 B_LED.duty_u16(V) utime.sleep(Fade_Rate) while V > 0: V -= 3 B_LED.duty_u16(V) utime.sleep(Fade_Rate) #elif GemColor == "GreenGem": # Sobek.value(0) # while V <= 65535: # V += 3 # G_LED.duty_u16(V) # utime.sleep(Fade_Rate) # while V > 0: # V -= 3 # G_LED.duty_u16(V) # utime.sleep(Fade_Rate) elif GemColor != "BlueGem": Sobek.value(0)
This is the result.