Programming an ATtiny using an Arduino


[Scott] is a big fan of the Arduino platform, and he’s not afraid to admit it. It does all the things he needs, but now and again he would like to use something a bit smaller, without all the bells and whistles the Arduino has to offer. He contemplated using an ATtiny for smaller projects, but after looking into what he would need to program the chip under Linux, he could never find the motivation to give it a go.

That all changed when he discovered the Arduino-Tiny project, which aims to bring a limited Arduino IDE to the ATtiny line of microcontrollers. He found the project to be quite useful, so he put together a brief tutorial that walks through everything you need to get started.

The tutorial is fairly straightforward, and even demonstrates how the Arduino can be used as an ISP for the ATtiny, removing the need to purchase a standalone programmer. Be sure to check it out if you are searching for an easy way to get started with ATtiny chips under Linux.


  1. Monty Werthington says:

    Nice, a genuine move to enhance the usability of the ATiny chip for the less experienced hacker, reducing the skills required may result in slower execution should be seen as a step in the right direction.

  2. kernelcode says:

    Correct me if I’m wrong, but the Arduino IDE uses avr-gcc, avr-libc and avrdude, and the Arduino itself can be used as a programmer (
    Lazy much?

  3. aggaz says:

    Interesting. I want to use a little microcontroller but I don’t work in the electronics field and I have not time to learn another platform/language, so I think that this could be very usefull for me and for people like me.
    Surely this is not the best solution in terms of performance but is nice to have the possibility to use this stuff.

  4. FuzzyOne says:

    I’ve been using this technique for the past month, works really well.

    Don’t forget if your arduino has auto reset to stick a 120ohm resistor on the reset line

  5. Kuy says:

    I’m baffled – [Scott] claims that programming an ATtiny the normal way would “require either expensive compilers or hard to use C or Assembler” – how are AVR-gcc and avrdude expensive? And how is coding in C any different than coding in the Arduino’s Wiring language (which is C++)?

    Maybe the right solution here is for someone to extend the Arduino IDE to compile and flash straight C[++] to any AVR via avrdude-supported hardware..?

    For all the good the Arduino has done I’m pretty convinced it’s created a fair amount of harm by fostering ignorance :-(

  6. Beat707 says:

    Perfect! :-)

  7. Anonymous says:

    “Hard to use C or Assembler”? Arduino is a bunch of macros (and libraries) for C anyhow.
    Expensive? AVR-GCC is right in the repositories!
    The only gripe I have with AVR development on Linux is that I could never get AVR Studio’s simulator to work under WINE.

    Who hasn’t programmed their Arduino in assembler?

  8. Anonymous says:

    Isn’t this what wiring is for? So basically it’s wiring ported to ATtiny?

  9. Reggie says:

    It’s great giving access to different chips with avr-tiny but does anyone else think the time seems to be somewhat wasted when there seem to be 5 or 6 projects all servicing the same chips? seems to support the most in case anyone cares, the MIT stuff I know works too.

  10. Jonas Dourado says:

    I’ve been programming avr tiny this way for a long time.
    I use an AVR plugin for Eclipse( and it works well. The main problem is configuring the avrdude, but some googling solves ;)
    Disabling reset and using internal oscillator gives 6 io, with PWM and ADC, enough for several projects!

  11. trialex says:

    @aggaz – great comment.

    I’m exactly the same – arduino lowered the entry barriers enough for me to get into the microcontroller world. Extending the environment, and more importantly the language to other devices is awesome.

  12. Neasi says:
  13. CMJ says:

    I’m all for an Arduino as a prototyping platform for throwing quick and dirty ideas together, but when it comes down to implementing these ideas I think they should be thought out and executed in a fashion that isn’t laden with macro’s and dummy functions. The point of a small uC is simplicity and space constraints, why not take that mentality to the code itself?

  14. kernelcode says:

    As Kuy said, “For all the good the Arduino has done I’m pretty convinced it’s created a fair amount of harm by fostering ignorance :-(”

    The ‘language’ is C/C++, Arduino merely has some useful libraries. All a language is, is syntax. If you can write Arduino sketches you can write C! You should have a bash, I don’t reckon you’ll find it as hard as you think and you will definitely learn a valuable skill on the way :)

  15. trialex says:

    @kernelcode – I agree that learning the “full” c language would mean I would be a better coder, and be able to do more, but the arduino syntax just makes it so much easier! Compare the code to change a digital pin – I’d rather type Serial.print(); than the equivalent C code everytime – and at 9600bps who cares if it takes and extra clock cycle or two?

    I totally DISAGREE that it is “ignorance” on my part. The arduino syntax allows me to do what I want with my projects, I’m not ignorant that there is more out there that I could do. Similarly I know basic geometry, but I don’t need to understand fourier transforms for what I do day to day. I know it’s out there though, I could look it up, learn about it and use it if I needed to.

  16. therian says:

    there is ignorance on you part. Most people can buils some kind of moving cart on wheels with motor, you can call it a car and it will work but we have to ignore efficiency and possability ithat t will blow up. Same here, the fact that it work for you doe not remove ignorance on subject

  17. therian says:

    I hate touch keyboard

  18. grid says:

    I’m all for people doing what they want, and if they want to use arduino, fine. But seriously on ubuntu, it took me about all of 5 minutes to get Eclipse w/ AVR plugin and avr-gcc and avr-libc installed using Ubuntu Software Center. It’s actually faster and easier than on windows. avrdude is much clunkier than the nice programmer utility built into avr studio though.

    And how do you ISP an attiny if you disable the reset line?

  19. kernelcode says:

    @grid – You can’t without a high-voltage programmer :(

    @trialex – I can see that, I guess we have different mentalities. For me, it appealed more to write my own USART library – good fun, educational, and can be built to exacting specifications. In any project where you would want to use ‘Serial.print()’ I use

    #include “../usart/usart.h”

    usart_send(“Hello!”, 6)

  20. aggaz says:

    I think you are basically right, there is ignorance, but your example is just too extreme.
    Please consider that we are not working with something dangerous that can blow up and that it is really a nice thing to be able to blink a led without having to known all the semiconductor’s physics. It seems to me that people here would like to have some kind of selection on who can blink leds, and I am not sure that this is a good thing.
    After my first blink, in my spare time I studied and learned a lot of things, and this actually is a decrease in ignorance, even if I am not an engineer and I will never be.

  21. rsa says:

    Good to know that there are options but claiming that setting up AVR programming in Linux is hard is a bit of a stretch. I, having close to zero EE experience:

    1. bought the TinyISP
    2. read this:
    3. soldered my own target board for tiny2313 (later I did another one including a rs232 serial port).
    4. Installed the avr-gcc and skimmed through some examples
    5. Did some small programs using a text editor and command line tools (avr-gcc, make, avrdude..)
    6. And later found the AVR eclipse plugin, which is nice.

    Overall, I consider starting AVR programming in Linux an easy and straightforward task especially when there are masses of tools, documents and information around.

  22. cctsurf says:

    I have to disagree with the ideas of some who say that it is ignorance to want to use an easy method to program devices. I have an ee degree, I have made silicon chips, I have programmed in a number of languages, and I use gentoo on my desktop, however, I find it much more user friendly to use the arduino interface and ide than to start from scratch using another system. I am glad when things are made simple for the average user, it used to be said, that a rising tide raises all boats. I am not interested in programming my own usart library, there are perfectly good ones out there. The more people we get working with these microcontrollers, the more will dig deeper and learn the more basic languages, but the more we are purist about them, and say that lfs is the only linux, or that hardcore programming is the only way to program, the more we kill interest in them.

  23. broken_bazooka says:

    The problem with Arduino is the huge amount of assumptions made, and new “concepts” introduced, just about all of them could have easily been avoided.

    * The weird pin numbering.
    * Why call C source code sketches? just confusing.
    * 16MHz crystal assumed and currently very hard to change
    * Many libs assume certain peripherals on certain IO-pins, you mostly need to dig into some lib header file to change these

    There are simple solutions:
    1. Since these so called sketch files are heavily preprocessed anyway, why not just have a macro which defines a clockrate, and changes all affected code?
    2. Same for pins, any lib which is for a hardware peripheral, should *always* be pin-configurable directly from your source code, you shouldn’t need to edit the library.
    3. There could be a preprocessing step which reads fuse-settings from a macro in your sketch.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s