Saturday, 13 January 2018

3-dimensional Star Cluster using an Arduino

This instructable will guide you through the process of making your very own star-cluster from LEDs and acrylic.

I made this piece for my electronics final project at college and had access to a machine shop. This instructable assumes that you have access to similar tools.

This project was very much inspired by https://www.instructables.com/id/working-progress-n-how-to-make-a-multilayered-a/#step8. 

Step 1: The Materials





















Materials:
• 80 LEDs (Amber, 3000 mcd)
• 80 68 ohm resistors (or other small resistance of your choice)
• 80 1k ohm resistors
• 10 4051 multiplexers
• 20 7404 not-gates
• 30 16-pin sockets
• perforated pc board
• lots and lots and lots of wire
• arduino uno
• 5v power source
• 3 layers of acrylic board, 20” by 20”
• 1 layer of plywood, 20” by 20”
• 4 feet of ¾-inch diameter acrylic rod
• 1 foot of ¼-inch diameter acrylic rod

Tools:
• soldering iron
• solder
• wire-cutters
• wire-strippers
• lathe
• drill press
• band saw
• 1-meter telescope (optional)

Step 2: The Design

Before gathering your materials, I recommend getting a 1-meter telescope and observing a star field for about 30 hours in the i,r and g bands. After a laborious data-reduction and correction process, create a false-color image.

Alternatively, you could just go to the Hubble image database and pick your favorite image of a star cluster to download.

Once you have a suitable image, open it in photoshop or a similar image editing software and scale your image to the physical size you would like your sculpture to be. Create a transparent layer and place markers over every star that will go in the first layer. I chose to put 8 stars in the top layer, 16 in the middle, and 56 stars in the background layer, to convey the ratios of bright to dim stars in the cluster. Once you've created your first layer, add another transparent layer. Place dots on the all the stars that will be in this layer, and then place larger circles on top of the stars that will be in the first layer. This is extremely important, because the LEDs for the first layer must be pulled through the second and third layers. When you go to cut the layers, the circles should be sightly larger than the LEDs, so that it is easy to thread the LEDs and their wires through. Repeat this process for the third layer, making sure that all the stars in the first and second layers have been marked on the third.

Step 3: The Acrylic

Once the layouts for the three layers are complete and have been printed to scale, it's time to cut the acrylic. I had access to a single very large sheet, and I cut that into my three layers using a bandsaw. The acrylic comes covered in a plastic coating, and you should leave this on until you're ready to put the whole thing together, to prevent scratching.

When the three layers are cut to the proper size, it's time to drill the holes for the LEDs. You should measure the diameter of the LEDs with calipers and use the closest possible drill bit to ensure the LEDs will fit snuggly into the plastic. I used a 0.1905" diameter drill bit for the LED holes, and a quarter-inch bit for the pull-through holes. I used a drill press to do the drilling.

Tape the printed layout for the first layer to the acrylic, making sure it's flat on the surface and lines up well with the edges. I brushed mineral oil on the bit to keep it cool as I went, since it will start to melt the plastic as it heats up. When the first layer is done, take care to check that the second layer's pattern lines up well with the holes you've already drilled for the first layer.

When all three layers are done, stack them together and make sure that the holes line up well.

The next step is cutting the acrylic rods that will support the layers. I used 3/4" diameter rod, and cut it into four inch lengths. I did the initial cut with the bandsaw, and then used the lathe to cut them to the exact same size. The 3/4" rod sits between each layer, holding them up. But to hold it all together, I used 1/4" plastic rod as screws. You could use conventional screws, or any number of other methods to hold the layers together, but I wanted the entire thing to clear.

I replaced the lathe's cutting tool with the 1/4" drill bit, and drilled about a quarter-inch into each end of each 3/4" rod segment. If you've been used an angled drill bit, as I had, replace it with a flat-headed one, so that the 1/4" rod will fit nicely into place.

