Search This Blog

Powered By Blogger

Saturday, April 17, 2010

Hardwares needed

Well...now we are preparing for our voyage to uC world!This tutorial is about the hardwares or precisely programming hardware you need to insert the program into your avr chip.Well... what about other parts you need to make project circuits or your own circuits,right?well...you will get their values in schematics of projects and when you are making a project of your own...that's up to you!
First we need to build a power supply for our uC.uCs are mostly operated with +5V.This should be regulated(specially when you are using timing or communication features or ADC etc. because voltage ripples can cause incorrect data outputs).
This is the Schematic of the power supply for uC.This is actually not a full power supply.It's just the voltage regulator part.Build it according to schematic and don't forget to use a heatsink with 7805 IC(It may get terribly hot when used for a long time)
N.B. :- There are two ground pins in your uC,connect both of them to your circuit ground.
Parts list(picture is fair as schematics , not for seeing parts list):
  1. IC-7805(see Datasheet for pin config)
  2. Capacitor-220uF,16V(others voltage ratings will work)
  3. Resistor-1k
  4. LED
  5. Power connector
  6. Switch
Now let's come to program the uC.avr uCs can be programmed in two ways:
  1. Parallel programming(don't mistake,it doesn't mean programming with parallel port of pc)
  2. Programming through SPI bus(this is what we will discuss,because this the way of in system programming.For informations on parallel programming,see datasheet)
In system programming hardware:Well...there are several programming hardwares for that.We will give schematics of the most popular hardwares.Some of them are commercially available(STK500,AVRISP mk II etc.).If you can afford them...then buy one(But we advise you to have the experience of building one of these hardwares)Here are the schematics:
1.Parallel port programmer:If you have an old PC(Old is gold!),then this one can be the starting programmer for you.There are several parallel port programmers.This one was tested by us.Schematic:
N.B. : SCK,MOSI,MISO are the pins of SPI bus of your uC.Find their pin number from Datasheet(same applicable for RESET)In this circuit, a buffer IC has been used(74HC125).You may be thinking about the strange connection pattern of this circuit(You should be,if not experienced).Don't worry, that circuit is easy.But you need parallel port diagram to make this.Ok,here is it:This is the female side of the DB25 Connector Cable used here.You can directly connect the circuit without using the cable but I recommend you shouldn't(You may get some shocks due to earthing).
The Whole circuit can be built on a breadboard(including the power supply).
After building it,we shall use a program Ponyprog to send the program from PC.(will be discussed in the next chapter)
2.Serial port programmerI haven't seriously tested this one but many use it(may be!).It's a bit complex than the first one.
N.B. : This one is not supported by USB 2 Serial Converters
Here is the Schematic:Here,Serial port config is already given.So I haven't shown it.
N.B. : I don't guarantee if it works but since I know,this is a popular one.
USB programmer:
Hmm...now we are getting modern.Well...the programmers stated above are backdated as serial and parallel ports are not available in today's PCs or Laptops(However,if you have an old one,you can still build them...after a while...you will know why I said "Old is gold")To do something with USB port,Hardware driver is needed and to let the PC know what kind of hardware is connected to USB,some id codes and high/low operations are needed.That's why,in almost every USB device,there is a microcontroller or dedicated USB controller chip. Now you may have felt why I said "Old is Gold",because to make a USB programmer,you need a USB controller Chip or uC as driver in which you need to write the hardware program(firmware).Here is a diagram on how USB programmers work.
To know why we need to do that for USB,search google with the following keyword "USB in a nutshell".This is a very good book on USB.
Luckily , if you have an old PC/Laptop,you can make any of the first two programmers(they don't require a uC or controller chip to program your uC) and to be modern,you may use them temporarily to write the driver program(also called firmware) to your USB programmer's driver uC and forget them.Here is the Schematic of one of the most popular(may be the most) USB programmer(that I use at present),USBasp by Thomas Fischl(http://www.fischl.de/usbasp):Well...It looks horrible may be but quite easy to make.Here,as driver uC an Atmega48 has been used.But you can also use Atmega8(Even others if you understand the firmware code).This programmer requires a driver.It's available at the website stated above the schematic.
To build this, you need to know the usb pin config.to know this,visit this site.
N.B. :- Some connections are not very necessary in this circuit.For example...the connection between pin 1 and pin 16(self programing) is for firmware upgrading and not important so it can be deducted from the circuit(But NOT THE ONE FROM PIN 16 TO x2).Connections from pin 2 and 3 to X2 are also not important(keep them if you want).X2 is a connector.You can simply use serial rail to make this one(this would be better if you want to keep your uC circuit on breadboard).This circuit can be built on breadboard but I recommend you build it on a veroboard or PCB.PCB Layouts are available at the site stated above schematic.
Some useful pics: My USBasp board The ISP connector of the board(just serial rail....X2 in the schematic)
These pins are connected to Atmega8's MOSI,MISO,SCK,pin 16 and ground....
Others are unnecessary

One thing to tell you about this circuit is that if you are planning to build a PCB in which you will put your target uC to program,then keep the VCCINT(the target uC will be powered by USB).Otherwise,for ISP operation,deduct it.

No comments:

Post a Comment