ATtiny Basics

by gremlin88 | March 13, 2015 | (11) Posted in How To

The ATtiny boards are a great little chips. They're like Arduino boards, only really small. The reason I am making this article is because I will have a bunch of LED light controller totorials coming out that will be built with these controllers. This article will teach you how to program an ATtiny using one of two methods: the TinyProgrammer method, and the Arduino method.

ATtiny boards

There are a lot of boards in the ATtiny family. These are the most common.

The ATtiny45 and 85.

These chips are 8 pin DIP (dual inline pin) chips The ATtiny45 is an 8-bit AVR Microcontroller with 4KB of flash.

The ATtiny85 is the same but with 8KB of flash.

An ATtiny85

The ATtiny44 and 84

These chips are 14 pin DIP (dual inline pin) chips The ATtiny 44 is an 8-bit AVR Microcontroller with 4KB of flash.

The ATtiny84 is the same but with 8KB of flash.

There are low-power versions of each, called the ATtiny44A and ATtiny84A respectively.

The ATtiny84

Others

There are numerous other small microcontrollers that Atmel offers which you can find here.

Getting Ready

To get started, you are going to need the Arduino IDE. I recommend the newest version available here.

You can also follow the tutorial here for programming.

Now we will need to install the ATtiny drivers. Download the zip folder from this page. Extract the folder into the default location. find the folder called arduino 1.6.x in Program Files (x86). There should be a folder called "hardware" inside. From the unzipped folder you downloaded, copy the folder called "attiny" into the "hardware" folder. When you open the Arduino IDE, you should see an entry under the Tools -> Board menu called ATtiny.

We're not done quite yet. Now that you have selected the ATtiny entry, there is some more setup needed. Now that you have selected the ATtiny entry, you should now see the Clock and Processor menus in the tools menu. Select the clock you are using (the default on the board is the internal 1MHz clock), and select the chip you are using in the Processor menu.

Uploading

The TinyProgrammer Method

The TinyProgrammer is a small board used specifically to program the 8 pin DIP microcontrollers. It is a simple USB dongle available here for $20. If you have Windows, you will need the drivers from this page. Under the Tools -> Programmer menu, select the "USBtinyISP" option. Now, simply plug in the chip like in the picture below, plug the programmer into your computer, and upload your code.

The Arduino Method

If you have an Arduino board, you can use it to program an ATtiny chip too. You will need an Arduino board, your ATtiny chip, a 10uF capacitor, a breadboard, and some jumper wires. Now, we need to prepare your Arduino for uploading the sketch. Open the File -> Examples menu and open the sketch "ArduinoISP" sketch. Upload it to the Arduino. Now, using the ATtiny pinout below, connect the Arduino pins to the ATtiny pins with the breadboard. (If you don't know how to use a breadboard, check out this easy tutorial.)

  • ATtiny pin 2 to Arduino pin 13
  • ATtiny pin 1 to Arduino pin 12
  • ATtiny pin 0 to Arduino pin 11
  • ATtiny pin RESET to Arduino pin 10
  • ATtiny pin 8 to Arduino 5v
  • ATtiny pin 4 to Arduino GND
  • Also, connect the capacitor between Arduino pin RESET and GND. Make sure to connect it in the right direction.

[Finished connections picture]

Now, open your code ,select all the board options, and upload!

Here is a picture of the pinouts of the rest of the common ATtiny boards.

I look forward to the rest of the tutorials I am going to make including an LED controller controlled with transmitter knobs, an LED controller with red, green, and blue controlled with seperate knobs, and adressable LED controllers. Be on the lookout for those tutorials. (They may take a while to come out with school and stuff. Maybe over the summer.)

COMMENTS

xhelilemon on March 15, 2015
Nice start Gremlin,, I also am intrigued by this post , I keep an eye out for your updates.
Log In to reply
HilldaFlyer on March 21, 2015
Looking forward to the next ones... more electronic tinkering...
Log In to reply
gremlin88 on March 16, 2015
Spring break is next week so I will hopefully finish my next article if I can get some parts.
Log In to reply
Amdaylight on March 16, 2015
Greetings,
Being a complete nube on the whole Arduino micro controller I am looking forward to this series of articles. Especially being able to turn things on and off with my transmitter. So far you explained every thing in terms that some one who does not have a degree in electronics can understand. Please keep up the good work.
Andre
Log In to reply
etegration on March 17, 2015
Any help on installing those dual inline pins? We broke something recently and need to replace what looks like the below link at Digikey http://www.digikey.sg/product-detail/en/0022152056/WM3003-ND/26503

It looks snapped off and there are parts of the remaining "legs"/ pins still on the PCB. Is it possible to buy the above from digikey, find a way to remove the broken off pins in the pcb and install the new one with manual soldering?

It looks like they could be machine installed with contacts that are on the pdb. Im also thinking of simply leave the broken pins that may have been embedded into the pcb, extend them with small guage wires (5 wires) then solder them to a new pin holder or directly into the cable i require.

Advices please?
Log In to reply
gremlin88 on March 25, 2015
you could probably desolder the pins and pull them out with tweezers or a solder vaccum: https://www.sparkfun.com/products/13203 Adding a cable is a good idea, maybe solder them directly to the pads on the back of the PCB.
Log In to reply
onelesseye on March 16, 2015
Adafruit has a great ready made board using the attiny 85 called the trinket. It comes with a bootloader installed, leaving you with just over 5 k to work with. In a pretty small package for 8 bucks. Works pretty well for leds and even moving a servo. Seems easier that burning your own.
Log In to reply
gremlin88 on March 16, 2015
I have seen that. It seems kind of like an arduino pro mini or micro, but even smaller.
Log In to reply
HarleyRev on March 15, 2015
very interesting,a little over my head atm, but my interest on this subject has been tweaked since getting into the RC hobby. I look forward to your future articles. Thanks
Log In to reply

You need to log-in to comment on articles.


ATtiny Basics