How to Make a Driftwood Mood Lamp With Infrared Remote Control (using Arduino, an ATtiny85 and an Adafruit NeoPixel Ring)
Introduction: How to Make a Driftwood Mood Lamp With Infrared Remote Control (using Arduino, an ATtiny85 and an Adafruit NeoPixel Ring)
I wanted to make a lamp from some old aquarium driftwood that was lying around, where the colours could be selected using an infrared remote and that would run on USB power using the small powerful ATTiny85 chip.
The design allows the user to choose from warm colours (reds, purples, oranges), cool colours (greens and blues) or specific colour choices. A total of 9 different selections. It also has adjustable brightness settings.
Supplies
Equipment needed as follows:
For base:
* Old pieces of wooden patio decking
* Gnarled driftwood
* Wood glue
For electric circuitry:
* An Arduino
* Breadboard
* Adafruit Pixelring (12 LED variant)
* Infrared remote and receiver
* Capacitor 100-1000 uF and atleast 6.3v
* Resistors (470 ohm) and (4.7k ohm)
* ATtiny85
* Sparkfun ATtiny Programmer
* Micro USB power source
* L-Headers
* USB extension cable (here)
* Button switch
* Wire in different colours
* Heat shrink wrap
* (Note I have created a PCB that makes the project neater. I have shown this at the end.)
Tools needed:
* Small router for base edging
* Table saw
* Soldering iron and solder
* Dremel tool
Step 1: Make the Base
The base is made from two pieces of old patio decking we had lying around.
Start by cutting off the edges using a table saw, leaving the width of both main pieces of wood at 8cm each (meaning removing 1.5cm from each side). This should leave you with two pieces of wood 16cm by 8cm. Obviously adjust this as needed based on the width of wood available.
Then glue those two pieces together to form a 16cm x 16cm base.
Next glue the offcuts to the base (per the picture) having cut the corners to 45 degrees.
This will allow enough depth to fit all the electronics into, later in the project.
Finally shape the edges with a router to give an elegant finish on the upper side.
Step 2: Add the Pixel Ring, Infrared Receiver and USB Power Source
Next, drill three small holes to allow the legs of the infrared receiver to connect from the surface to the underside of the project.
Also cut three more holes in the correct position for the pixel ring (the points you need to connect are 5V, GND and data in). 769
Ignore data out for this project.
Solder wires to the three legs of the IR receiver and also the pixel ring.
Finally cut a hole using a Dremel to allow a micro USB extension to be fitted (the one I used is shown in the image and goes from female (with a flush fitting) to male).
Step 3: Test the Circuit on a Breadboard Using an Arduino
I used an arduino micro for testing but use any you have to hand.
The wiring is as follows:
* IR receiver signal wire to Pin 5 of micro arduino
* Connect Pin 9 of Arduino to Pixel ring data in wire via a 470 ohm resistor (suggested in best practice guide from Adafruit. See here for details.)
* All other lines connected to 5v and GND with a 100-1000 uF (atleast 6.3v) capacitor between the lines. I used a 1000uF 16v variant.
Next ensure that you know the correct codes from the Infrared transmitter so that you can code the buttons to do what you want them to do.
To do this follow the instructions shown here. Note the need for the IRremote.h library to be added in the Arduino IDE. The result will be that you will have an accurate list of codes for each button on your remote.
Then use the following code ensuring that you change the RGB colours to the ones you want and amending the "Define Key" section to be correct for your IR remote.
Also note that both the IRremote.h and Adafruit_NeoPixel.h libraries are needed for this code. You can add these in the Arduino IDE Manage Library tool.
The code does something quite simple:
* Buttons 1-5 just show single colours.
* Button 6 to 8 cycle though colour combinations.
* And button 9 runs the lovely Rainbowcycle sequence.
* Button 0 then turns the LEDs to Black.
* Finally the right and left keys increase or decrease the brightness. 991