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]!

Comments

  1. John Boxall says:

    Freaking awesome! Will try this on the weekend :)

  2. Eirinn says:

    YES FINALY!

    I’ve been waiting for a post like this! I hope the system is reliable :D

  3. Markus Gritsch says:

    Arduino-Tiny would also be worth a look and on its homepage it mentions several other alternatives listing the MIT developed core files as being one of those:

    http://code.google.com/p/arduino-tiny/

  4. Akoi Meexx says:

    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?

    • Eirinn says:

      It’s easy to use.

    • adnbr says:

      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.

    • Daid says:

      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.

      • fred says:

        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. :)

      • Daid says:

        The SD card arduino library is based on the AVR library. The serial port is so simple (and made complex by the arduino library) that you don’t really need much of a library.

      • my2c says:

        “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?

      • DanJ says:

        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.

      • fred says:

        @Diad

        “made complex by the arduino library”

        Arduino library:
        Serial.begin(9600);
        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) {};

      • Bill says:

        DanJ,

        +1

        Regards,
        Bill

      • N0LKK says:

        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.

      • N0LKK says:

        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.

      • Eirinn says:

        HaD published a post for people like you not long ago – you should read it. It’s called something like “Why the arduino won and how we can beat it”.

        I hope it upgrades how you look at things.

      • Ed says:

        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

    • nsnick says:

      Because the Arduino IDE works with Mac OS and AVRStudio does not.

  5. Beat707 says:

    Oh please, this is sooo old news, also, his files are totally crap, the link above posted by Markus is MUCH MUCH better… Below I re-post just so people see it.

    http://code.google.com/p/arduino-tiny/

    Here’s a project using the ATtiny and with all files in an easy way to setup, using the files from the link above.

    https://github.com/Beat707/Beat707-BigTime

  6. Bogdan says:

    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.

  7. So glad to see this. I’ve been hoping for a long time for a way to do use Arduino code and the IDE to program these smaller chips. I’m off to order the chips now!

  8. Thatcher says:

    Hey, Hackaday! Thanks for featuring me! However, the link that says: “his blog” links to the MIT page instead. I think the real URL is

    http://toasterbotics.blogspot.com/2011/08/programming-attiny85-arduino-style.html

    thanks again!

  9. jc says:

    or.. you know.. just write in C with avr-libc or assembly

  10. slick_rick says:

    My last excuse for not trying it is gone I suppose.

  11. adam says:

    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

  12. Thatcher says:

    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.

  13. Richard says:

    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?

  14. peet says:

    hi,

    i dont own any arduino hardware but an atmel stk500.
    I want to use it to programm the sketches into my attiny85 on the stk500.

    does this work?

    • Thatcher says:

      Probably. When you’re programming it, the board menu has an option for “ATTiny85/45 w/ STK500.” Try it!

      • peet says:

        thanks. i manipulated the boards.txt file to the following:
        attiny85.name=ATtiny85 (w/ STK500)
        attiny85.upload.using=arduino:avrisp

        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?

  15. Thatcher says:

    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.

  16. 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: http://flytron.com/open-source-hardwares/162-tinyshield-all-in-one-avr-programmer-shield-for-arduino.html

  17. brokeboy says:

    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.

  18. SeeJay says:

    LOL! What a useless thread. For anyone, included engineers and non-engineers alike.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

Join 92,308 other followers