Returning for a moment to the acrylic sheets, keep them stacked together tightly and mark out where the support rods will go in each corner. Use the 1/4" drill bit and the mill press to drill a hole in each corner. I recommend doing this for all three at once to ensure that these holes are aligned perfectly, otherwise you may not be able to put the piece together.

Measure the depth of the holes you've made in the 3/4" rod, as well as the thickness of the acrylic sheet. Cut the smaller rod so that it's a little shorter than the hole depth x2 + sheet thickness. Finish these on the lathe and add a small rounded edge to each end, so that it will be easier to fit them all together.

Now it's time to put it together. Peel back the corners of each layer of plastic, so that the rod holes are exposed, but leave the rest on. You may want to start wearing gloves at this point, to protect your piece from smudging.

Fit the 1/4" rod into one edge of the first four 3/4" rods. Put these rods underneath the bottom layer, and fit the layer through the 1/4" segments. Then stack the next four 3/4" rods and gently hammer them in. Be careful here, because you could shatter the acrylic. Stack on the second layer, and repeat. When I had all three layers stacked together, I added small caps to the front panel, to keep them together.

If you've drilled carefully, the structure shouldn't need anything else to hold it together. If it feels loose, you may want to glue it together as well.

Step 4: The Circuit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Now that the acrylic structure is ready, we need to make the circuitry to support the LEDs. To do this, it would probably help to understand how the circuit will work. The goal is to have the LEDs twinkle, by turning them off very briefly, one at a time. But since the arduino doesn't have 80 outputs, we'll have to do something clever.

The clever solution is a demultiplexer, which takes a three-bit binary input and sends a signal to one of eight outputs. The arduino playground is a helpful resource for understanding multiplexers.
http://www.arduino.cc/playground/Learning/4051

When I was first looking into this project and investigating multiplexers, the majority of the examples used the multiplexers to turn one LED on at a time. Unfortunately, it's not quite as simple as flipping the LEDs around. Instead, we'll send the multiplexer output through a NOT gate, flipping the signal and causing one LED to turn off at a time, while the other seven stay bright.

The arduino will send signal to four inputs on the multiplexer: pins 9,10 and 11, which are the binary input, and pin 3, which in the common input/output. X0 through X7 are the outputs. Each multiplexer output goes to an individual 7404 input. Each 7404 input must also be connected to ground, because the inputs float high. A 1k ohm resistor connect each input to ground. The 7404 outputs will each go to a 68 ohm resistor, which in turn connects to the anode (positive leg) of the LED. The negative leg of each LED will connect to ground. This set up will allow eight LEDs to twinkle. Each set of eight requires

For the actual soldering, I find it easier to begin at the end, with the LEDs. You'll want a very large around of insulated, stranded wire, in two distinct colors. Cut eight lengths of each, long enough to reach from the center of the back panel (sitting four inches behind the third layer) to any corner of the first layer. Wires for the second and third layers can be shorter, but always give yourself a few inches of extra wire, as it will make your life much, much easier later one. Choose one color of wire to be the ground, and solder one side to the cathode of the LED. Make sure that you are in fact soldering to the cathode every time! It is the flat side of the LED, with the shorter leg. Solder the other wire to the anode, and twist the two wires around each other to form a single strand. Solder the ground wires in a row at the very edge of your perforated circuit board. Solder the anode wires to the board, two to three holes below the ground wires, with a single LED per column. Connect all the grounds together.

Below the positive end of the wire, add a 68 ohm resistor to each column. Connect one end of the resistor to the positive end of the wire. Add three 16-pin sockets below the resistors in a single column. The top two sockets will hold the NOT gates, the bottom socket will hold the 4051.

For connections between resistors, not gates and multiplexer, I used pre-cut jumper wires rather than stranded wire. The jumper wire is more brittle, but is already cut into convenient lengths. Solder a jumper wire to the open end of each resistor. These wires should be long enough to reach to any output on the top two sockets.

