Transwiki:How to Create an ATmega168 Basic Stamp

Introduction
The Atmega168 offers a immense amount of advantages for its simple dip packaging.
 * 8-bit high performance low power microprocessor
 * 16kbytes flash, 512bytes EEPROM, 1kbyte Sram
 * In-system programmable
 * 28-pin P Dip with coding protection and 20yr life
 * 2 8-bit timers, 1 16-bit timer, analog comparator, ADC, PWM, SPI interface, serial USART, serial I2c, watchdog timer, External/Internal interrupts
 * Operating voltage- 2.7v-5.5v

The Atmega168 is a powerful 8-bit microprocessor that will provide a near perfect foundation for most projects. With its compatibility to Arduino; which is an open source firmware that allows the common hobbyist to develop and implement coding almost elementary. Since Arduino is an open source compiler it offers an extensive set of coding samples, library's to simplify coding structure, user submitted coding available for free use, and countless full implanted examples for reference. Although you can buy an Arduino board at local electronic stores and implant the board right into your project, if you understand the basic stamp of the atmega168 you can use it however you desire.

Basic Circuit
For actual use there are serveral stages when it comes to impentation. Developing a microprosceor circuit is near pointless unles it has a use. Primarily speaking the sole pupose of a microprosscesor is to preform its progamable tasks; limited only by its hardware restrictions and users capibilty. The first step to impleentation would be breadboarding the circuit, this allows for maximum inovation considering everything nothing is permenant. Next would be implanting your circuit which moves the ATmega168 to a stand alone platform, this requires novice soldering skills. Once you have a stand alone microprossor circuit that funtions, you may want to remove its shakles and let it live as it was meant to be. This. meaning move from a wired power supply to a bateery source. This requires anpothert basic circuit to regulate an adjustable dc supply.

Building the Circuits
The Circuits described can be built on serveral platforms; but the focus will be on breadboarding, and soldering a circuit onto a preforated circuit board. Breadboarding is a first step to creating any circuit, it allows for maximum change while offering secure attachment points for components. The breadboard is designed to link rows together internally, and offers colums for voltage and ground. There are two sides of the breadboard usually which both operate indepentdly. Since all points in a single row are connected internally horizontally, it allows for multiple connection points. However each row is independent from each other, except for the voltage and ground colums they are interally connected vertically. Once a circuit has been established as working, and you have the correct pin confiquiration you may want to solder up a semi-permentant circuit. This is when you will use a preforated circuit board; which offers holes for componets, but usually lacks internal connections. To connect components jumper wires, or solder are normally used. Although most components used are bi-polar meaning they lack direction and can function with current flowing either direction; some can be polar and have a defined direction of current flow. An example of a bi-polar component will be a resistor, a ceramic cap, a switch, or a crystal. An example of a polar component would be an LED, or a electromagnitic capapcitor.

Breadboarding
The componets conventaly plug into predefined and internally connected sockets, no soldering or advanced skills are required. The breadboard is almost a universal stamp, and is avalible in a various of sizes. The more expensive units offer a built in power supply, while most will offer you simple power lugs, or even just a voltage and ground coloumn.

Step 1
Install the Microprossor
 * Place the following components:
 * Secure the 28-pin socket betwwen the two sides of the bread board
 * Install ICU ATmega168 into the socket with reguards to direction
 * Place a jumper between Pin(VCC) and VCC
 * Place a jumper between Pins(GND) and GND

Step 2
Install the Crystal
 * Place the following componets:
 * Install Q1 near Pins(XTAL1&2)
 * Install C1&C2 near Q1
 * Place a jumper from each leg of Q1 independently to C1 & C2
 * Independtly place a jumper from C1 & C2 to ground

Step 3
Instal the reset switch
 * Place the following components:
 * Install S1 near the reset pin(PC6)
 * Install R1 near the reset Pin(PC6)
 * Place a jumper connecting reset pin(PC6) to S1
 * Place a jumper connceting S1 to ground
 * Place a jumper connecting R1 to reset Pin(PC6)
 * Place a jumper connecting R1 to VCC

Step 4
Install the ISP serial communication
 * Place the following components:
 * Install SV1 near the micropossor
 * Place a jumper between Atmega168 Pin(PB3) and SV1 Pin(1)
 * Place a jumper between Atmega168 Pin(PB4) and SV1 Pin(9)
 * Place a jumper between Atmega168 Pin(PB5) and SV1 Pin(7)
 * Place a jumper between VCC and SV1 Pin(2)
 * Place a jumper between GND and SV1 Pin(6)

