*** Close Encounters of the Curiously Minty Kind. ***
This Instructable will show you how to build an Altoids version of the 'Close Encounters' mothership, and how to interact with it. This may be vital training for that day when the Bright White Beam comes to suck you up into the unknown.
It will also introduce you to the PicAxe microcontroller chip and a method of drilling perfectly spaced holes in thin sheet metal. I have kept the building instructions fairly concise, but the photos show everything step by step.
Step 1: The LED Array
If you're not familiar with soldering, there's a great guide HERE. I would disagree with one point in it - Lead-free solder may be OK for health, but it's rubbish for soldering. Get yourself a good, big reel of 60/40 tin/lead (while you can) and arrange efficient fume extraction.
Most LEDs are VERY bright over a very small viewing angle. Here I've used wide-angle flat top LEDs which give the same light but spread over a much wider range which will allow this to be appreciated from all angles. The video really doesn't do justice to the brightness and clarity of the LEDs. They are bright even in daylight. Also the initial flashing is an artifact. The LEDs are pulsing smoothly.
The 12 LEDs are arranged as three banks of 4, which gives 7 possible patterns of illumination. It would have been good to have more but I wanted to keep this simple and specifically use the PicAxe 08m chip. The spreadsheet shows the way the LED colours and banks are arranged.
For the LED array you will need :-
- 3 x red LEDs, 3 x blue LEDs, 3 x green LEDs, 3 x yellow LEDs.
- 6 x 180R resistors (brown, grey, brown) for the red and yellow LEDs.
- 3 x 220R resistors (red, red, brown) for the blue LEDs.
- 3 x 330R resistors (orange, orange, brown) for the green LEDs.
- 18 x 15 hole copper strip veroboard.
- Spot face cutter ( or a 5mm drill bit or craft knife).
- Scraps of plain board and link wire.
There are many factors influencing how bright a LED looks, so I chose these values empirically (i.e. what looked right) to balance the brightness, with a quick calculation to get around the right current. These are running at around 12mA
Cut 4 strips of single hole plain veroboard. These are to act as spacers to give clearance for the resistors when the array is mounted on the tin lid. I put ink dots on each so they didn't get mixed up.
Insert the LEDs as shown with the colours in the right order and with the anodes (short leg - large electrode) at the top. The anodes will be all connected to the supply voltage. The cathodes will be joined in banks and switched to Gnd with transistors. Solder these in and crop the legs.
Cut the tracks using the spot face cutter and solder in the resistors.
The table below shows which LED goes where, which resistor goes with it and which output of the PicAxe it's connected to (X,Y or Z).
Column 1 Column 2 Column 3 Column 4Red X 180 Yel Y 180 Grn Z 330 Blu Y 220Yel Y 180 Grn Z 330 Blu X 220 Red Z 180Blu Z 180 Red X 180 Grn Y 330 Yel X 180You can then carefully solder in the two bare wire links which connect the common anodes and then connect the LED cathodes into banks with link wire (green, yellow, blue wires), and add flying leads which will go to the control board. You should also add a supply wire (red) to the anodes.
Carefully test the assembly by applying 5V to the red wire, and grounding each bank in turn. Each connection should light up a different 4 LEDs. If it works, you've completed the LED array board.
Step 2: Constructing the Mothership Fuselage
Let's have a break from breathing the solder fumes and prepare the tin. I am indebted to SteveAstroUK for introducing me to the method I describe here. Without his advice, this project would be nowhere near as neat.
You will need the following :-
- Altoids. The great thing about buying an Altoids project box is that you get Free Mints with it - Take these out first.
- A bench drill with a small bit (I used 1.5mm) and a step drill bit.
- A piece of scrap Veroboard (20 x 14 holes).
- Marker pen and double-sided sticky tape.
2) Using the small bit, drill pilot holes through the marked points. Use a sharp bit at a slow drill speed for this, and apply only very light pressure. The veroboard holes allow you to centre the bit exactly before you drill.
3) Use the step bit, again at slow speed, to enlarge the holes to 6mm (1/4 ").
My step bit came from eBay - 15 quid (25 dollars) for three size range bits.
Again, use a slow speed and very light pressure.
4) Turn the lid over and place on a piece of scrap wood with a hole drilled slightly larger than the LED holes.
Very Carefully lower the step drill so the 8mm (3/8") step takes off the swarf from the rough side.
Don't drill into the lid itself.
You should now have an Altoids tin with a matrix of 12 perfectly aligned and perfectly clean holes which your LED array will fit into first time.
Step 3: The Controller Board
For the controller circuitry you will need :-
- PicAxe 08M microcontroller and 8 pin DIL socket.
- 3 x NPN high gain transistors. I used BCX38C darlingtons. (Others will work but check pinouts.)
- 4 x 47K 1/8W or 1/4 resistors (yellow, violet, orange).
- 1 x 10K resistor (brown, black, orange).
- 1 x 22K resistor (red, red, orange).
- 1 x 0.1 microfarad 16V capacitor.
- 2 x miniature reed switches.
- Flat 3 x AAA battery holder.
- Sub-miniature piezo sounder. I reclaimed this one from an old PC motherboard. It gave a better sound than the larger bought ones, possibly because of its lower impedance.
- SIL header if you're programming the chip in-circuit.
The photos show component placement and track break locations. Be especially careful of positioning the wire links which join the various power strips. Place the battery connector and the two boards in place in the tin so you can judge what length to make the connecting leads. The three driver connections to the LED array board can be in any sequence.
(The first photo was taken from a slight angle and the tracks and IC pins don't appear to line up. I'll re-do this when I have a chance.)
I've used reed switches as I liked the idea of not having any push-buttons on the case; Activating something using a magnetic field is much more tecchy! One of the reeds switches the power and the other is an input to the chip which is polled to alter the program flow. I'll definitely be using the magnetic switching idea on other projects.
Once everything is connected up, apply insulating tape to the inside of the tin, just to prevent those nasty little short circuits which can turn your electronic wonder into a piece of junk. Locate the boards and tack down with a few dollops of hot glue. This has the advantage of being secure, but you can lever it off if you really need to take the boards out.
Step 4: The Microcontroller and Program.
In praise of the PicAxe.The PicAxe was initially developed for the educational market in UK schools but is being widely used by hobbyists. The PicAxe chip is based on various PICs but with bootstrap code to link to the compiled programs and handle the programming side. They come in all flavours from this suprisingly powerful 8 pin package up to full blown 40 pin.
Look at the manuals and datasheets on the PicAxe site to see the full capabilities. Programming of the chip is via a serial link and done in-circuit. It takes about 20 seconds and you don't even have to unplug the lead to run the program.
I've been in electronics since the early eighties and I've never found a programming environment where the coding / simulation / proving cycle is so simple. Documentation and support from the forum is excellent and there are many robotics enthusiasts using the chips. Control for servos, steppers, ADCs etc are built in to the BASIC-like programming language as well as a host of other goodies. You can also simulate the circuit before you build, and do real-time debugging on a running controller.
Below is the code for this project, which I've included as a Word document as well as the native PicAxe Programming Editor format. The code operation is pretty well commented but if you want to examine it in more detail, download the PicAxe software reference manual.
Load the .BAS file into the Programming Editor, connect the serial cable to the programming pins and hit 'Program'. 20 seconds later, your Alien Intruder will be sitting there waiting to communicate with you.