Cthulhu Party Lamp/Accessory Using NeoPixels and ESP32 😍😎🤩
by SirLucians Solutions in Circuits > Arduino
3401 Views, 29 Favorites, 0 Comments
Cthulhu Party Lamp/Accessory Using NeoPixels and ESP32 😍😎🤩
Mozamboogy 2022, I had my ticket, and I was prepped.
But was I really? Something was missing...
It'd been a while since I last went to a festival. Y'know, that whole pandemic thing? It had also been some time since my last "personal project" and I was feeling like I needed some "creative outlet".
Several years ago there had been another Mozamboogy, and at that one, I'd had this Scuba diver night light (see image) that served a few purposes:
- Conversation topic
- Light when no other light is available
- Makes you easy to find when friends are looking for you in a crowd
- Fun accessory
There were a few things that could be improved on the original though:
- The original was gone. No one knew where it was. For all intents and purposes, it had gone out for a quick dive and never come back.
- I had one person complain it was too bright... One person was enough to ensure that whatever I ended up making didn't receive any such negativity.
- Could be cooler than just having one color and zero effects.
- The theme this year for Mozamboogy was monsters.
- More than one was needed if I were to surprise everyone in my campsite with a gift.
Seeing as they were so bloody popular, and I also want one... we shall make a new one together :)
Supplies
Components and Consumables (Click links to see what I used)
Electronics:
- A strip of WS2812B individually addressable LEDs (Neopixels for example) I used a strip of 10
- A microcontroller such as:
- Arduino Nano (Code for this on Github repo)
- An ESP32S (this provides some interesting options by the way for sending and receiving signals to all the people in your crew - A feature I never got around to building) As it's all I have right now it's what I'll use in this Instructables.
- An ATTiny85 - I can't confirm this one... I thought it would be cost effective but I'm struggling to get it working - If you manage, please tell me and I'll update the instructable accordingly... and the github to include your code
- 2*10k potentiometers
- A momentary switch/push button
- Perfboard/Veroboard (Okay, so it looks like the one I used isn't available anymore - but the dimentions are available via this link - you can cut yours to size and drill out the mounting holes)
- Stranded wire (I have a bunch in different colors and while it wasn't what I wanted, it became a popular feature actually) OR 3-5 core wire
- Headers (so you can remove the microcontroller if needed)
- Wires for creating the control circuit board (I use solid core CAT5 or other ethernet cable usually as it has different colors and it's stiff enough to route however I want)
- USB Cable (to power your device from battery bank)
Misc stuff
- A 5mm grommets for 8mm holes
- A somewhat transparent/translucent filament to print the Cthulhu body and any filament for the control box.
- Screws to secure the two halves of the Cthulhu together
Equipment
- 3D printer, or access to one
- Solder station, or access to one and the other soldering essential, like flux and solder.
- Multimeter (recommended but not essential)
- Breadboard and jumper wires (again, recommended but not essential)
There are other ways to interface with this that you may find preferable. If I did a redesign, I'd probably use a single rotary encoder with momentary push switch functionality to change settings instead of the two pots and a button.
Links to the files (some working files were too large to include in this Instructibles):
Github for all working files, printables (STLs) and code: https://github.com/SirLucian/Cthulu-Lamps-Neopixel-Code-and-printables/tree/main
The Code
You can just do what I did:
I get it, you just want a cool lamp, you don't want to fiddle with the code. No problem - just use mine (attached to this step) - Also available via Github - where you'll also find the code I wrote for Arduino Nano if you need it.
Stick the code in your Arduino IDE and upload to your device!
Please do ensure your circuit is set up like mine, and that your pinout on your microcontroller is identical to mine, otherwise change the values for the DATA_PIN, buttonPin, brightIn and hueIN according to your needs.
#define DATA_PIN 26 const int buttonPin = 14; const int brightIn = 32; const int hueIn = 34;
Your microcontroller may also map values differently - Check what the values are in your serial monitor when your potentiometers are all the way to either side. The values should range between 15 and 255 - If not you'll want to adjust the value 4095 on these two lines (probably to 1024... but check what works with your microcontroller)
brightnessVal = map(brightPotVal, 0, 4095, 15, 255); hueVal = map(huePotVal, 0, 4095, 0, 255);
The Patterns:
You might not like all these patterns, but you can remove the ones you don't like by removing them from the gPatterns array.
SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, bpm, juggle, singleColor, whiteColor };
Alternatively you can alter them as you see fit, or include more of your own design - they are all the functions defined after:
void loop ()
Downloads
The Electronics Part 1 - Breadboarding
Let's breadboard this to ensure it all works first:
Please see the Fritzing in this step. For the sake of clarity. I've put 3.3V connections in orange and the 5v ones in red.
If you need some extra visual help, see the third image for what it looks like IRL. I've use the same color wires where possible, again for the sake of clarity if you are new to this kinda stuff.
Downloads
The Electronics Part 2 - Make the Circuit Board
Circuit on protoboard:
We need to connect the two potentiometers and the button to the appropriate GPIOs.
To use my code without having to modify it, you'll want yours setup like the provided images. Feel free to do a better job soldering 😂
Anything that is dotted lines is on the other side of the board. The blue dots represent where soldering is required and things are connected. The blue square is where you'll be putting your button.
This diagram is nice and neat - if only my board looked nearly as neat...
There's a picture of what it looks like from the top - be aware it does get confusing flipping it over to keep track of what's gone where.
Protips:
- When planning to make it easier for myself I mark my protoboard so I know which pins are going to get soldered and where etc. I Start with soldering on the potentiometers, so I can place my ESP in an appropriate location.
- Once I know where the components will go, I work out what route my wires will take.
- Try to keep wires that cross at right angles to each other. This makes it easier to see what's going where and as an added benefit you minimise electromagnetic interference
- Use the header sockets so you can take your microcontroller out if you need it for another project between parties (or for if you make a boo boo and destroy it - it happens 😅)
- Test that your connections all only connect with the correct bits using a multimeter set to the continuity checking mode. Do this before powering up your device so you reduce the risk of frying your microcontrollers.
- If something isn't working, you can test that voltage is ending up in the correct places using your multimeter set to the DC Voltage setting.
Finally, I personally place the USB and power/data cables that go to the neopixels around and down the middle under the microcontroller to decrease the chances of them pulling off the board. You could glue them or something else if you wanna.
You could design your own circuit:
You might want to design a completely different way to control your light, so I can't tell you how.
I can tell you what I did...
Design a circuit that has 2x analogue inputs for your microcontroller of choice, 1x digital input and 1x PWM output for the LEDs. You will also need a 5v rail, and a 3.7v rail, if your device requires 3.7v logic. I power mine through the VIn and supply that to the LEDs while letting the device and it's inputs run off the 3.7v from the device it's self.
Body of Lamp
Print my print:
I've provided my Cthulhu lamp STLs in this step. It's also available on Thingiverse if you want to remix it or whatever, I'd be honored.
Or design and print your own unique version:
You will want a body in the appropriate dimensions as you want it. There are a couple things to add to whatever representation you wish your lamp to have:
- It should have a mechanism at the top to allow for securing the cable/(s) that run between the control box to the lamp.
- It should be sliced in half, you should have a way to join the two halves - I use screws at the bottom and a cap at the top.
I recommend my design. It's pretty effective, but do whatever tickles your fancy.
I have made notes on the important bits if you look in the images of the steps :)
I'll briefly go over how I would go about it again:
- Found an STL of a monster I liked (Credit: drukdrukdruk_pl for their Cute Cthulhu Walker Closed)
- Pulled it into Fusion360 as an STL
- Eyeballed position so I could slice it in half later
- Designed the thing for the screws to secure the two halves together
- Designed the top cable trap
- Made the top cap with a hole for the grommet
If you want to go over my fusion file it's on Github (sorry it's so messy - I really struggled with some parts doing this project). I woulda attached it here, but the file size is too big.
Control Circuit Housing
My design:
My files are attached here (and available on thingiverse). I've redesigned the snap fit - And the final design... exceeds all expectations. Just print in ABS and print with supports - it's not much support material and it'll be a very snappy snap fit. PRINT THE STLs called bottom_v5_LongSnapfit.stl and top_v5_LongSnapfit_LessTolerance.stl
I'm quite proud. Finally managed a perfect snapfit...
As a finishing touch, I also printed some knobs for my potentiometers curtosy of Idee_Design - To put these on the pots, I just heated them with a torch and then pushed them over the pot. I printed Pot4.STL of theirs.
If you want to do it from scratch:
If you need to (because your electronics are different), or want to, designing a box is relatively simple and there are plenty of decent tutorials out there on the topic.
Or, if you want to just alter my designs some, all my working files are attached and you can edit them as required. You can use my files and edit the dimensions as you require to make your housing work for you. Upload your remixes as remixes on Thingiverse to help out others 😁
- Start off with defining dimensions that are essential - Board size and where the mounting holes go. I followed the schematic of my protoboard.
- I measured where with relation to the circuit board I needed my button hole to be, and how big my button was so I could place this hole.
- Then I measured using my calipers how far away my potentiometers were from the base and centre and how big the holes needed to be.
- Then make a box that will fit your circuit and components, with holes for the cables to go in and out of it from the power bank and to the Cthulhu and slice it to be two halves.
- Then you make your box, with whatever design choices you have, such as style, and how to join it (snap fit or using screws) etc.
In the images, you'll find notes outlining some design choices I made
- I have pins to position the board and they go into tube like posts to secure them in place and hold the board in place vertically. The images in the step's image has notes on it
- I have a full perimeter snap fit profile as localized snap fits kept breaking (I was printing in PLA though. ABS holds up better)
- My button hole has a chamfered inset to allow easy access with your finger to press the button.
- All long skinny bits like the positioning pins get a chamfer at the bottom to relieve some stress and stop them snapping so easily.
I definitely didn't get this all right the first time. It took a few iterations (and I'm printing this iteration right now just for you, in the hope this one is the winner - and it is the winner. Perfect snapfit design it is)
I've also included v3 if you prefer - it's my old design:
I'm including my original snap fit which worked just fine - but would wear down really quickly (I originally printed in PLA though). It is the circuit-housing-*bottom*/*top*_v3.stl files in this step.
Just keep trying if you don't get it right.
Final Touches and Assembly
Prep the lamp:
- Remove the support material from the Cthulhu and sand down the edges between front and rear so they align neatly.
- Drill out the skinny screw hole if it's too small for your screws. Removing support material from that hole was pretty hit/miss.
- Put your circuit in the box, button side through the button hole. (if button isn't perfectly aligned you can widen the button hole with a craft knife)
- Take a second to double check everything works by plugging it into a powerbank before snapping the housing shut.
- If you have 3 separate wires, like I do, braid them to keep them all as "one" all the way down to your Cthulhu. For some additional strain relief the wires going to the Cthulhu are to be tied in a loose knot on the inside of the box - this will prevent you from pulling the wires off the circuit board. It is a pretty primitive strain relief solution but hasn't failed yet. You can add extra heat-shrink wherever there might be wear on the wires, but coming out the box isn't nearly as hazardous as what happens on the Cthulhu end when everyone is pawing it.
- Put the grommet in the top cap piece and thread it onto your wires, with the cap orientated like it's a bottle lid and your Cthulhu is a bottle.
- Put a section of heat-shrink (large enough to cover the bit where you solder to the LED strip) and solder the wires to the strip.
- Heat the heat-shrink onto the LED strip. This is like the strain relief on this end. You could tie another loose knot if you like here, but the grommet and the cable maze should take care of a majority of the strain relief for us.
- Roll the strip of LEDs so it fits in your lamp (some of the patterns look really cool with the strip front facing and rolling to rear facing). Place the bit where the heat-shrink is, just below the cable maze and wind it up between the sections.
- Join the front and rear sections together using the two screws and pop the top cap on and...
You're done! Get out there and party YO!
In Loving Memory of All the Fallen Cthulhu's
After several versions that didn't pass quality control, I'm proud to state that this latest version has been stress tested by the most ADHD person I know, and survived so far. He broke the last two Cthulhu's in the name of product testing 😋
This step is in memory of those Cthulhu's who sacrificed everything for us and the people who helped them make their great sacrifice.
Special thanks to Richard for proof reading and Bugsy for helping me get the promo video done in time!
Also thanks to everyone else for loving the Cthulhus so much 🥰 Without so much love for them, they wouldn't be as amazing, or well built as they are now.