Step 5
Set up reference points for Atmega168
 * Place the folowing components:
 * Install C1 near Atmega168 Pin(ARef)
 * Place a jumper between Atmega168 Pin(Aref) and VCC
 * Place a jumper between Atmega168 Pin(Aref) and C1
 * Place a jumper between C1 and ground
 * Place a jumper between Atmega168 Pin(Avcc) to VCC

Step 6
Set up LED1
 * Place the followng components:
 * Install LED1 near Atmega168 Pin(PB0)
 * Install R2 near Atmega168 Pin(PB0)
 * Place a jumper between the anode pin of LED1 and Atmega168 Pin(PB0)
 * Place a jumper between the cathode pin of LED1 and R2
 * Place a jumper between R2 and ground

Soldering onto a Perforated Board
To truely create a standalone device you must first make it its own platform. The breadboard offered us the abilty to temperarly configuire the circuit for tuning. But soldering the componets to a preforated board will offer us a rigid semi-perment device; From this point the device can be implemented. There are other ways to create a circuit board, but they either require comerical or hobbisy quailty etched boards. An ethced board will eliminate the need for jumpers, bascially the board itself is pre-wired for jumpers. This would be the next step to fully comercialize a device. Although soldering can be simple it does deseve a few notations:
 * Soldering should be commensed in only a well ventilated enviroment considering most solders contain lead.
 * Differnt soldering tips are required for differnt jobs.
 * Conicle tip-SMD(surface mount device),Smaller Components
 * Bevel tip-Specailty soldering for SMD(surface mount device)
 * Chieseltip-smaller & larger components


 * Soldering iron temperture is key(Too hot will burn devices, too cold will create bad solder joints)
 * Pressure is negligible it will not increase soldering melting time

Step 1
Install the Mcroprossor Socket
 * Place the following components:
 * Install the 28-pin socket into the middle of the frontside of the board.
 * Place a peice of tape securing the socket into place.
 * Place a jumper between Pin(VCC) and VCC on the backside of the board; then solder only the Pin(VCC) connection
 * Place a jumper between Pins(GND) and GND on the backside of the board; then solder only the Pins(GND) connections.

Step 2
Install the Crystal
 * Place the following componets:
 * Install Q1 connecting (XTAL1&2) on the frontside of the board.
 * Install one leg of each C1&C2 to each leg of Q1 in same hole as Q1 on the frontside of the board; then solder in place,
 * Independtly place a jumper from the other leg of C1 & C2 to ground on the backside of the board; then solder in place.

Step 3
Install the reset switch
 * Place the following components:
 * Install S1 near the reset pin(PC6) on the frontside of the board; then solder in place.
 * Install one leg of R1 into the same hole as reset Pin(PC6) on the frontside of the board; then solder in place.
 * Place a jumper from the other leg of R1 to Vcc on the backside of the board; then solder only the R1 connection.
 * Place a jumper connecting reset pin(PC6) to one leg of S1 on the backside of the board; then solder in place.
 * Place a jumper connceting the other leg of S1 to ground on the backside of the board; then solder only the S1 connection.

Step 4
Install the ISP serial communication
 * Place the following components:
 * Install SV1 near the micropossor on the frontside of the board; then solder in place.
 * Place a jumper in the same sockect as Atmega168 Pin(PB3) connecting SV1 Pin(1) on the backside of the board; then solder in place.
 * Place a jumper in the same sockect as Atmega168 Pin(PB4) connecting SV1 Pin(9)on the backside of the board; then solder in place.
 * Place a jumper in the same sockect as Atmega168 Pin(PB5) connectimg SV1 Pin(7)on the backside of the board; then solder in place.
 * Place a jumper between VCC and SV1 Pin(2)on the backside of the board; then solder only SV1 connection.
 * Place a jumper between GND and SV1 Pin(6)on the backside of the board; then solder only SV1 connection.

Step 5
Set up reference points for Atmega168
 * Place the folowing components:
 * Place a jumper in between VCC and the same socket as ATmega168 Pin(Aref) on the backside of the board.
 * Install ong leg of C1 in the same socket as Atmega168 Pin(ARef); then solder in place.
 * Place a jumper from ground to the unused leg of C1 on the backside of the board; then solder in place.
 * Place a jumper between VCC and the sane socket as ATmega168 Pin(Avcc) on the backside of the board; then solder in place.

Step 6
Set up LED1
 * Place the followng components:
 * Install the anode leg og LED1 into the same socket as Atmega168 Pin(PB0)on the frontside of the board; then solder in place.
 * Install one leg of R2 into the same socket as the cathode leg of LED1 on the frontside of the board; then solder in place.
 * Place a jumper between ground and the remaining leg of R2 on the backside of the board; then solder in place.