It uses the PIC10F206 from microchip, the tiniest microcontroller I have ever seen. Its advantages are that its small, fast and reliable and has a built in RC clock so there is no need to mess around with crystals and resonators. Its downside is that it only has 6 pins, 2 of which are taken up by power and ground! The way to get around this is to use shift registers to give yourself more outputs as you will see in the next few pages.
It also uses a small rechargeable battery and solar cell, which are typically pricey items, but currently there is a huge flood of keyring-sized cheap solar powered torches from china, which can be bought from the pound shop in England, or had very cheaply on eBay. I have even seen these for sale in petrol stations.
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: You Will Need:
A solar powered keyring torch
A 'wooden plant label' or other suitable handle.
Small scraps of wire
HEF4794 shift register in an SOIC package
10F206 in an SOT23-6 package
8x Surface mount LEDs of your choice - I used blue in 1206 package
8x Resistors of your choice - I used 320 ohms in 0603 package
1x 10k resistor in an 0603 package
1x 68nF capacitor in an 003 package
A drill or veroboard cutter
Needle file (or some method of making square holes)
Soldering iron with a fine tip, preferably temperature controlled
Desoldering braid or a way to remove excess solder from the torch PCB
Tweezers for placing small components
Glue gun or double sided tape
PIC programmer that supports PIC10F206 - I used the PICKIT2
Hot air soldering station
Method of producing PCBs
Cleaning alcohol -methylated spirit or isopropanol will do
Step 2: Carefully Dissect the Torch
A sharp screwdriver helps to get into the gap and separate the 2 halves of the casing as shown below. The casing just pushes together - there are no screws.
Step 3: Prepare the Torch Parts
Inside you should find that the solar panel has a PCB glued to the back of it, with a small tactile switch and some LEDs. It also has a tiny surface mount diode, this is to prevent the battery power being used by the panel when its dark. You should remove the plastic housing, you're only after the PCB, solar panel and battery.
You can also desolder the LEDs from the board, using the solder braid to ensure there are no blobs of solder sticking up, though bare in mind the link wires from the PCB to the panel are extremely fragile.
Safety note: If you are soldering for more than a few seconds in the same spot, it may be wise to stop and let the board cool down. The heat can pass through the board and in theory cause the glass in the panel to expand and crack, though I didn't have this problem with mine.
Step 4: Prepare Your PCB
Use your favourite PCB etching method.
I personally have had great results with the toner transfer method as follows:
Print the PCB foil mirror-imaged using a laser printer, onto thin glossy paper such as the type cheap magazines are printed on. It doesn't matter if it already has text or pictures on.
Cut your copper-clad board and magazine paper to fit, and tape in place with masking tape ensuring it is perfectly flat. If it is even slightly raised or crinkled it will not work.
Pass it through a laminator 10-15 times. Note that this will probably void your laminator warranty.
Soak the board and paper in water straight away before it cools. Ensure that at no point do you lift or peel the paper. After a few minutes the thin paper should start to dissolve. You can rub it with your thumb now to help the removal of paper, but I wouldn't advise using fingernails.
When the paper is all gone, inspect the toner and check that the traces and the pads are all transferred correctly. When the board dries it is normal for it to go slightly white, but this does not affect etching. However, cracks and other imperfections will cause problems, don't be afraid to clean the toner off and start again, its very cheap!
When finished, your PCB should look something like the image below.
Step 5: Etch!
Not much to say here other than - keep the etchant moving at all times, and keep it warm to speed things up.
If you have poor results, it could be that the make of laser printer is not suitable. I have had no problems with the 2 Samsung printers I've had but I have heard various bad things about HP and Brother printers due to the chemistry of the toner.
The image below shows a part-etched board. Notice how the copper in the top left corner has been removed, leaving only the area covered by the toner.
Step 6: Clean the PCB
It is important to remove all of the toner, as remaining toner can affect the way the solder flows. A rough fibrous sponge or pan scrub is ideal for this, though it can take a good 5 minutes of hard work to remove all traces.
After this, give the board a quick wipe down with cleaning alcohol to remove fingerprints etc.
Step 7: Neaten Up the Edges and Populate the Board
Using a file and cutters, neaten up the edges of the board to fit the handle you are using. It is best to do this before soldering the components on, as I had quite a bit of trouble protecting the board whilst filing it.
Surface mount soldering is quite an in-depth subject that I won't cover here. It just takes practice, good eyesight and a steady hand, but I'm now at a point where I prefer surface mount components - there are no holes to drill, they take up less space, and some newer parts are not available in through-hole packages.
See the diagram below for component placement. For reference I used Sunstone PCB123 - a freeware PCB design software package, and have found it to be very useful. The bareboard file for this is attached.
Step 8: Add a Programming Header of Your Choice
See the diagram below and connect to the points accordingly.
Step 9: Final Check Before Plugging In
So now your PCB should look something like the one below. It pays to just do a continuity check with a multimeter between the pins on the PIC and the pins on the shift register, to check for short circuits and to make sure the traces etched properly.
If you find a short circuit you can often fix it by running a scalpel between the pins to remove any hidden solder-bridges, and if you find an open circuit, a tiny link wire such as the one you should have used for the shift register ground pin usually solves the problem.
Step 10: Software
Now you have all of the hardware sorted, its time to decide what you would like it to say/do.
The basic principle is that if you flash lights on and off in a set sequence whilst it is moving through the air, you can form shapes and even text because your eye does not react quick enough to see the movement. It interprets it all as one image (much like a long-exposure photograph).
For converting text to a suitable format for the display, I use this fantastic website. I don't know who it belongs to but I am very grateful to them for saving me so much time. There are a number of fonts to choose from too. http://www.repulsor.net/minipov/text/
F or images, filling in the blocks on a piece of squared paper helps quite a bit to visualise how it will look. Remember that you only have 8 LEDs therefore the image can be no higher than 8 pixels, but can be anything up to 254 lines wide.
See the attached software below, and please note that you will need MPLAB 7 or later to successfully build a .hex file.
Step 11: Software Continued
To modify this you do not need to know a lot about PICs, but I will explain the rough outline of how it works:
Configuration and EQU statements - leave this untouched. It sets the directions of the I/O ports and it is also where variables are defined. EQU statements just make the program easier to follow when I want to go back and change it in a years time.
Delay - This sets the time taken per line (i.e. how long it waits between groups of 8 LEDs) It is currently set at 2000 instruction cycles. As the PIC is operating at 1 million instruction cycles per second, that works out at 1/500th of a second. Reduce this time if letters and symbols are appearing elongated when you move it. Increase this time if they appear squashed up.
To generate a new delay I use this: http://www.piclist.com/techref/piclist/codegen/delay.htm
Remember to select 'instruction cycles', in temporary register names, type 'del1 del2 del3', tick the 'generate routine' box and press go. You only need to paste from after the end of the cblock, as the variables are already defined in another area of code.
main_rtn simply updates the line numbers when it goes back to the beginning. If you are changing the length of the message (see below) do not forget to adjust the number of lines, or you will only get part of it displayed.
line_fetch keeps track of the number of lines left, and 'fetches' the data from the lookup table, then passes it to write_to_shift so that it is displayed.
Lookup is a table containing the data to be displayed. If at first you don't see it, tilt your head 90 degrees to the right and you should see a heart shape formed by the '1's. You must not delete the 'RETLW B' part, but feel free to modify the 1s and 0s. Also you can copy and paste new lines in there, remembering to update the number of lines in main_rtn accordingly.
write_to_shift examines the byte of data passed to it by line_fetch and updates the shift register, and in turn the display.
Step 12: Finishing Touches
After programming the board with your desired message or symbol, it is now time to remove the programming header lead and mount it on the handle.
I drilled a small hole half way down the handle, just slightly smaller than the tactile switch on the board, then filed it square so that it was a tight fit. The switch is just the correct height to sit flush with the handle so it is not inadvertently pressed, but is not so far in as to make it difficult to press.
You can choose to either glue the PCB to the handle, or use double sided tape. Keep wires as short as possible for neatness, and then fold the battery upward so that it no longer prevents you from pushing the switch into the hole.
Solder the power and ground of the the PCB you made to the connections where the LEDs used to go on the torch board, then glue the solar panel, switch and battery in place.
Note that it may be necessary to flatten off any bulges of solder, and cut a small channel in the handle with a scalpel so that the diode doesn't get in the way.
Step 13: Schematic
The schematic is almost trivial, but for those that are interested, it is simply 8 LEDs connected to the open drain shift register outputs, with current limiting resistors.
The PIC outputs are connected to the strobe, data and clock inputs of the shift register, and that leaves one PIC pin unused, which is pulled high with a 10k resistor.
The 68nF capacitor is just there for decoupling purposes, any value +/- a 50nF would be fine, and you can even omit it entirely if you feel you can get away without it.
It is worth noting that you are much better to use phosphor/UV based LEDs (white, blue, phosphor green) because they have a 3V voltage drop, and therefore are unlikely to pull the battery voltage lower than the minimum operating voltage of the PIC and shift register, whereas if you used normal LEDs with a 2V voltage drop, it could well cause problems when the battery gets a bit low.
I hope this was informative, and that maybe someone will have a go at building one. Feel free to contact me if you have any questions.
Participated in the