What is the Tiny Dice?
Simply put, TinyDice is just an electronic, Arduino compatible LED die that looks quite neat.
In reality, this project was my attempt at doing things right; making an SMD circuit, a professional quality PCB, a good PCB design, and an effective code, that allows for a very energy efficient project (when not in use, the whole thing consumes less than 0.1 micro amps, yes, less than 1 ten-millionth of an amp!).
What will you learn here?
You will learn how to make high quality, SMD PCBs, from design to use, which consists in; Designing the board, transferring the design into copper clad, etching the copper clad, adding a soldermask, making a solder paste stencil, home reflow soldering, and programming a standalone board. Additionally, you will learn to use and program MSP430 value line microcontrollers from Texas instruments, these can be programmed like an Arduino, but they are very cheap and come in many shapes and sizes, an ideal tool for the average hacker to be able to use.
What will you obtain?
Appart from an incredible skill set, you will obtain a tiny gadget that displays your skills, plus it is a neat little piece of electronics to have and show around. On top of that, you will have a 6 sided die that will help you make decisions, and even win games )you could modify the code to make it be an unfair dice and use it at your favour).
This Instructable is on the Circuits contest, so if you consider it worth it, please vote for it!
Step 1: Get Yogur Materials
You will need;
- - A piece of Blank PCB
- - A sheet of printable transparent or translucent paper.
- - PCB resist photoemulsion.
- - PCB photoemulsion developer and remover.
- - Ferric chloride etchant
- - Muriatic Acid (Hydrochloric Acid).
- - clear packaging tape.
- - Masking tape.
- - 7 5050 LEDs of any colour
- - 1 2032 coin cell battery.
- - 1 2032 coin cell battery holder.
- - 1 msp430g2452 soic 14 microcontroller
- - 7 0805 50-200 ohm resistors.
- - 1 0805 20k ohm resistor.
- - 1 tactile switch (push button).
- - An MSP430 launchpad.
- - A computer.
- - A printer.
- - A piece of glass.
- - A piece of scrap wood.
- - A piece of aluminium wider than the PCB.
- - 4 big paper clamps.
- - A red safelight.
Step 2: Get Your Design
Download a copy of the TinyDice.pdf sheet and print it out, preferably on a laser printer, on a transparent or translucent sheet of paper.
Make sure you print it with a scale of 1, or 100%, and with the highest possible toner density.
Step 3: Cut Out All the Layers
Once you have the printed design, cut out all the masks and superimpose each with it's copy (put it on top of the other one, make sure they are perfectly aligned by looking through them i front of a light source, and fix them in place with 3 or 4 pieces of double sided sticky tape, you should end up with 3 pieces of 2 layered paper that you will use in this instructable.
Step 4: Get the Aluminium Sheet
- Get an aluminium soda can and drink it.
- rinse it with water on the inside and on the outside.
- Carefully cut the top and bottom with some scissors, don't worry, they wont get dull.
- cut along the cylinder and extend it flat, you wight have to bend it inwards to counter the shape and leave it flat, but don't worry if it wrinkles a little, just try to get it as flat and even as possible.
- round off the corners with the scissors to prevent cutting yourself.
- using a 320 grit or similar sandpaper, sand the inside of the can (the silver side) to remove the clear protective coating, if you don't do this, you won't be able to etch it.
Step 5: Apply the Emulsion
This step needs to be done at night and in a dark place!
It doesn't have to be completely dark, any room at night with a towel on the window will do.
- Block as much light as possible in the room.
- turn off all lights and only work with a safe light on (a red light), if you don't have one, you can just download an all-red image from google, display it on your smartphone or tablet, and turn it to full brightness.
- lay a piece of paper in a flat surface and tape all the edges to the surface.
- tape your PCB and your aluminium sheet to the paper sheet from all sides, but make sure you leave enough uncovered space to accomodate the PCB design and Solder paste stencil, respectively (they are the same size). use 2 layers of tape on each side, you'll se why in a moment.
- take out some photoemulsion with a syringe and lay a thick line along one of the edges of the PCB, and another one on the aluminium, it should look like a slug (see pic 2).
- in one smooth pass, use the aluminium piece to spread the emulsion along the surface, you need to make sure the aluminium piece reaches the tape on both sides so the emulsion layer is a consistent and sufficient thickness. if the emulsion wasn't enough, just apply more with the syringe and do another pass over the whole board.
- repeat the process for the aluminium sheet.
- remove the tape and set the PCB and aluminium sheet inside a dark cabinet so they can dry undisturbed.
- Leave them to dry for at least 4 hours and, if possible, remove them and store them in a lightproof containter before the sun begins to rise.
Step 6: Expose Your Design
- Put the emulsioned PCB on a piece of scrap wood and place the printout INK DOWN over the emulsioned part of the PCB.
- place a piece of glass over the whole thing and clamp everything with big paper clips so that the pattern is firmly pressed against the emulsion and nothing moves.
- Take the set up and place it under the sunlight for 1 minute and a half if it's a bright day, and a little more if the day is a bit cloudy.
- As soon as the time is over, quickly cover everything with a dark towel so it doesn't over expose and remove the clamps.
Step 7: Develop
- Quickly take the PCB and place it inside a container with the developer solution.
- Leave it inside the solution and gently brush it with a small paint brush.take it out in around 10 second intervals to check the progress.
- you will start to see an image of the design, and finally, the bare board where the emulsion wasn't exposed.
- once all emulsion is gone from where it shouldn't be, take it out of the solution and rinse it with water to stop the developing process, or you risk overdeveloping it and losing all the emulsion.
- once dry, set it in the sun again for a few minutes so the emulsion fully hardens.
Step 8: Etch: Copper Clad
- Cover the excess copper with tape and repair any cut traces with a thin permanent marker.
- Set the PCB inside the ferric chloride etchant and let it do it's thing.
- If you don't heat the etchant, it will be very slow, so let it do it's thing and check periodically, at about 5 minute intervals, to see the progress.
- once all unwanted copper has ben etched away, take the board out and thoroughly wash it with water to remove any etchant.
- Finally, set the board inside the Emulsion remover solution and let it do it's thing, in my experience, it can take quite a while to react, maybe up to an hour, so be patient.
Step 9: Etch: Aluminium Stencil
To etch the aluminum stencil you will need Muriatic Acid, AKA Hydrochloric Acid. This Acid is very common and usually sold in most supermarkets, but it is still very dangerous and should be handled with EXTREME CARE!
To etch the aluminum, first cover the back side completely with transparent tape, then proceed to stick it to the piece of glass on all edges, and finally, build a tape container around it, making sure everything is well sealed.
As a safety precaution, keep some baking soda nearby, so you can quickly neutralize the acid if required.
To be able to see how the process is going, I mounted the whole thing in a piece of glass protruding from a table, so I could shine a light underneath and detect as soon as the aluminium has been etched away. Be very careful, as it will start to bubble and become hard to see. If it gets over etched (see pic 6) the stencil will not work.
Step 10: Apply More Emulsion
At this point, the circuit is complete, now we need to add a soldermask to protect the bare copper and prevent solder from sticking where it doesn't belong. Special soldermask kits are available online, but I found that the PCB resist works just fine as a soldermask, though it's not as resistant to heat.
To make the soldermask we will re sensitize the board with the photoemulsion just as we did earlier, but now we are going to expose it with the soldermask negative instead of the circuit negative.
The tricky part to this step is to make sure the soldermask is aligned properly, as it will not work it it is misaligned. Fortunately, PCB photoresist is easily removed, so if you mess up, you can just try again.
Step 11: Expose Again
Now we are going to expose the photoresist we just applied so it serves as a soldermask. Once it is dry, place the soldermask negative on top and try to align it as best as possible. It is tricky because the photoresist is quite dark, and you must do it in a dimly lit area, preferrably with a red safelight.
After you expose it, develop it just like before, and then leave it in the sunlight for another while, to make sure the remaining photoresist is really cured well.
Step 12: Apply the Solder Paste
At this point, the PCB is complete, now we must populate it. For this, set your board on a table and set the stencil on top. Line up the stencil with the PCB and stick it to the PCB from one side with masking tape. This is so the tape acts as a hinge and allows us to lift the stencil without losing the alignment.
Now that everything is aligned, apply a generous ammount of solderpaste to the top of the stencil (see pic 4) and spread it across evenly using a squeegee, plastic card, or a strip of metal (pic 5). Lift the stencil gently to see if all the pads got a good ammount of paste and if not, set it back down and fill in the holes (see pic 6).
Step 13: Place the Components
Now that we have the board ready and with paste, we can populate the components. For this, you can use the component printout as a reference. In order to avoid confusion and missed components, it is best to go in order from smallest to biggest; first the resistors (pic 2), then the LEDs (pic 3), next the chips (pic 4) and finally the buttons (pic 5). You can see that, eventhough the design accomodates 4 boards, I am only populating 2. This is because I only had 2 chips, but also it is pretty common for PCBs to have manufacturing problems (broken connections) so it is advised to test each board with a multimeter and only populate the ones that are ok.
Step 14: Reflow
Ghetto reflow! SMD components are small, this is why instead of soldering them by hand (which can be done), it is much easier to use paste and a process called reflow.
In professional circumstances, reflow is done in specialized ovens that have very fine tuned heat up and cool down curves, but a pan works well enough, just make sure to set the board over some nails so the heat doesn't get transferred directly, as this might kill your components.
To reflow on a pan, set the board over some nails and turn the fire as low as possible. Watch the board all the time and as soon as all the solder paste has melted turn the heat off and let it cool down on it's own.
Step 15: Program
Congratulations, the hard part is over and we are nearly finished, we now just need to program the boards, cut them out and install the batteries.
To program the boards, you first need to download the program below and install the Energia software. Next, solder 2 wires on the pads next to the chip and 2 wires to the battery pads. Connect these to the MSP430 Launchpad as seen in the picture (make sure to remove the MSP430 chip from the launchpad) and upload the program from your computer.
As soon as it is done uploading, you should see the LEDs blinking, and they should display a random number every time you press the button.
Step 16: Cut and Drill
Now we just need to drill the 2 holes for the battery using a 1/32 drill bit and cut out the boards using a hacksaw or simillar tool.
Step 17: Add the Batteries and Test
Once the boards are drilled and cut, just add the battery holder from the back making sure it is in the right orientation (see pics for reference) and solder the pins to the pads on the other side. Now the dice are finished and should work without a problem. I painted mine blue on the battery side with a sharpie so they matched the soldermask, but this is optional.
If all went well, you should now have 1 to 4 working LED dice, and a whole new skillset to incorporate into your new projects.
As most of us know, in the electronics world things almost never work out perfectly the first time. If at any point you mess up or something is not working, remember that failure is the best way to learn and, instead of giving up, try revisiting the guide and repeating a few steps. In my case, I had to re make the board completely, as the first one got over etched, and I had to apply the soldermask twice, as I didn't align it properly.
Step 18: Conclusions: Randomness Analysis and Algorithm Explanation
A word about randomness and Chips
As many people know, Arduinos and alike have random number generating functions available, however, as some have come to realize, these are usually not very random and end up giving the same sequences every time you reset the device. This is due to the fact that these pseudo random secuences are ultimately generated using a computational algorithm that runs exactly the same way every time.
Because of this, it is necessary to seek another way of generating the numbers so they are truly unpredictable. There are many strategies, but the approach I chose to use is one that depends on the user; the dice is keeping count of how many milliseconds it has been on, and when you press the button, it takes this number and applies the Modulo 6 (%6) operation, that is, it divides it by 6 however many times it can and outputs the remainder. Because it is impossible for a human to time it's actions to a millisecond level, this dice is for all intents and purposes truly random. However, it must be noted that, if a machine with sufficiently precise timing capabilities were to operate it, it would be able to reliably decide the numbers that it outputs.
The idea of this instructable is to give you the bases for building an object such as the tiny dice, so by all means feel free to experiment and modify the design and the code to see what you can make, just make sure to post a comment and some pics about it.
Step 19: What's Next
The tiny dice is a great example of what can be achieved at home with some simple tools and materials, and it is as-is a working electronic Die, now it is up to you to decide what you will make of it and the skills you learned.
If you are new to electronics, use this as a learning point, go back and try to understand the design and how the code works. Modify it, test it, and see what works and what doesn't. If you have more advanced knowledge about electronics, try to make an original design, and use this guide to take it from the computer to the real world.
Whatever you do, just make sure to share it and, if you liked the Instructable please consider voting for it on the Circuits Contest.
Third Prize in the
Circuits Contest 2016