Ghetto Programming: Getting started with AVR microprocessors on the cheap.

Ghetto Programming: Getting started with AVR microprocessors on the cheap.

Microprocessors are so cheap these days. If only there were a way to program them up just as cheaply...

*wavy dream-sequence lines*

In this instructable, find out how to build up a complete AVR microprocessor toolchain: compiler, programmer software, programmer hardware, and some simple demos to get your feet wet.

From there, it's just a hop, skip, and a jump to world domination.

The endpoint is not quite as swanky as Atmel's suite, but it's gonna run you about $150 less and take only a little more work to get it set up.

This instructable is based on the Atmel ATtiny 2313 chip, mostly because it's one of the smaller chips (in size) while still being beefy enough to do most anything. And at $3 a pop (non-bulk), they don't break the bank.

That said, most of the steps are applicable across the AVR family, so you'll be able to re-use most everything when your programming needs outgrow the ATtiny and you reach for the $8-$12 ATmegas.



Update Aug 24, 2007: I've gone USB! It's neither ghetto nor particularly deluxe, but a nice middle ground. If you've got a computer without a parallel port, check this http://www.instructibles.com/id/EDRQZ56F5LD8KDX/ out.

If you've got a parallel port, or are just feeling cheap, read on!


 
Remove these adsRemove these ads by Signing Up
 

Step 1Go Order Parts!

Go Order Parts!
Necessary Parts List (stuff to buy or scrounge):
Atmel ATtiny2313 chip:       $2.50 - $3Socket for chip:             $1Parallel port connector (DB25):       $3 at Radio Shack or $0.95 at SparkfunHeader Pins:                 $1-$2                (at least one strip each male & female, maybe 2 female)Some LEDs and resistors:     $1

= Around $10, even if you go deluxe. Half that if you can find an old parallel port cable.

Add-ons

A pushbutton switch or two: $1.
A piezo speaker: $1-$5
Light sensitive photocells: $2-$6
Breadboard for making complex circuits: $8-$10(?)

Other Stuff You Oughta Have

Computer: The older the better because it needs a parallel port.
Hookup wire, solder, soldering iron
Super-duper glue
Source of ~5v DC: Batteries will work, and old computer power supplies are perfect.

