Another great article showing that microcontroller hobby projects are neither hard nor expensive. James shows us how to use a Picaxe microcontroller for easy and inexpensive hobby microcontroller projects. With one hour and $15 in parts, you are up and running with a microcontroller.
This article was submitted by James Moxham as part of the “Hobby parts for articles” program. James receives a Modern Device Company Bare Bone Arduino Kit for this great article.
Build a working microcontroller circuit on a shoestring budget. Microcontrollers have a reputation for being expensive and having complex instructions. This how-to shows that you don’t need complex pre-built demonstration boards or expensive equipment. In addition to the parts you will need a PC with access to the internet. This little circuit will turn a led on when it gets dark, which is a trivial application but the aim here is to demonstrate ease of construction and low cost.
1) Start the download of the free programming software from RevolutionEducation. Click on the Software tab. Scroll down the page a bit. You will need to register a user name. The file is 38Mb so it is worth starting this now while you get on with some soldering.
2) Time 00:05 Gather all the parts.
C1 33uF, C2 0.1uF, G1 AB9V 9V battery, IC1 78L05, LED1 LED5MM, R1 22k, R2 10k, R3 1k, R4 10k, R5 LDR approx 5k indoors, U1 PICAXE-08M, D25 female plug (or 9 pin depending on your PC), Small piece of proto board, Computer with serial port – any speed from 300Mhz plus (older computers are more likely to have a 25 pin connector), Optional – 25 pin male to female cable 1 meter to bring connection to front of PC (or 9 pin equivalent), Optional – USB to serial adapter if computer does not have a serial port, 8 pin socket, wire, solder.
The clever part is the Picaxe 08M – cost $3US and is available from PHAnderson (US), RevEd (UK) and Microzed (Australia). OK, you might have to wait 3 days for this to arrive – so technically this how-to is 3 days plus one hour.
3) The Schematic
(Drawn with Eagle – a free schematic and PCB design program)
4) Time 00:10 Solder in the components
The 25 pin plug has had all but pins 1-7 cut off. Only pin 2, 3 and 7 are needed on the 25 pin plug (or pin 2,3 and 5 on a 9 pin plug).
Serial port connections –
25 pin Pin 2 = PC to board. Pin 3 = board back to PC. Pin 7 = ground.
9 pin Pin 3 = PC to board. Pin 2 = board back to PC. Pin 5 = ground.
Note that pin 2 and 3 are swapped on the 9 pin and 25 pin plugs.
5) Component side view
6) Time 00:15 Bridge some of the pads together.
Follow the schematic. If components follow the schematic it is usually possible to make more than half the connections with solder bridges.
7) T 00:30 Connect remaining wires with wire-wrap wire. This view shows the component side with a special wire wrap stripping tool. Using a wire-cutter can result in nicks to the wire and breaks later on. Of course thicker wire can be used – anything will work really.
8) T 00:31 Make wire connections
9) T 00:40 Connect to PC. This photo shows connection to a 25 pin to 25 pin male to female cable. This is not really needed as the board plugs straight into the back of a PC, but in my case the back of the PC is hard to get to and I had one of these cables free.
10) T00:50 Start the programming editor. Select the 08M chip when it starts. Type in the code below:
11) T 00:55 Click on the blue triangle at the top of the screen under ‘Help’ to download the program. Sometimes, just sometimes, this will fail and one reason is if the previous program is still running in the chip and it has long delay subroutines. To fix this, click the download triangle, then briefly disconnect and reconnect the 9V battery which will reset the chip.
12) T 00:60 Disconnect the circuit from the computer. It will now run on its own and the led will come on whenever it is dark.
13) Have a read through the first two documents in the Help menu of the program (you might need to install Acrobat) The first describes the different Picaxe devices, and the second document has all the instruction codes. These little chips can do a lot more than turn on a led. There are other solutions to using a 25 or 9 pin plug – RevolutionEducation use a 3 pin stereo plug. Personally, I program my chips in a breadboard and transfer then to the working circuit. The circuit above can also double as a programming circuit and the chips can be transferred to other circuits once they are programmed.