Introduction: Twinkling Starry Night With Arduino and LEDs
I've always liked Vincent van Gogh's Starry Night, so I decided to try making a felted "painting" and take the scene one step further: add some twinkling stars! In this Instructable, I will show you how to add LEDs to felt, and to use Arduino to program the LilyPad Arduino Simple Board. You will also see how I finished the project.
- Felted fabric panel of image of choice
- Pre-Wired 3mm LEDs (I used THESE)
- White Plastic LED Bezel Holder, 3mm
- Stranded Hook-Up Wire (SparkFun)
- Heat Shrink (SparkFun) or Electrical Tape
- Heat Gun or Match (for Heat Shrink)
- LilyPad Arduino Simple Board (SparkFun)
- FTDI Basic Breakout Board and Mini-B USB Cable (SparkFun)
- LilyPad Coin Cell Battery Holder - Switched
- Solder Iron and Solder
- Needle and Assorted Colors of No. 5 Embroidery Thread
- Black Canvas (Michaels)
- Open Back Frame
- Hot Glue Gun
Step 1: Choose an Image to Embellish With LEDs
You can use any sewable fabric or other material for this project. Any sturdy piece of fabric will work, but make sure that it is thick enough to hold up to the added weight of the LEDs and the wiring.
I chose to use a piece of handmade felt for my project. I began by "painting" a 12" x 18" piece of pre-felt with colorful bits of wool roving and completing the felting process by agitating the wool in warm soapy water for about 20 minutes and rinsing in cool water. I chose Vincent Van Gogh's Starry Night, but any image will do. After felting, I refined the design by adding embroidery stitches with No. 5 cotton thread in various colors. When this was completed, I "blocked" the felt piece by steam-ironing and setting it aside to dry. Its finished size is about 9" x 14".
ADDITIONAL NOTE ABOUT FELTING:
There are many online tutorials and Instructables for making felt, if you would like to learn more about felting. A good selection of tutorials is also on the Outback Fibers web site. My favorite online resource for felting materials is New England Felting Supply. I like to use "short fiber" wool for felting because it felts quickly and makes a nice solid fabric. Someday I will write an instructable for Felting. It's a great hobby!
Step 2: Insert LED Holders and Attach LEDs
With fabric panel ready, it's time to insert LED holders and attach LEDs.
The plastic LED holders help support the LEDs. They also give a more finished look to the piece.
- Use an awl to poke a hole in the felt where you want the LED to be placed. Be careful to keep the hole small enough so the holder fits snugly. You may need to enlarge the hole a bit.
- Slide the holder into place from the back side, ensuring that it is in the proper position.
- From the back, snap in the LED, and bend the leads flat, with the negative (black) wires at the top, and the positive (red) wires at the bottom. See images - this is a little hard to explain.
When everything is in place, use some hot glue to secure the LEDs and holders. This takes some patience. Wait for each blob of hot glue to set before moving on to the next LED to avoid getting hot glue on your fingers. Ouch!
The number of LEDs you use is up to you. The LilyPad Simple Board has 9 pins. I used about 15 LEDs, so some LEDs were paired with one other LED and pin in parallel. Keep in mind that if you want each LED to fade randomly, only place one LED per pin. I wanted more LEDs, which forced me to double up. The trade-off is that the paired LEDs will fade in and out at the same time. (Watch the video again to see what I mean).
Step 3: Spaghetti Management Part I: Consolidating the Negative Wires (Leads)
While this looks complicated, it gets better when all the wires are neatly organized and soldered into place.
- Starting with the negative (black) wires, gather several together into a neat bundle that will lay flat on the back of the felt, cut them all to the same length, strip about an inch of insulation from each wire and twist them together to make one wire.
- Splice the bundled wire to a single piece of wire, making it easier to solder to the board. Solder the spliced connection. Slide a piece of heat-shrink over the joined area and use a heat gun to shrink it in place (or use electrical tape). Repeat this for the remaining negative wires, if you needed to create two bundles, as I did in my project.
- Solder the negative (black) wires to the LilyPad Simple Board's negative pin, marked with a "-" and add a new ~12" piece of (black) wire to the same pin. This new wire will connect to the negative side of the power source. (See image)
Step 4: Spaghetti Management Part II: Soldering the Positive Wires to the LilyPad Simple Board
Again, this may look complicated, but it is pretty straightforward.
- Estimate where the LilyPad Simple Board will be placed on the back of the fabric, but don't attach it yet. (You will solder everything first, and then hot-glue the board in place).
- Solder a new ~12" piece of hook-up wire to the LilyPad Simple Board's positive pin, marked with a "+". I used red so I could keep track of the positive leads. This new wire will connect to the positive side of the battery holder later on, so it needs to be rather long, depending on where you plan to place it.
- One by one, connect each positive wire from the LEDs to a pin on the LilyPad Simple Board (except the one you just soldered to the "+" pin on the board) and solder in place. Suggestion: As each connection is made, test the LED by connecting to the power source (battery holder and battery) with alligator clips.
This process takes some trial and error. You need to make sure each positive wire is connected to a pin and that the wires are long enough to reach said pin. For my project, I needed to splice additional hook-up wire to the lead wires. If you need to splice wires, be sure to insulate the join with some heat-shrink (or electrical tape). You want to make sure there are no exposed bare wires (except on the pads of the LilyPad Simple Board). This will help to avoid short-circuits.
Depending on the number of LEDs you use in your project, you may need to connect two or three LEDs to a single pin on the board. These "joined" LEDs will twinkle in tandem, so try to choose LEDs that are spaced far apart on the design, if you don't want them to be obvious. In my example, I connected three adjacent LEDs to the same pin, and it's obvious that they are on the same "circuit" when the power is on. I plan to fix that problem in the near future.
Step 5: Install Arduino and Connect the LilyPad Simple Board
If using Arduino and the LilyPad Simple Board is new to you, please read the instructions from SparkFun's LilyPad Simple Board's Set-Up Guide, or from Sew Electric's site to install the software and connect the board. Your board may be different from what's on the tutorials and guides. In any case, it's a good idea to be prepared to troubleshoot (and random-click if necessary). I personally have never met a tutorial that produces the exact results the tutorial suggests. There are many variables. So, I go with the flow and try different combinations of things until things work. Here's a brief outline of how I set up my board, and it may be very different from what you experience, or it may be especially helpful. I hope it is the latter, but won't be surprised if it is the former. :-)
- Get the most recent Arduino version from the download page.
- Install the FTDI Drivers: Visit THIS PAGE and look for the appropriate file for your computer. Install. You may need to restart your computer.
- Attach the FTDI board to your LilyPad Arduino board.
- Attach one end of the USB cable to your FTDI board and the other end to a USB port on your computer.
- Open the Arduino application.
- Click on the Tools menu
- Select the appropriate port for PC: COM_ or Mac: /dev/tty.usbserial...
- Select the appropriate Arduino Board: LilyPad Arduino with ATmega328
- Select the appropriate Programmer: ArduinoISP
- Select the appropriate serial port for PC: COM_ or Mac: /dev/tty.usbserial...
If you have troubles getting things to work, visit the Arduino Troubleshooting page.
Step 6: Preparing the Twinkle Code and Uploading to the LilyPad
I tweaked code that was already created and shared with permission from this Instructable: Rainbow Fish Twinkle Bag, created by Jessica Streck Ortolando, February 2014. This code was edited from THIS CODE by Sparkfun.
My simple edit was to change the speed of the on-off twinkles so they appeared more slowly. My edit was made on these lines, changing the bold 200 to 100 in both places. You can experiment with the numbers until the code is just how you like it.
<em>int offset = 0;<br>int step_size = <strong>200</strong>; //changed to 100<br>unsigned long on_time = 0; <br>unsigned long cycle_start = 0; <br>char dir = 1;</em>
<em>int offset2 = 0; <br>int step_size2 = <strong>200</strong>; //changed to 100<br>unsigned long on_time2 = 0; <br>unsigned long cycle_start2 = 0; <br>char dir2 = 1;</em>
Step 7: "Batten Down the Hatches" and Attach Your Masterpiece to the Canvas Panel
- With hot glue, attach the LilyPad Simple Board and all its wires to the back of your felt or fabric piece. I used hot glue to secure the wires so they would not make the front look too bumpy. Be careful with the hot glue. It HURTS when you touch the hot glue by accident!
- Check the front to be sure everything is smooth and relatively flat.
- Paint an appropriately-sized canvas panel with black Gesso or acrylic paint. I used a 12" x 16" canvas.
- Position your masterpiece on the canvas, and mark the location where you want to place the battery holder to the back of the canvas. With an awl, poke a hole in the canvas and thread the "+" and "-" long wires from the LilyPad Simple Board through the hole to the back of the canvas.
- With a needle and embroidery thread in a color that won't show on the artwork, "sew" your Masterpiece to the canvas: come up through the canvas, through the Masterpiece, and then back down to the back of the canvas and tie a knot. Snip the "tails" to about 1 inch.
- Repeat this process at intervals around the piece to securely attach it to the canvas. Check so that the artwork won't sag or stick out too far. See image.
- Now solder the power wires to your battery holder. Use hot glue to secure the holder to the back of the canvas.
- Insert the battery and admire your Masterpiece!
Please check your circuits throughout the building process so that you are not disappointed if there's a problem with the connections. Before you glue things down permanently, you want to be sure everything works. Don't throw in the towel if something isn't working at this point. Just patiently check your battery, the LEDs and the connections, and try to fix problems as you go along. It's worth the effort to check and re-check.
Step 8: Finishing Touches and Additional Points to Consider
- When you are satisfied with your work, attach the canvas to an open-back frame. Depending on the frame you choose, you may only need to attach little clips to hold the canvas in place. Hot glue might work as well. My canvas fit snugly inside the frame and I didn't need to do anything to secure it in place.
- You might want to attach some sort of hanger hardware to the back of the frame. You will want to be able to reach the back of the canvas to move the switch to On or Off, and to replace the battery, so consider this when hanging your Masterpiece on the wall.
Additional Points to Consider:
- You might want to use two coin cell batteries, to provide more power to your LEDs. I had initially used a battery holder for a AAA battery, but I felt the LEDs were too bright.
- If you want to diffuse the LEDs, you could attach them behind the felt, so they show through the fabric. My felt was too dense to diffuse the LEDs so I didn't go that route. You could also 3D print some LED diffusers or use different types of LEDs.
- The LEDs I used had resistors already installed, so I didn't worry about voltage. Yes, I know about Ohm's Law, but I didn't take a very scientific approach to this. If it worked, I was satisfied. If I were commissioned to do this piece for a gallery setting, I would certainly think about the power needs more carefully.
- Why did I use coated wire and not conductive thread? I love conductive thread in wearables, but I always have issues with short circuits. Since flexibility and comfort were no concern for this project, I opted for the coated hook-up wire. Next time I will use finer-gauge wire, perhaps silicone coated flexible wire to make things a bit easier to maneuver.
I hope you enjoyed this Instructable. I'd love to see what you create!