I get a lot of stuff from Sparkfun because they're
fast, reliable, and fairly priced. They carry AVR chips (but seem to be out
of ATtiny13's at the moment). They've got everything on the "Necessary"
list in one place, nice website.

If you're gonna be ordering a lot of chips, you can get a deal from Digi-key or similar. For instance: ATtiny 2313 for $2.36 each. They've only got 27,853 more in stock, so order quick. (Make sure you get the DIP form-factor.)

Go order stuff now, and we can set up the software side while you wait.

The waiting is the hardest part.

« Previous StepDownload PDFView All StepsNext Step »
367 comments
1-40 of 367next »
Dec 4, 2011. 3:37 AMlbachschwell says:
Can you please post a makefile for mac?
Oct 1, 2011. 4:00 AMcrjeea says:
seeing thoughs LED's with resistors soldered to them I was just thinking wouldn't it be lovely if they were sold like that (:
An LED with presoldered 1K resistor... or even a resistor built in to the LED it's self... extra just an idea
Oct 22, 2011. 2:20 PMEirinn says:
Well... depending on the voltage you supply to the LED you'll need different resistors. That's why they don't come integrated with a resistor :)
Oct 23, 2011. 7:54 AMcrjeea says:
Maybe a kind of zena LED might be a more useful idea.
I have seen LED's that can flash, think I would also like to see LED's that have pwm built in based on voltage so they can be dimmed with only two pins. Or maybe tri colour LED's that cycle through thier colours according to voltage.
Aug 17, 2011. 11:12 PMkbchiew says:
Thank you. Abit confusing here.
In the picture above, you shown PIN1= Reset.
In the listing, PIN1= SCK. PIN11 = Reset.
Nov 26, 2009. 7:53 PMtwenglish1 says:
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x12 != 0x00
avrdude: verification error; content mismatch

avrdude done.  Thank you.

has anyone else had this problem?

Jul 22, 2011. 8:27 PMtester272001 says:
See the registry update I posted in the comments...
Jul 22, 2011. 10:27 PMtwenglish1 says:
Thanks for the help, but I am now using a USB programmer. I haven't had any problems yet
Dec 5, 2009. 12:00 PMtwenglish1 says:
thanks, i will try that, but its weird the power supply i am using was working fine before? any idea why all of a sudden?
Dec 5, 2009. 1:18 PMtwenglish1 says:
i tried adding the capacitor and i am still getting the same error, and all the connections are good
Dec 13, 2009. 4:47 PMpcairic says:
 Erase the chip before programming... Should do it.
Jul 22, 2011. 8:26 PMtester272001 says:
If you use the parallel programmer under Windows XP be sure to use the below registry hack to prevent windows from interruping your programming signals.

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Parport\Parameters]
"DisableWarmPoll"=dword:00000001

Paste the above into Notepad and saveas dapa.reg
then right click MERGE intos registy. Will save you lots of problems with using parallel ports under windows with AVRDUDE for instance.
Jun 30, 2011. 2:32 PMfostersfriend says:
please define your pin outs in the pictures and define better in board thks
Jul 1, 2011. 4:42 PMfostersfriend says:
Just label all the out puts on all the pictures
Jun 17, 2011. 2:21 AMrobot1398 says:
can you tell how did you connect it to the 8 pin socket
Jun 11, 2011. 3:07 PMjld1 says:
I've downloaded the WinAVR just to try to play with C/C++. I don't have any uC right now but I plan to. I wrote a simple program using Programer's Notepad in C. I can't seem to compile the program? Please advise.

thanks
Joseph
May 12, 2011. 7:06 PMmatstermind says:
would you happen to have a schematic of parallel port pins to microcontroller? i find your current explanation a it confusing.
Apr 7, 2011. 9:08 AMshanakaplus says:
um looking for elevator avr program. Do you have example program ?
Nov 29, 2010. 6:04 PMlpciprian says:
OMG, I tried to make this for two weeks. I finally did it! I must say that my first mistake was that I didn't use an external source for Vcc. Second: I used a too long paraller cable. After I used a power source from one of my USB's and cutting my dapa cable to about 18 cm long (it was about 1,2 meters) I finally got a succesfull firmware flashing on my attiny2313...whew! Thank you The Real Elliot for your instructable!
Nov 17, 2010. 3:06 PMbonecrusher848 says:
What does this mean?

"A Direct AVR Parallel Access, or DAPA cable, is an incredibly simple and cheap programming method. You can build one very quickly for a few bucks worth of parts, but the convenience comes with a few gotchas. The first is that you must have a parallel port on your computer; something that modern laptop and some modern desktops don’t have. But if you’ve got an old PC around that has one this will get you up and programming in no time.

In fact, the first AVR prototyping I did was with one of these cables. That is, until I discovered another gotcha. This will only program low-speed chips. If you try to run the chip’s clock at full speed (by changing fuse settings… more in Part 3) you won’t be able to use a DAPA cable to talk to it any longer. There’s also the possibility of damaging your parallel port or worse if you do something wrong. But if you want to go for it anyway, here’s how I built mine"

I got this info from here: http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/
Does this mean that if i modify the speed of the internal oscillator at the first programming, the programmer won't program the chip anymore?
Oct 25, 2010. 6:47 AMbeehard44 says:
i head you can burn a bootup code on an ATmega and use it as a standalone arduino
Oct 8, 2010. 6:41 PMaboutyxm2005 says:
It's pretty hard to fry them. I bet the chip is fine. Anyway, I learnt much from your essay. And I think that some IC components can be find on ChinaICMart.
Aug 17, 2010. 1:18 AMFunnymonk says:
Hello I think I've followed all of your instructions to the letter but there is no Make prgram button in tools for me. How do I fix this?
Mar 10, 2010. 10:20 PMbha123 says:
 guys where can i find these micro controller and ics actually i am IT student but for my project i need them can any body suggest where can i get them

Jun 20, 2010. 7:53 AMSimpson_jr says:
Ebay...
Jun 14, 2010. 11:51 AMusman_the_great says:
is this parralell connector work for picaxe to connect it with pc
Apr 30, 2010. 8:01 PMcdousley says:
will this program attiny13
May 12, 2010. 2:33 PMcdousley says:
Thanks for the help all i need now is the ic socket
May 5, 2010. 6:54 PMelbriga says:
HI!

I think I just 'fried' 2 attiny2313 :(

The only thing not quite equal from your instructable is that my led has the resistor (330r) on the + pin of the led, so i connected the ground pin of the led to ground and the other + resistor to PD4, then the avrdude stoped working, not recognizing the chip anymore...

What could have 'fried' my AVR????
May 4, 2010. 6:12 AMsuyog14 says:
thnks for detail description but I hav to interface it wid  PIC18F4550.
Can u please fwd ckt dig+c/hex file on suyog.mahajan14@gmail.com?
Apr 12, 2010. 1:12 PMYakumo says:
thanks for this Instructable, haven't done all of it but it was a great help making my own cradle :)

@brooklynlord
while programming getting 5V from the USB-Port is the most direct approach so I think you are talking about the running project.
well i only used atmega 168 till now but I think other chips work pretty much the same. You can power the chip with lower than 5V the only disadvantage is you can't run it at the same speed (less MHz). look at the datasheet of your processor.
Mar 10, 2010. 10:22 PMbha123 says:
 sorry to specify in banglore ,india where can i find these components
Mar 23, 2010. 6:50 AMcdousley says:
allelectronics.com
ebay
Mar 21, 2010. 1:12 PMcdousley says:
could i use this for an attiny 13
Feb 19, 2010. 8:22 PMbrooklynlord says:
Can you use 4.5V instead of 5V?
1-40 of 367next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
90
Followers
7
Author:The Real Elliot