ATTiny Hacks: Run Your Arduino Project On An ATTiny!

Yup. We have all been there. You throw together a really elaborate Arduino project that only really needs a couple pins, far fewer than the Arduino’s native microcontrollers have to offer. Well fear not, [Thatcher] has solved just this problem by adding some ATTtiny cores to the Arduino IDE. His blog details the process from grabbing the MIT developed core files and loading them up in your Arduino software directories. The modification looks simple and although [Thatcher] shows the whole process on a Mac it only involves unzipping and tossing files into a folder. With ATTiny chips only a few bucks each this is perfect for those simple software driven hacks that don’t require an entire Uno duct taped to the outside of an enclosure.  Nice work [Thatcher]!

45 thoughts on “ATTiny Hacks: Run Your Arduino Project On An ATTiny!

    1. Also it doesn’t look like he didn’t include the cap you’re normally told to use in ISP configuration… I guess it isn’t strictly necessary. But if you have problems, look into that.

  1. I just finished my first microcontroller project. Attiny13 RGB controller with software pwm.

    After finishing the hardware equivalent of a hello world program, I can’t see why you’d bother with an Arduino unless you’re doing rapid prototyping that you’ll 100% be replacing. What’s the point of using the IDE?

    1. Maybe you are a newcomer artist that wants to make several small devices but doesn’t want to relinquish the impressive support structure the Arduino community provides?

      Because let’s face it, if you have no idea what you are doing and you look at an AVR C program it can be very daunting, what with all the bit math involved.

      Arduino simplifies that, allowing those without the knowledge to get things done quickly, and this (and other similar projects) allows things to get done quickly without the expense of an entire Arduino board sitting in your end product.

    2. Arduino is for the people who don’t understand electronics, and don’t understand programming.

      It has a place, for tinkerers, but a real engineer shouldn’t be using the arduino libraries. The bootloader and IDE can be useful.

      1. come on… “a real engineer shouldn’t…”.

        What if a real engineer needs to get data from a GPS for a simple project? Should that real engineer spend days writing their own code to talk to the GPS or just use the code out there and get it done in minutes?

        What if a real engineer needs to write to an SD card once in a while? Again, you can spend weeks writing the code to create the FAT filesystem or, in a few minutes, use libraries that are already there.

        If you refuse to use all the tools in your toolbox, you aren’t a real engineer.

        The Arduino libraries are tools that can be used if you understand the limitations. I guess “real engineers” can’t understand that. :)

      2. “Arduino is for the people who don’t understand electronics, and don’t understand programming.” – I would strongly disagree with that. “Primarily for tinkering”, I could somewhat agree with though. I am a full-time software developer, and at least ‘medium’ EE knowledge, and Arduino is usually my weapon of choice. With the vast libraries available, I would still argue it is a good choice if you don’t have hours to spend on a project. Even IR recv/trans/learning, or X10 send and recv, I would never get the time to play with if I was doing them from scratch, but when you can dump in a library and go it makes many projects/ideas that would normally fall into the “I don’t have enough time to justify trying it or making it” category viable projects.
        I have done programs in C and assembly, and they definitely have their places, but why do things the hard way when you don’t need to?

      3. I’m a real engineer and I use Arduinos on occasion. Like Fred said, a good engineer uses the appropriate tool from his toolbox. For me, Arduinos are useful in following scenarios:

        1. Devices such as manufacturing test fixtures, test bed controllers, custom instruments and other one or few-off devices where the device itself isn’t the end goal and development time is important.

        2. A platform for quickly doing experimentation with.

        3. A vehicle for sharing ideas with a larger audience whose firmware development capabilities and environments are unknown.

        It’s useful to be able to just grab a board, quickly wire it to something and start throwing together code without having to worry about putting together a build environment. It’s helpful to be able to quickly find a useful library and not have to futz with it because it was built for a common platform. I understand that I could use my own compiler/library build chain and I do that for other processors. For me the Arduino is simply an expeditious way to express a certain class of ideas.

      4. @Diad

        “made complex by the arduino library”

        Arduino library:
        Serial.println(“Hello Computer”);

        Non Arduino library:
        UCSRB |= (1 << RXEN) | (1 << TXEN);
        UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 <> 8);
        UBRRL = BaudValue;

        UDR = ByteToSend;
        while ((UCSRA & (1 << TXC)) == 0) {};

      5. I know enough about electronics, to understand there is a lot more that I don’t know,and the same can be said about programming. I have yet to use the Arduino or any microprocessor in a from scratch project, because I have yet to think of a useful to me project that requires microprocessor to do what I want to do. Perhaps if I where to work with them is some fashion the light bulb would turn on more, but the pocket has a limited amount of cash. In the mean time I study articles as this as they come along. No doubt the Arduino can strengthen a persons understanding of some programming, but I’m doubtful it will also strengthen their knowledge of electricity, and electronics, but a whole lot depends on the individual.

      6. In catching up on my reading of past QST issues, I read an article where a Canadian club had a workshop with the PICAXE, and it was a somewhat recent article. RS decision to carry the Parallax line isn’t likely to bring many to working with microprocessors. I doubt if any local brick, and mortar chain can offer microprocessor item inexpensive enough to coax many to try them, no matter what line(s) they carry. The more popular the line the more difficult it will be to match online prices.

      7. Yes and push button TV remotes are for people who do not understand how to tune a variable capacitor.
        Just like cellphones are for people who don’t know how to communicate with smoke signals

  2. I don’t know how the prices are globally, but the distributors that i buy from have the attiny45 more expensive than an atmega88a. So, unless size is an issue, it should be cheaper to use an atmega88a than a tiny 45.
    As a hobbyist and student on a budget, i prefer to buy 10-20 atmega8/88 at once which would cover most of my needs than 5 tinys and 5 atmegas.

  3. I’m and engineering senior and last year my professor hired me for a project involving GPS, I told the professor that we could do it with Arduino, Atmel, Pic,or HC12. I told him that there was a preexisting arduino library that handled NMEA statments he told me to use it and not “re-invent the wheel” I’m perfectly comfortable working with Atmel and HC12, I did my senior project with an attiny85, but using the arduino to handle the GPS really speed up the development.

    My professor wanted to write the final code for the project, so i gave him all the code i had written and he had a final version ready in about a week.

    He now has me redesigning the freshman projects (simple line following robots) to use the arduino instead of a Basicstamp. They have been using the Basicstamps for years because they were easy for beginners to pick up, our programming class and our microcontroller class are both C based classes, and he wants to switch to the C based Arduino. He thinks it will help make for an easier transition, plus the arduino board is a lot cheaper the the Basicstamp kits that they currently use.

    Now should engineers use it in products that are going to be mass-produced? NO. Is the Arduino IDE perfect for prototyping? YES you can easily get things working and in most cases you know that its working correctly and any problems are not your code, especially with new sensors or other new modules.

    I actually just made an attiny85 programming shield the other day so that i can make some props for halloween, once i figure out exactly what i want to do with them i’ll be able to write the code in less then 30 minutes.

    tl;dr my point is yes the arduino is good for beginners, its also good for rapid development, as an engineer you should be open minded about things that can help you, and not reject it is perceived as a beginners tool, but you also shouldn’t think that the arduino is the ultimate in microcontrollers, you can do a lot more outside of the Arduino IDE, especially if you learn Assembly the amount of control is amazing but the development time is much greater

    sorry for the long rant

    1. Hi Adam, I’m working on a similar project which involves sending data from a dht22 sensor which is connected to a attiny85 and the transceiver in use is hc12 module. Any assistance in programming the attiny85 to receive adata nad transmit it would be highly appreciated.

  4. Remember, I’m just a freshman in high school so don’t go hating over the fact that the cores I chose to use maybe aren’t the best. I have to agree with the people who say Arduino is the “rapid” solution for a lot of stuff.

  5. This is great, Ive been using it for a few months now. Simple applications like making a quadrature decoder takes a hour from starting to program it to having it built. Whats the point of pissing round with the more complicated compilers when you dont have to?

      1. thanks. i manipulated the boards.txt file to the following: (w/ STK500)

        will this let me ue the stk500 to programm the arduino?
        i dont need and want the bootloader on the tiny since my stk500 can isp it, right?

  6. I’m not sure. You may have to change “arduino:avrisp” to what ever you would use as the programmer option in avrdude. Experiment! You are exactly right about the no need for a bootloader. Most people seem not to get that.

  7. Based on the popularity of the subject of programming ATtiny processors with Arduino as ISP, I have designed a shield that can be used with most, if not all, Arduino’s. I worked with Flytron to make my shield even better and now it’s an all-in-one programming shield. It can emulate an STK500, burn bootloaders to various ATmega processors and, of course, it can do what this article describes, program ATtiny processors. Have a look at it here:

  8. Get ready for a HUGE headache. Different operating systems, different Arduino models, tutorials using different stuff than you have, having to go into core file pages to make little tweaks that somebody on some forum said to make, different this, different that, all combine to make it more frustrating than it’s worth. For us uneducated artists the arduino doesn’t solve problems like this. Just invest in an actual programmer and be done with it.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.