Here is where you'll want to keep a very close eye on the circuit diagram for the 7404. For one thing, the 7404 is a 14 pin chip, and the sockets have sixteen pins. I decided that I would put the 7404s at the bottom of the socket, leaving the top row empty. Connect all the 7404 outputs to the 68 ohm resistors. The outputs are pins 2,4,6,8,10, and 12. Since there are eight LEDs and six outputs for each 7404, use two outputs from the second 7404. Ground pin 7, and connect pin 14 to 5v.

Now connect a 1k ohm resistor to each 7404 input that is going to used. Connect the other side of each resistor to ground. Leave space for the wire that will connect the 7404 input to the multiplexer output (pins 1,2,4,5,12,13,14, and 15 on the multiplexer). Connect pin 16 of the multiplexer to 5v, and pins 6,7, and 8 to ground. Pins 3,9,10, and 11 will be connected to the arduino.

You should use an independent power source for the LEDs. The one I used produced 5v (in actually, about 5.2v) and could source up to 2.5 Amps of current, which is very important.

Repeat this process for however many sets of eight LEDs you would like to twinkle in your final display.

Step 5: The Backing

Once all the LEDs have been wired up, you'll want to wire each set of eight together. I wired all of the common/input outputs together, and all the A inputs, B inputs and C inputs were wired together as well. I made a small shield for the arduino, so that the connections could secured. Unfortunately, the 80 LEDs draw much more current than the Arduino can source. I put a transistor in between the arduino and the four inputs, with 5v at the collector, the arduino at the base, and a 1k resistor going to ground at the emitter, to create an emitter-follower circuit. Make sure to connect both the power source ground and the arduino ground to the emitter, because the arduino needs to know about the power source ground for the circuit to work.

Once you've made the circuitry for all of your LEDs, you'll want some way to mount them all behind the acrylic structure. I choose to make all of the wiring visible behind the acrylic. To this end, I cut a piece of plywood to the same size as the acrylic layers, and drilled the four holes for the support rods in the corners. I used standoffs to keep each board slightly elevated from the plywood. The standoffs were screwed onto the board from the back, and the circuits screwed onto standoffs.

Step 6: The Arduino

Here is the code that I used to make the LEDs twinkle. It's fairly basic, just a binary count that sends the proper high/low signal to the multiplexers. Tweak the two delay times to adjust the twinkling to your preference.

int pinA1 = 8;
int pinA2 = 9;
int pinA3 = 10;

void setup() {              

  for(int i = 1; i <= 10; i++) {
    pinMode(i, OUTPUT);
    digitalWrite(i, LOW);
  }

  digitalWrite(2, LOW);  // Ground
  digitalWrite(3, HIGH); // Power
  digitalWrite(4, HIGH); // Mux input to send to the leds
}

void ledOn(int nr)
{
  int r0 = nr & 0x01;
  int r1 = (nr >> 1) & 0x01;
  int r2 = (nr >> 2) & 0x01;

  digitalWrite(pinA1, r0);
  digitalWrite(pinA2, r1);
  digitalWrite(pinA3, r2);
}

void loop() {
  for (int j = 0; j < 8; j++) {
    ledOn(j);
    delay(10);
  }
  for (int j = 7; j >= 0; j--) {
    ledOn(j);
    delay(50);
  }
}

Step 7: The Final Product

 
 
 
 
 
 
 
 
 
 
 
 
 
Now it's time to put it all together! Again, I very strongly recommend using gloves while doing this, to prevent leaving smudges on the acrylic.

I put the backing on with the same 1/4" acrylic rod that holds the rest of the structure together. Once the backing is in place, all that's left is the mildly arduous process of putting each LED into place. You may want to glue the LEDs down, I found that it wasn't necessary.

And then all that's left is plugging it in and turning it on.


Congratulations, you now have your very own at home star cluster.

No comments:

Post a Comment