Introduction: Glowing LED Mushroom Log Lamp
Runner Up in the
In this instructable i will show you how to make a bluetooth-controlled, color changing, LED mushroom log lamp!
I have tried several times to grow bioluminescent mushrooms, and though i had some success, they were not the big-glowing mushrooms i had fantasized about. So i built my own.
Step 1: Ingredients
- A very cool log - this is one of the most important pieces. You need a small-ish log, no bigger then a breadbox, but it should be interesting looking. Something aesthetic that would look cool with mushrooms growing out of it. It should also sit stably on a table. Panellus stipticus prefer deciduous logs, especially oak. This is, of course, completely irrelevant for robo-mushrooms. Spend some quality time exploring your local outdoors for the perfect log.
- 100% Silicone caulk - this is what the mushroom cap will be made out of.
- White, translucent plastic tube, various diameters - this will be the stalk of the mushroom. The color should match dried silicone, which is a clear-white. I found some tube at my local ace hardware that i could buy by the foot, for about $0.35 per foot. I bought one foot each of three different diameters, one for each of my mushrooms that will be different sizes. I forgot what it was called, but it looks like it was clear PEX from my google searches. I would avoid clear vinyl tubing, as this is too clear and will not match the silicone.
- Adafruit Trinket- this is what we will use as the microcontroller to change the color of the lights. It is basically a smaller version of an Arduino. This project could easily be simplified to be just a single color, or use the very cool automatic color changing LEDs if you aren't savy with Arduino programming, but that is not the project i will be describing, and everyone should learn how to use an Arduino anyway.
- Bluetooth module - this needs to be any of the cheap, small, bluetooth serial modules available out there. I used an HC-06. It basically just allows you to make a serial connection to the microcontroller via bluetooth, and that way we can use a bluetooth serial terminal on our phones to control it. Don't worry if this sounded confusing, it will all be made clear in the coming steps.
- Adafruit Neopixels - these are the LEDs we will be using. These LEDs are special in that they can all be controlled individually by a single pin on the microcontroller. Because we are using a trinket, we are limited on IO pins. We don't have enough to control individual RGB LEDs, which would require three IO pins each.
- A capacitor - recommended by Adafruit for these LEDs to filter out voltage spikes that can damage them. The bigger the better. I had a 330uF lying around that i pulled from a stereo at some point. I used that and a .1uF for any higher frequency noise. You filter a broader band using multiple caps of different values.
- A 5 volt wall adapter - for powering the lamp once built. I would recommend using a USB cable to power the trinket through its USB port.
- Soldering iron, hot glue gun, and a drill - for construction
Step 2: Build the Mushroom Caps
For this we will use silicone to hand mold mushroom caps, then embed the LED inside of them. We will be using the soapy water trick to make the silicone suitable to mold by hand.
Don't quote me on this, but i believe the way this works is that the water accelerates the curing process for silicone, making it harden faster, and the soap just keeps your fingers slippery so it isn't sticky when you touch it.
Mix up some soapy water in a dish. You don't need much soap. I used just a couple squirts in a dish with maybe 12oz of water. Now squirt a healthy dose of silicone directly into the liquid. Wait a minute or so, then stick your hands in and start playing with the silicone. It should be moldable like a soft clay, without sticking to your fingers. The longer you wait, the firmer it will get. Eventually it comes to the right consistency to mold into a good mushroom cap shape. Once you get it into shape, take one of your LEDs and press it into the bottom center until it is firmly embedded.
Now you need to let it cure. Since the mold might still be too weak to take out and rest on a hard surface without denting, you might want to leave it in the water (i know, leave it in the water to "dry", chemistry is weird). I have had success floating it on the surface, with the LED leads sticking out. Don't worry about the LEDs getting wet. They are waterproof.
Be careful not to let any dirt or hairs touch the silicone while you do this. They are a pain to get out, and no one likes hairy mushrooms.
Step 3: Prepare the Wood
I don't have any good photos of this part, but it should be straightforward. We need to clean up the wood, drill some holes for the tube, and then seal it if you want to.
I found a very interesting looking chunk of some sort of root structure of a tree. I brushed it off and cleaned it up with some water and soap to drive out any critters living inside, then I let it thoroughly dry out. I broke off some small chunks so that it would sit flat on the table, and then i drilled three holes near each other that were the size of each of the three diameters of piping that i got. Finally i used a spray on sealer to clear coat the whole thing, just to protect it.
One other consideration is where the electronics will go. if you can carve out a compartment underneath, this would probably be ideal. I simply glued them all to the back of the log, since the shape allowed for them to be sufficiently hidden that way, of course now this lamp has to be against a wall rather then as a centerpiece.
Step 4: Build the Circuit
Basically we have three components, the trinket, the bluetooth module, and the LEDs.
The bluetooth module specifies 3.3 volt logic levels. Due to conservative voltage thresholds, a 5 volt device can receive 3.3 volt data signals, but going the other way might damage the 3.3 volt device. It is recommended to toss a resistor inline with the signal form the 5V micro to the 3.3V bluetooth, or to build a voltage divider to attenuate the signal. However, I connected them directly and was able to send and receive with no issues. I included the resistor in my drawing though, just to be safe. Any value over 1k will probably suffice. There are lots of good tutorials online about how to use these modules if you still have questions after reading this.
The Neopixels are all powered by the same 5V and ground wires, and since we are only using three of these, we can easily power them straight from the 5 volt line on the trinket. I have mine powered from the "USB" power pin. If you wanted a log with many, many mushrooms, you might want to power these directly from the supply without going through the board.
The magic of the neopixels is that they have a digital logic circuit inside that lets them receive commands, react, and pass the command on to the next LED in line. This way, each one can be individually controlled using only a single data pin from the microcontroller. Pretty neat! You can see in the diagram how they are all chained together with the green wire.
Check out the Neopixel uberguide for all you could ever want to know about these. Here are some of the important take-aways taken directly from their site, and my comments:
- Adafruit recommends a 0.1 μF capacitor between positive and ground on each pixel.
- I didn't do this for each pixel, only the first.
- When connecting NeoPixels to any LIVE power source or microcontroller, ALWAYS CONNECT GROUND (–) BEFORE ANYTHING ELSE. Conversely, disconnect ground last when separating.
- When using a DC power supply, or an especially large battery, we recommend adding a large capacitor (1000 µF, 6.3V or higher) across the + and – terminals. This prevents the initial onrush of current from damaging the pixels.
- I didn't use one quite so large, mine was 330uF because it is what i had available.
- Place a 300 to 500 Ohm resistor between the Arduino data output pin and the input to the first NeoPixel. The resistor should be at the end of the wire closest to the NeoPixel(s), not the microcontroller. Some products already incorporate this resistor…if you’re not sure, add one…there’s no harm in doubling up!
- Since our lines are so short, it shouldn't be very important where this resistor goes, and it is probably not even necessary. I am guessing this is to limit noise and inductance spikes. Long stretches of wire can pick up lots of electromagnetic noise (like an antenna!), and the sensitive inputs on the LEDs might read this as data signals and start acting screwy. A resistor might partially drop those very weak signals. Long stretches also act as inductors and build up a magnetic field around them as current flows. When the current stops, this energy must be dissipated. a resistor can provide the dissipation, thus avoiding voltage spikes that can damage sensitive inputs. Just my theories. Might as well throw in a resistor anyway if you have one.
The trinket will be tying everything together, reading the bluetooth message from the module (sent by your phone) and sending a command to the LEDs. Read about the trinket here. The biggest "gotcha" about the trinket, in my opinion, are that the pins 3 and 4 are tied to the USB, so when programming, if you have a circuit using those pins, you might get some unexpected behavior. That is why i avoided them for this project. For future reference, the best way i have found to use them is to build the circuit with headers that the trinket can plug into, so it can be fully removed from the circuit to program. The other thing to watch out for is that the pin numbering isn't the same for analog and digital commands. Again, not applicable here.
I recommend building this out on a breadboard before soldering, to make sure everything is working correctly.
Step 5: Program the Microcontroller
Attached is the code. I had trouble copying it into this post for some reason.
Note that you will need to get the neopixel library for this to work. This is a bunch of background code that Adafruit has written to make interfacing with the LEDs very easy. If you want to customize this program to change the display, read through the tutorial to get an understanding of how it works. I used some pieces from their examples in my code.
Copy and paste the routine into your Arduino IDE and upload it to the trinket. Note that the trinket takes a few extra steps to get working on the Arduino IDE.
This code just about filled up the small program memory on the trinket, so there is not a lot of room to add extra functionality unless you want to optimize some of my code. I would have preferred to do the color fading with sin functions, but apparently those take up to much space (probably due to the lookup tables they need to load), so I stuck with Adafruits linear approach.
Step 6: Put the Lamp Together
Cut the tubes to different lengths, with the largest diameter having the longest length. Thread the wires from the mushroom caps through the tubes. Use the biggest tube diameter for the biggest mushroom cap, and the smallest for the smallest cap etc. Then push these wires and tubes through the holes you drilled in the wood. Use some hot glue to secure the caps to the tubes and the tubes in the holes. Don't forget to do all of this before you solder!
I would recommend using white wire so it is less visible through the white tubes. Also, don't forget to label the wires somehow so you know which goes to which pin. I used a 4 conductor telephone wire with colored inner insulation and a white outer insulation which worked very well.
I am a little embarrassed to show you the back of my lamp... it is not nearly as pretty as it's front. I went with a hot glue approach to attach the components directly to the wood. I have a love/hate relationship with hot glue. It is so easy, and so quick, and the perfect solution for so many situations, but it always looks crappy. I'm sure you can do a better job here then i did.
Step 7: Download the App to Your Phone
Now for the hard part. Download a bluetooth serial application from the play store. Open it up, connect to the HC-06 module, and you're done.
The above shows a screenshot of the app and the serial response from the lamp. You simply send single characters to control the lights:
- 0-4 control the brightness
- 6-9 control the fade speed
- "S" stops the fade, so you can freeze on whatever color you want (note you cannot change the brightness while stopped. Can you modify my code to make this happen?)
- "F" switches to fade together mode so all of the LEDs are the same color
- "M" switches to mix mode so they all fade different colors
- "P" puts it into pastel mode, where the colors appear whiter
- "W" just makes a soft white glow
- any other character is invalid and will pop-up the instructions to the screen, so if you ever forget, just smash the keyboard
Step 8: Enjoy!
Show off your roboMushrooms to the world! This makes a great accent piece. Leave it on all the time, with a dim slow fade in pastel mode for ambiance, then crank it up to a fast bright mixed fade for parties! How versatile!
We have a be nice policy.
Please be positive and constructive.