Getting started with ubuntu and the AVR dragon

Picture of Getting started with ubuntu and the AVR dragon
Here's what i did to get started using the AVR Dragon to program ATMEGA8 microcontrollers using ubuntu (This is aimed at beginners, I myself am also being a beginner, so any improvements from more experienced users are greatly appreciated).

After finally switching my laptop and computer over to ubuntu permanently, i found no software that would support my PIC microcontroller programmer and after a few vauge and useless attempts to reverse engineer it (i'm really not that good at electronics, i wake up in the night wondering why i'm not doing a degree to become a tree surgeon), i finally thought "sod it" and splashed out a bit of my student loan on an AVR Dragon after seeing there was an open source c compiler for AVR microcontrollers and supporting programming software, also there's some absolutely wicked projects people have done with them.

It then promptly got discarded in my box of bits for a couple of months (i like to think it was laying dormant in its lair......its a dragon, get the pun?)

so anyways, here's how i got it working, this will probably work with most flavours of ubuntu that use synaptic (you can probably do it on any version of linux if you compile it from source and whatnot, i like synaptic because its easy) and its more a collection of information from various sources, but should hopefully get you up and running!

I realise there are other instructables for getting started with avr microcontrollers, but i couldn't find anything that applied to my situation, so i hope this is at least a bit of help to somebody.
Remove these adsRemove these ads by Signing Up
collard415 years ago
wouldnt it be alot easier to use windows (like normal people) and use AVR studio 4. after all it was desgned for that.

anyway JTAG is like an emulator for PIC but it is in the chip. you connect the corresponding ports on the chip and then enable the JTAG in the programming and then using AVR studio you can view the states of the file, working and EEPROM registers as it advances through the program. this would help with debugging.

and also, dont you find Assembly code easier to write in, maybe its because i learnt it in assembly code.

if you want to learn more about AVR or PIC programming buy these books, they are fantastic, if you are interested you can learn it in a week! here are the links to amazon AVR and for PIC

Note: Written by same author. PIC book written when he was 16 and AVR book was written while at University at the age of 19
>"wouldnt it be alot easier to use windows (like normal people) "

Is that a troll?

You do realize this community seems strongly open source, and you just don't get that in a Windows community. Windows doesn't even do anything until you spend a whole lot more buying shareware.

Besides, not all of us are so rich that we like buying new scanners and printers every time a new version of the OS comes out (can't tell you how many times I had to do that before I said enough was enough, no more Windows,).
gmoon6 years ago
It's nice to know that avrdude now works with USB in Linux (I've got a Dragon just sitting around, next to an unused STK500...) But I normally just use my $5 parport DAPA cable on a breadboard with Xubuntu. (We don't need no sinkin' dedicated programming boards...)
pfred2 gmoon3 years ago
Yeah USB is icky for hacking!
}{itch (author)  gmoon6 years ago
On reflection parport was probably the way to go. i didnt know so much about AVR's when i got the dragon (had mainly been using PIC's). kinda of glad i got it now though, means i can use it on my laptop (doesn't have a parallel port). but still, it took a bit of effort to get it up and running.
gmoon }{itch6 years ago
That's a crucial point: my current desktop doesn't have a parport, either. And yours is the first demo (explicit, with photos) I've seen of using the ISP from the Dragon on an external board, AND making it work with Linux. So good job.
}{itch (author)  gmoon6 years ago
cheers :) whatever happened to the good old days of the parallel port? i remember writing Qbasic code on an IBM 100 to control a homemade drum plotter through the parallel port......golden times.
ssokolow }{itch6 years ago
Unless you're using a specialized kernel driver, you should probably be able to do whatever you need with a USB-to-parport adaptor. I haven't needed one, but I did notice that there's at least one driver for them on Linux while I was doing the usual `make menuconfig`.
geeklord5 years ago
Is this + this an easy way to get into AVRs?
}{itch (author)  geeklord5 years ago
That looks like a good start. The learning curve can be quite steep when first getting into micro-controller development but don't be discouraged! its well worth getting the basic principles down because you can build on them rapidly to produce some pretty awesome projects. If you need any further help feel free to PM me (I'll help as much as i can but can't promise to know everything) or check out the forums at (they are a fantastic bunch of people with a great wealth of knowledge and are generally fantastic at helping new people). Best of luck!
geeklord }{itch5 years ago
Thanks! I think I'm going to go with the USB programmer from atmel off of digikey for $35 instead of hunting for a computer with a parallel port. Are there any good AVR coding tutorials that you know of? Maybe one set up like the Arduino website's reference page, that one is handy.
pfred2 geeklord3 years ago
You can get really good parallel port cards for about $15. I personally wouldn't use a built in parallel port on a machine if I was connecting prototype electronics circuits I'd made to it anyways. $15 parallel port cards are easier to replace than computers! Though knock on wood I haven't blown one up yet myself.

The gray sub D cable is plugged into one in the picture. Then signals from my home brewed buffer are running one of the worst loads out there, an inductive stepper motor controller running at a couple of amps.

So as they say, it works here!
Kemo0o4 years ago
Good stuff .. But I see that running codevision under Wine is more easier BTW I'am going to give it a try
OuZo5 years ago
that code only compiles with avr-libc installed! sudo apt-get install avr-libc maybe you could edit this in on step 1
jonathanjo5 years ago
Thanks so much for the -B 10 note: I had exactly this problem, and couldn't work out what was going wrong.

This was the error message -- though the device signature would come back differently each time:

avrdude: Device signature = 0x3f00ff
avrdude: Expected signature for ATMEGA168 is 1E 94 06
Double check chip, or use -F to override this check.

NB: the wrong signature would always be runs of 1s and 0s, never completely random.

-B 10 fixed it straightaway.

Thanks again.
}{itch (author)  jonathanjo5 years ago
yhea, that -B 10 got me stumped for quite some time before i asked the kind people over at cheers for the vid! thats a great demo of what PWM does!
jonathanjo5 years ago
hi itch thanks for such clear help. attached is a video of the oscilloscope trace of the pulse-width changing. thanks again.
jaem6 years ago
For AVRs, the KontrollerLab ( ) IDE is quite nice. It's KDE-based, and comes packaged as i386 RPMs and DEBs.
}{itch, if you still have PICs lying around like me, check out There's programmer software there for the PICKit2, which is the cheapest "official" USB PIC programmer available from Microchip. Unfortunately, development has stalled, and the latest firmware for the programmer is only supported by the latest alpha of the software. It might be worth a try,though.
jaem jaem6 years ago
darn - missed the comment further down.
UltraMagnus6 years ago
There is also KontrollerLab, which is a GUI program for AVR
LinuxH4x0r6 years ago
Nice. I don't think i'll be doing pic anytime soon
Dang, looks difficult, but nice job.
}{itch (author)  GorillazMiko6 years ago
cheers :) its really not so hard once you've gone through it. and well worth it too be able to begin programming microcontrollers (although there probably are simpler ways.... like using windows, but i'm stubborn and like to stick to linux :D )