Samstag, 9. März 2013

Arduino and ATtiny

Shrinkify arduino


An arduino is a nice piece of hardware and considerable cheap. But sometimes you need your projects to be smaller or cheaper. The shrinkify arduino project from m.I.t (link) is exactly the right thing for a blinking light example. An inexpensive ATtiny 45 (5 usable pins) or 84 (11 usable pins) is enough. They cost about 2 euro.
You don't even need to buy a programmer. A full size arduino can be used.


Arduino as In-System-Programmer (ISP)

There is a very good guide on how to set up your arduino as an ISP here.


Servos

Since the AtTiny doesn't have a 16 bit timer, which is necessary to generate a servo impulse, you need to use the software servo library.
Make sure you to call refresh() at the end of each update, or it won't work.


Problems that can occur

  • Wrong side. Make sure your chip is correctly aligned.
  • Defect cable or no contact. Make sure you test your connections. Don't forget to check your USB connection. The arduino is very picky about USB-cables and doesn't work with some cables, or suddenly refuses to use a previously working cable.
  • Baudrate not to 9600 in ISP and arduino Ide. Some chips require a lower baudrate. Make sure to change it to 9600 in the ISP code, and also in the programmers.txt located in \arduino-1.0.3\hardware\arduino
from
arduinoisp.speed=19200
to
arduinoisp.speed=9600
  • My code is running faster or slower. Most chips have a different clockspeed than the arduino, but you can change this easily by installing the right bootloader on your chip. You can do this in the arduino ide under Tools/Install bootloader. Make sure you have the right board and the right clock speed selected.


Extended Version: Programmer board for arduino (Uno)

If you want to programm your chips more than once, you should consider making a board for your arduino.


Luxury version

Just buy a TinyProgrammer :)