Introduction: IKEA Star With ATtiny and NeoPixels
I've been playing with NeoPixels for a few years. In December 2015, I found from 1-meter wide 7-point star lanterns at IKEA. They came with a white lightbulb, but I wondered what the light from the cutouts would look like if I put some pixels in the arms. I bought a few of the lamps, and started working on more animations, but I didn't get around to putting pixels in the lamp until this Fall. Now, the challenge was to fit it all into an ATtiny85, and just use a USB cable for power!
NOTE 1: These stars are a "seasonal products" at IKEA. The stores get a set amount shipped out in SEP or OCT, and when they're sold out, you'll have to wait until next year. Each year they will have different sizes and patterns (different patterns each year!), so consider buying a few extras if you like the pattern.
The patterns on the stars change every year!YOU CAN DO THIS! Even if you are a new Arduino hacker. My goal for this instructable is to make it easy for newcomers, and to include some interesting stuff for those with more experience! Read on, McDuff, there are adventures for us ahead!
To get started, you'll need a way to program the Arduino or ATtiny. I used the http://Arduino.cc IDE, version 1.6.11.
You'll also need a NeoPixel Library. I've found Adafruit to have the best, please but some of your stuff from them, since that's what keeps them happily hacking (https://learn.adafruit.com/adafruit-neopixel-uberg..., and that makes projects easier for the rest of us! :-)
Finally, if you are considering using the ATtiny85, I'd suggest the Sparkfun USBtiny programmer ( https://www.sparkfun.com/products/11801) to make it easy, but you can also find many other tutorials online about how to use another Arduino to program an ATTiny. You will also need a good AVR Core (board file) which includes the ATtiny settings information. The one that impressed me the most was from Spence Konde, and you can find the file here (https://github.com/SpenceKonde/ATTinyCore), but also read the installation file for extra clues. A good bare-bones board file for the ATTiny85 comes from https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json. Finally, whenever you set or change your ATtiny board settings for 16 MHz (internal) clock speed or other processor features, remember to click on "Burn Bootloader" at the bottom of the Arduino IDE Tools menu, before you upload your sketch code.
Please, read all the way through this instructable BEFORE you start cutting up wires or pixel strips! While I'm trying to make this easy, there is a lot to do, and a lot to think about. I hope you will learn something while doing this project, no matter what your level of Arduino experience. :-)
You'll need an Arduino of some size, some WS-2811 or 2812-type NeoPixel strip, and some #24-gauge hookup wire.
- You will want 14 NeoPixels per IKEA Star. I prefer using the small circuit-board pixels now, but I started the project using the 60 pixels-per-meter strips, and snipping the pixels between the copper pads. I use the white background style, without adhesive backing.
- I recommend #24 gauge stranded hookup wire, and I suggest you get red, black, and a third color, to help you keep these lines straight as you are soldering.
- My go-to Arduino is the Pro Mini, or the Adafruit Feather, but this project is actually built small enough to fit into an ATtiny85!
- You will find it easier to solder the wires to pixels if you have a small vise, or a "third-hand" tool.
- And you'll need a soldering iron and solder.
Step 1: There Are Big and Small Stars, Choose Wisely!
The large IKEA stars are 1 meter round (about 40 inches), and quite deep. You may want this to hang near a wall, or from the ceiling, but it's very big if you want to be able to put it in a window and still close the drapes.
The smaller IKEA star is about 3/4-meter, but it makes a better window decoration.
The cutouts on the surface are also something to consider. These will be how the light is released to splash on your walls and ceilings. You may find plenty of stock in the store, but you should also check online for the Strala lamps, to see if there is a color or pattern that you like better.
In the image with three folded stars, notice that the darker two have holes (squares, really) cut all the way through. But the lighter of the three has tissue paper in the scallops along the edges of the arm, which will block the light from getting out, but it will also glow brilliantly.
As you can see above, I put two pixels in each arm of the star. One pixel should mount above the centerline, so that it faces down and "left", and the other pixel should mounted below the centerline, facing up a bit and "right", respectively. This way, you can light the ceiling with one color, and wash the walls with another. There is a marked-up picture showing what I mean about alternating the pixels (one higher than the mid-line, and one lower than the mid-line.)
The pixels work best about 1/3 to 1/2-way down the star arm. It's hard to place them in the smallest/farthest ends of the arms. When I tried to put them at the far end, the pixels were very close to the opposite side of the arm, and caused a bright color spot on the opposite side of the arm. By putting them closer to the middle, you get a better color wash, and better dispersion through the cutouts.
Leave some slack on the short wires, so that you can fold the star up later. If your short wires are too short, they may damage the NeoPixel tape after just a few foldings.
On the whiteboard, you can see the lengths of wire that I used to go from arm to arm (long), and across the arm (short). These lengths will be different for the large and the small stars, of course. I found it was easier to solder all the short wires first, and then solder them to the longer wires. I'll write more about this later.
I've included a simple drawing showing just 8 pixels, and how the long and short wires are arranged. It may help if you draw what you're going to connect, including all the pixels, and arrows for the data flow. Drawing it may help you understand how it all will go together.
Since each 7-point star only needs 14 pixels, you might consider adding more stars from the same pixel! I've included a schematic to help do that, because you need 3 wired (power, ground, and data), but when you drop to each star, you also need the data-out of star #1 to go up and across to the Data-In on star #2 and etc., so you need a 4-wire cable to drop to each star.
Step 2: Preparing Your Materials Will Take Some Time, But Will Save You Frustration Later
Measure Twice, Cut Once. Look at the patterns cut into the arms of your star, and decide where you want your pixels to be mounted. Then measure the "long" wires from that point to the center of the star where they can make a U-turn and go down the next arm. Write this down! You will need SIX pieces of THREE different colors.
NOTE:You should consider making just a 2-pixel strand, and run the sketch code as-is (with 14 pixels in the code) on a handy Arduino, and see where the pixels look the best in just one arm of your star. Once you know that placement, you can take the measurements for the longer wires.
Life is better in Color. It's important to put power on the right pins, ground on the right pins, and data on the right pins. It will be MUCH more likely to keep them straight if you use three different colors. You have more than 100 connections to make in this project, so you might want to invest in getting three wire colors, rather than spend more time debugging later. (I prefer black for ground, red for the 5 volt power, and white for the data. But, as long as you can keep the meaning straight, you can use any colors you like. After all, the color of the insulation doesn't affect how the current flows.)
Try to keep things Cool. Your NeoPixels are going to be cut into individual pixels. That little bit of strip cannot get rid of much heat from soldering, so I use a small vice, and I only QUICKLY tin the three pads on one side of each chip, and set them aside to cool, before I go back and tin the other three pads. ("Tinning" is using a quick bit of heat to apply a small ball of solder to the pad. Later, when we come to solder the wire to each pad, we only need a quick touch of the soldering iron to re-melt the ball to attach the wire.) This process will reduce the chance that too much heat may hurt the strip or the pixel. You usually cannot see the heat damage, but it can result in a non-working pixel in the chain later! I tinned enough pixels for three lamps this day. You can read more special clues about NeoPixels in this UberGuide from Adafruit. https://learn.adafruit.com/adafruit-neopixel-uberguide
You should also tin the wires. I use 22 or 20-gauge wire. It can take a bit of heat to get the wire to accept the solder. That heat duration could harm a pixel, if you were trying to apply the wire and solder all at once. Instead, I used the vice to hold the soldering iron at an angle, and then I could hold the wire in one hand, and the solder in the other. Tin both ends of the wires, since you'll be attaching each end to pixels!
Use a socket for the ATtiny85. If you are going to use the ATtiny85, you'll probably want to re-program the chip sometime in the future, and a socket will make that easy to do. You should have the capacitors and the resistors as well. You don't NEED to have the pushbutton, but you might want to have the pushbutton later.
If you are going to make a few of these, consider using this circuit board by AVR Freak Bill Westfield (https://oshpark.com/shared_projects/RuxVnII3). They are $4.25 each in multiples of 3, and will result in a cleaner installation.
If you DO want to use the pushbutton, I suggest that you use a 4"-6" pair of wires between the switch and the board, so that you can get to the switch outside the star (since the ATtiny board will be *inside* the star).
I've modified some versions of the code for a family member who has epilepsy. When the star starts, it defaults to repeating the rainbow-wheel pattern, varying the speed and number of cycles. If you push the button once, it goes into the rainbow-cycle pattern (again, choosing random speed and random number of loops). When you press the button again, it goes into the full-random pattern, which includes some fast blinking and flashes. Press the button agin (or turn the power off and on) and you're back to the rainbow-wheel.
Step 3: Wiring Your Pixels Together, First Things First...
Now that you have a pile of pre-tinned pixel and wires, it's time to put them together! You may want to use a small vise, or som "third-hand" type of device. I'm using the Panavise model 201, which has V-notches on the jaws that are great for holding small boards and for NeoPixels.
Start with the short leads first. Start by soldering three leads to a pixel (using different colors, if you have different colors). At this point, it doesn't matter if you choose the input or the output side of the pixel. Pre-tin the tip of your iron, hold the wire on top of the ball of solder on the pad of the pixel, and then touch the iron to the wire. (What you want is for the hot solder on the tip of the iron to heat the wire and soften the solder on the wire, which then will melt the solder on the pad. When this happens (quickly), you will feel the soldering iron "drop down" just a bit, and that's how you know all the solder is molten, and you can keep holding the wire, but remove the soldering iron. Remember, the small surface of the tape cannot dissipate much heat, so only try to solder to the pixels for very brief times, and then let it cool.
Once you have the three leads on one pixel, solder another pixel to the other end. Pay attention to the data direction, look at the arrows on the two pixels! They arrows should be facing the same direction, and this will let the wires lay flat, side by side. Quickly solder the leads to the pixel, as described above, to minimize the amount of heat you put onto the tape. (You will quickly get the hang of this, and you'll get better and faster each time.)
Solder the rest of the short wires as pixel pairs (a pixel, the wires, and a pixel), and set them aside to cool. Finish all of the short wires this way. Once these pixel pairs are done, you can bend the wires gently, while holding the tap of the pixels, so they look like the photo above. These are the pixels which will be installed in the arms of the stars, and the short wires need to make a U-turn.
Prepare your long wires, and use them to join the pixel pairs. Start by bending the long leads in half, and straighten them, so the wires lay flat. Start by picking one of the pixel pairs, and solder the wires to the Data Output ("DO") side pre-tinned pads. I suggest using a vise or "third hand" to hold the pixel facing upward, and then hold the wire so that the bend is dropping downward. (Look at the second picture) to keep the angle correct. If you can keep this straight, it will be much easier to install the pixels in the arm of the star, and it will not put stress on the soldered connections. Next, solder the long wire ends to the next pixel pair, making sure to solder to the Data Input ("DI") pre-tinned pads on the next pixel pair. (Always make sure that your arrows in the chain are facing the same direction, all the way along the wires.If you get one pixel backward, that's where the light will stop, and you may damage a part or two.
As the string grows, it can be a bit difficult to hold by hand... did I mention how handy I have found a vise to be for these projects. ;-) Keep using the rest of the long wires to join your pixel pairs. It should start to look like the picture above.
Always test for Magic Smoke (https://www.adafruit.com/products/565) before you install your pixels! Test the finished string with alligator clips to an Arduino running a suitable NeoPixel sketch, before you try to install it! This will find any pixels which were installed the wrong way, or perhaps the pixel went bad due to too much heat during your assembly.
Better put the code into a board. It doesn't need to be on a Tiny just yet. It might be easier to connect if you just use an UNO, or normal Arduino. Just check in the code for the pin numbers near the top (but under all the comments and notes). Having this sketch in a board, ready to go, is a good tool to keep around for testing and tinkering with neopixels.
For easy development of my animations, I use a 16-pixel ring from Adafruit, and the Sparkfun USBtiny with an ATtiny85. It packs up nicely into a small plastic food tub, which lives in my backpack, so I'm ready to hack if I get some spare time. (I'm looking forward to hacking while in a self-driving car during my commute to work someday! ;-)
Step 4: About the Sketch... I Use Comments a LOT!
First, let's go over the basics, to make sure that the newcomers to Arduino have some basic clues. Those of you with some experience can skip ahead to the Good News.
- Sketch: this is the common name for a program file to be uploaded to an Arduino. Common sketches will have three sections (definition of global variables, the "setup" function, and main "loop" function). The setup runs one time, immediately after defining any variables, and then loop runs over and over again. You can add other functions outside of "loop", and then have your main loop call out to the functions. In my sketch, I pick colors by calling a random function, and then I send information to the color animation functions. When a function completes, the "loop" continues from where it was. You can read more about this at https://www.arduino.cc/en/Reference/HomePage
(2020-11-15: I added version 4 ofthe code, with Entropy (for better random numbers) and more colors)
- Arduino: can mean a few things, but the most common is a reference to a family of CPU chips, and the boards/modules they are mounted upon.
- CPU Family: The original Arduino UNO board was based around a particular "System on a Chip" (SoC) device. These SoC devices are much more than the dictionary definition of a Central Processing Unit (CPU), but in the hobbyist's perspective, the "CPU" is usually the chip on the board with the most number of legs, and with all the brains. ATMEL makes a large number of SoC chips, some with more memory and inputs for big projects, and some with less memory and fewer inputs/outputs for smaller tasks. This is referred to as the ATMEL family because the chips share the same set of machine-level instruction code. (Thanks to the IDE, you probably won't need to know what "machine language" and "instruction sets" are all about... but now you have a few terms to look up if you want to dive deeper. :-) With the popularity of the Arduino project, there are now many boards, some with the larger ATMEL chips (ATmega...), and some with the smaller chips (ATtiny), but there are other boards which use SoC devices from other chip makers. One example is the Teensy family from PJRC, http://www.pjrc.com/teensy/index.html, which use SoC devices from Freescale. Because Paul Stoffregen has worked to add the "Board Info" for these processors into the Arduino format, they are now part of the Arduino CPU family that can be programmed with the Arduino IDE.
- IDE: is an Integrated Development Environment, which is a software program that lets you edit your sketches, and knows about many different Arduino boards and many different Software Libraries, all in one computer application. The IDE from http://www.arduino.cc/en/Main/Software (for the English version of the page, your language may vary...) is what most hobbyists use, but ATMEL and other chip makers also have their own specialty IDE programs.
- Software Libraries: A typical "library" for your Arduino IDE is a small collection of files, containing some complicated code to do very specific things. In the case of my NeoPixel sketch, someone with expertise has written the software to "detect the CPU clock speed, and send the bits out a particular pin, in a very specific timing format", and to pick specific offsets around a "360-degree color wheel" based upon the number of pixels on the string. Because the experts write this code, YOU don't need to figure out how to do it. You just need to learn some "KEYWORDS" that are used in the library, and then you simply put those keywords in your sketch. Your Arduino IDE comes with basic libraries, and you can add others as you delve into other aspects for your sketches. You can learn more at https://www.arduino.cc/en/Tutorial/HomePage. When you want to add a library, you can do it through the IDE, or you can download the folder from the web, and place the folder in your libraries folder (usually in the same folder where your sketches will live). For example, the Adafruit_NeoPixel library lives here https://github.com/adafruit/Adafruit_NeoPixel.
- Compiling: is the magic part (for those of us new to these CPU families). When we use the Arduino IDE, we are programming in C++, but the CPU on our board speaks in CPU-family specific machine-level code. Compiling means "reading the C++ code, and creating the machine-level `instruction set' that the CPU will understand". I'm very thankful that the IDE will do this for us, since I'd need to learn new instruction sets just to use other CPUs.
- Uploading your sketch: is done by clicking the Upload icon, which looks like the "Play" button (a round button, with an arrow pointing to the right). When you do that, the IDE will look at your sketch, determine which portions of which libraries you used, and which board you are using. It will then compile your sketch, pulling code from any libraries you specified (but only using the portions of the library that you call in your sketch). It will then try to load the code to your board. (If you haven't picked the right board, it will fail and give you an error message. Check your board type and your port! This will usually prevent you from sending the wrong machine-level code to a CPU.) Once the upload is successful, your Arduino restarts, and should be running your new sketch!
- I've also posted the Sketch on GitHub:GitHub is a great place to put up your code for others to share. It's also a place where others might make some additions to your code, and share their changes and additions back to you (and you can decide whether to include them or not). You can find this project at https://github.com/ZonkerHarris/IkeaStar and you should eventually find information about my RGB Color Tuner and my new RGBW Color Tuner 2 projects there as well.
The Good News is that Comments do NOT count towards your memory allocation!
When you click on the Upload button, the IDE will simply ignore all the comments, and just set about converting (compiling) all of the commands, and setting up your variables. Because of this, I write stories to myself as comment, to help me remember what a portion of code is going to do, or what it expects. I suggest that you don't delete the comments, because they may help YOU understand why I wrote the functions the way I did.
Working with NeoPixels was a bit tricky for me. I actually started with the Macetech Shiftbrite LEDs, which use SPI, to finally understand programming these shift-register-based LEDs. Shiftbrites have 10-bits per color, plus two control bits, versus the 8-bits per color in NeoPixels, but the shifting aspect is the same. Since it was hard for me to learn, I decided that it shouldn't be so hard for others, so I wrote many clues for those who would follow after me.
I've been hacking with NeoPixels for a number of projects, and adding to my NeoPixel Clues comments. The sketch doesn't use all of the animations referenced in the clues, but I left them there, so that it might inspire creative thoughts for some of the readers. I have more animation sequences, but I had to leave them out due to the smaller memory space in the ATtiny85. Putting the sketch into an UNO would give you plenty of space to use a 5-meter NeoPixel strip and more than double the number of animations.
I built a NeoPixel Color Tuner to help me add/adjust the colors in my array, but that will be covered in another project.
I added a Mode switch, but you don't need to add that if you don't want. (You can just pick a single sequence, or pick the "random-all sequence, and it will do what you want as soon as you power it up.) As it is now, it will start in a Rainbow Wheel, pushing mode switches to all pixels the same color and that color will rotate through the rainbow color wheel. Pressing mode again gives you Random-All. Pressing mode again will bring you back to the rainbow wheel. (Of course, you can change that behavior, too. :-) You could try adding an IR receiver, to remotely pick a pattern, so that you don't have to push a switch.
The "random" function in the ATMEL chips isn't very random. Adding an "antenna wire" to an analog input can sometimes improve that. I'm also playing with using a photo cell, or a potentiometer on the analog input, to change up the sequences a bit more. (2020-11-15: I added the Entropy library, to get better random numbers! Download the library to add it to your sketch! https://github.com/pmjdebruijn/Arduino-Entropy-Library )
This sketch should be a starting place! Get this working, and then change it a little, to understand how timing can affect the sequences. For longer strips, I found that I should reduce the ipDelay and icDelay values. Hack a little and learn a lot! Then you'll start looking at all sorts of things, and thinking "I wonder what that would look like with some NeoPixels in it." :-)
Step 5: If You're Going to Use an ATtiny With NeoPixels, Read This Step.
If you are using pretty much any other Arduino board, you can skip this part.
BUT, If you are going to get the ATtiny to light your NeoPixels, there are a few critical steps. And I wrote this instructable, just so I could add a project which POINTS OUT THE IMPORTANT STEPS IN BIG, BOLD FONT! At the risk of repeating myself, I want this step to include the important bits!
Just a little more info about NeoPixels, for those who want to know how these things work. Because there is but one data lead (besides the two power leads), all of the "clocking" information for the shift registers needs to be sent with the data! As a result, the timing of the rise and fall of the data signal is what indicates if the data is a zero or a one, or if it is time to latch the bits in the registers to the LED elements. As a result, the code for "sending the bits" to the output pin, has many sections, and the IDE decides which section to use at compile time, based on the CPU speed on your board. you can find out more from Adafruit's NeoPixel Uber Guide ( https://learn.adafruit.com/adafruit-neopixel-uberguide/overview), and by reading the WS-2812 datasheet (https://www.adafruit.com/datasheets/WS2812.pdf).
** IF YOUR CLOCK SPEED ISN'T 8 MHz (or faster), the pixel library can't send the bits out properly!
The ATtiny board isn't included in many of the main AVR Core files. When it is included, you can usually only pick 8 MHz Internal clock speed.
You need to find an AVR board file with good clock and options for the ATtiny family. After I tried many, I found this one to be the best, in terms of options and the number of Tiny chips supported. https://github.com/SpenceKonde/ATTinyCore
By default, an ATtiny is running at only 1 MHz. You can upload your code, but the pixels won't light! Unless you have an oscilloscope, it's hard to see what these timing pulses look like. I used an o'scope at TechShop to test my theory, and I saw that the data pulses from the tiny were much longer than those from an Arduino Pro Mini at 8 MHz, even AFTER I had selected the ATtiny85 board type, and selected the 8 MHz (Internal) clock speed, and the 16 MHz (PLL Internal) clock speed. The IDE saw the options change,and it said it was re-compiling. But the chip never changed! I spent nearly two weeks trying to track this down... Here is what you need to know!
** When you change the clock speed (or ANY of the chip options, like Brown-Out detection), FIRST YOU NEED TO CLICK ON "BURN BOOTLOADER" at the bottom of the Tools menu!
You *only* need to Burn Bootloader when you change an option. It takes a brief instant, while the IDE "burns the Fuse Bits" which set those features in the chip, so it will always boot to that speed, and with those options set.
After that, you can go back to clicking the upload button, and making changes to your sketches.
Finally, consider daisy-chaining a few stars from the same Arduino. You cannot do too many in an ATtiny, because they don't have a lot of RAM, and you need to have an array for holding the colors for each pixel. As you add more pixels, you need more RAM. (And, RGB pixels need 3 bytes per pixel, and if you use the RGBW (pixels with a Whitre element too) you need 4 bytes per pixel!)
(Full disclosure: Using most basic boards, we never have to think about this. We see options for using a Pro Mini 8 MHz or Pro Mini 16 MHz in the board manager. We don't have to set Fuse Bits, we just click upload and it all works because of settings in the Board Manager and in Libraries. I *did* see this clue in a Hackster project by Alex Glow, but the USB Driver for my USBtiny board wasn't working... so, I tried clicking Burn Bootloader a few times, and nothing happened, so I gave up on that. Once the USB drivers were working, and I could upload, I didn't think about the bootloader again, since I'd already set the clock speed in the IDE. :-( The experts among us probably think that most folks know about this, and so they don't ask "Did you try Burning the Bootloader? You did, right?". Once I re-learned finally saw it mentioned in bold font in another project, and I tried it, and my pixels LIT! While writing up my clues, and looking back at many of the projects I'd tried to follow, only a few mentioned to Burn the Bootloader, and that's when I decided I would write up this project.)
Step 6: Some Thoughts About Pixel Placement
Painting with light and colors is interesting to me. Here are some things to consider specifically for lighting the IKEA Star lanterns.
Test first, before you stick anything down. Seriously! You make want to make this exactly by the instructions, but you should just hold a couple pixels in place first, light the string, and see what looks good TO YOU, before you decide to stick the pixels down.
**REPEATING: You should consider making just a 2-pixel strand, and run the sketch code as-is (with 14 pixels in the code), and see where the pixels look the best in just one arm of the star. Once you know that placement, you can take the measurements for the longer wires.
Leave room for the light to disperse. When you have the pixels too close to the other side of the star, you may see "hot spots" on the other side of the arm of the star. Placing the pixels closer to the center of the arm of the star will probably look better. In the first image above (grey star, blue LEDs, and my finger pointing...) you can see how far down the arm I put the pixels, and my finger is pointing to where I think I should have put them. I am guilty of not testing before sticking pixels down. :-(
Check for the thickness of the material. The important factor is "how much light will show through the material", as well as what light will be cast through the holes. A couple models of the IKEA Star lantern had thinner material than others and you can see shadows from the wires when you see it in the dark. If you have thinner material, you may want to use a bit of hot glue to tack your wires along the spine of the arm of the star.
In the image with the green star, you can see how translucent this material is. (This is the grey star...) You can also see the shadows from the wires. I did not give myself enough slack to push the wires into the edge of the arms. This star was made using #20 gauge stranded wires, and you would be fine using #22, and could get away using #24.
The last image is about how much light can come from these pixels. The bright strip at the bottom is attached to my Color Tuner project, and the pixels are facing the camera. There are two IKEA Stars (smaller on the left, bigger on the right. The smallest star has a single pixel inder the center, facing the wall. The brightness of the pixels is why I suggest putting the pixels a bit farther from the holes, to help minimize how often you might be staring directly at a bright LED.
Step 7: Suggestions for Hanging Your Lamp.
The IKEA Star lamps were designed for use with a 110 VAC light bulb, and their lighting kit come with two metal (thick steel rod) parts which will hold the two ends of the star together. One part is smaller (for hanging it by the wire), and the other part is a large diamond (for using it at the top of a pole) for desk or floor mounting. But, these parts are hard to use if you don't have the lamp or pole parts as well.
For hanging it as a lamp, I've used long USB cables, and I took a design idea from the mountaineering "8-brake" device. Take a look at the blue plastic parts next to the ruler for this discussion. (This was my first design,) By making oval holes, the cable can be woven through the plastic. The weight of the lamp is no much, but it is enough to hold the cable tightly without making a knot or using glue. The diagonal notches were lined up to help hold the lamp ends together, just by sliding the plastic piece up, and let gravity hold the lamp. These notches didn't work as well as I had hoped.
The blue part was my first prototype, and the stars sometimes didn't expand all the way, and this made it harder to hold the ends together. As a result, one side of the star would often jump off. The notches needed to be longer. But, as I looked at the metal parts, I saw that they had a knobby end, which fit into a 1/4" hole on the spine of each arm. (I had previously used a piece of wire, threaded through those holes, to hold my first star together.) I went back and redesigned the hangers to extend the notches, and add knobs to fit into the holes. The other images show the laser cutter making a set of large and a set of small hanger parts.
The remaining image shows a large star, with the hanger installed, and with a large hanger part nearby, so that you get an idea how the hanger part does the job.
With the USB (or 5-volt power) cable woven into the hanger, you can attach the power cord to the circuit board with the pixels.
* My original star used a 3-wire cable from the star and pixels down to the Arduino nearby. That's also a practical way to do this, so you can hack with the programming more easily.
* You COULD use a 4-wire cable to hang the lamps... and wire one Arduino to MANY stars! This would let you control all the sequences for all the stars with one program! But, you wouldn't be able to do that well in an ATtiny. This is dues to the amount of memory needed to hold the array of color information for the pixels.
Step 8: The Last Words...
These animations can be used with short and long strips, just by adjusting the numLeds variable.
I find that the "wipe"-type animations look slow on really long (~150 pixel, 5-meter) strips. If you are going to use longer strips, consider lowering the icDelay and ipDelay global variables.
Consider changing the speed variables in the main loop section for either/both Rainbow functions. The random function makes a choice within a faster and slower speed (rate of change). Watch it cycle for a while, and decide if it ever seems too fast, or too slow, and adjust the limits accordingly.
If you want to hack on an animation, there is a Debugging section in comments;
sequence = mode; // Use a button to step through the sequences (comment the other two)
//sequence = randomChoice(); // operate fully random (comment the other two) //sequence = 1; // to debug, pick the pattern you are debugging, comment the other two)
You can simply add comments characters ( // ) in front of the first line, and remove the // from the sequence = 1, and then change the 1 to be the number of the animation that you want to see over and over again... then upload and watch, and take notes. Tune the sketch, and upload it again.
If "mode == 1", then the sketch is in "Random-All-Sequences", and most animations will roll the dice to see how many cycles they will repeat the animation (using random colors each time) before moving on to the next animation sequence.
The code for the various animations is found below the random choice sections. I hope you will read and learn, as well as enjoy the sketch. I look forward to seeing some of YOU post your projects someday. I'll try to answer your questions in the comments.
Participated in the
First Time Authors Contest 2016
Participated in the
Arduino Contest 2016
Participated in the
Make it Glow Contest 2016