A buddy of mine, who is a big bycicle enthusiast, has his birthday coming up... so I decided to build a custom flashlight for his fixed gear bike.
I'll divide the project into four phases.
In the first part I'm going to introduce you to the project, and describe the prototype circuit on a breadboard.
I'll divide the project into four phases.
In the first part I'm going to introduce you to the project, and describe the prototype circuit on a breadboard.
For the electric part you need the following components:
- ATmega 168 or similar micro controller in DIP package
- Three red, three white and three blue ultra bright leds
- At least 10x10 cm prototyping board with standard 2.54 mm hole distance
- Nine 470 ohm resistors
- 5V regulator 7805
- Two 100 micro farad capacitors
- Two 100 nano farad capacitors
- Small toggle switch
- Small normal open switch
- Battery holder for four AAA batteries
- Some thin wires
- Atmel programming interface (or similar)
- Silicon glue
It also helps if you have a breadboard and some jumper wires.
I recommend before trying to understand the circuit that I will describe, to take a look how a breadboard works, how to connections are made in it. You can take a look at the Wikipedia article: "http://en.wikipedia.org/wiki/Breadboard".
Tool you need for the first part:
- cutting pliers
- bent nose pliers
- soldering iron & solder
Programming interface
The programming interface has to be connected to MOSI, MISO, SCK, RESET, VCC, GND pins of the controller. There is no point giving the pin number, since they vary from one controller to another. So make sure to add 6 additional pins where to connect the programmer.
ATmega 168 controller pin layout (yours might be slightly different) |
The VCC, AREF and AVCC pins of the controller need to be connected together, so as the GND pins. Just in case you didn't know VCC represents the (+) pole of the circuit and GND represents the (-) pole.
The VCC will need to be connected to the (+) output pin of the regulator, while the GND to the middle pin.
7805 5V regulator
The reset pin on the controller, beside the reset pin on the programmer, it also needs to be connected through a 10k Ohm resistor (pull up resistor) to VCC.
The Input / Output (I/O) pins of the controller, on the schematic are marked as PBx, PCx, PDx, x representing a number.
The normal open switch needs to be connected on one side to ground and ond the other side to a free I/O pin of the controller (PB0 in my case, but can be any free I/O pin).
The (-) part of the leds needs to be connected to GND, while the (+) part to one leg of the resistor.
The resistors free leg gets connected to a free I/O pin on the controller (PC0, PC1, PC2, PC3, PC4, PC5, PD0, PD1, PD2 in my example).
The resistors free leg gets connected to a free I/O pin on the controller (PC0, PC1, PC2, PC3, PC4, PC5, PD0, PD1, PD2 in my example).
Circuit layout
I first built the flashlight on a breadboard, to test out the electric circuit and the software loaded on the controller.
Component connections on the breadboard
(programming interface, switch, pull up resistor to micro controller)
LED connections to micro controller
Yellow, purple and red wires connect the LEDs to the micro controller.
External battery connection to breadboard
Now the flashlight can run without the programming interface being connected.
The capacitors will be connected between pin 1 and 2 and between pin 2 and 3 of the regulator.
I will add them only in the third part of this tutorial, where I'll solder the components to a board.
In the next part I'll describe the program loaded on the micro controller.
Stay tuned :)
No comments:
Post a Comment