Monday, July 21, 2014

ATtiny85 Arduino part 1

I was inspired by the Paperduino Tiny project on Instructables and the Digispark board from Digistump to make my own Arduino board based on the Atmel ATtiny85 chip. The Paperduino project might be too hard for high school students with limited soldering and engineering experience but we can make our own circuit boards in the classroom.

I used the USBtinyISP AVR programmer to load the micronucleus boot loader onto a couple of ATtiny85 chips purchased from Abra Electronics.
NOTE: The High fuse should set to 0xdd. The instructions here indicate that burning with or without RSTDSBL can be tried but the chip burned with RSTDSBL (hfuse:w:0x5d:m) did not function afterwards and AVRDUDE (see below) does not recognize it any more.
AVRDUDE is a DOS based program that comes as a part of WINAVR. The DOS commands are rather long so I copied them into notepad and saved them as .bat files. To run the DOS command just put the .bat file into the same directory as the .hex file and type the name of the .bat file in from DOS in that directory. The complete command also needs to be modified to reflect the ASP used.
avrdude -c usbtiny -p t85 -U flash:w:micronucleus-1.06-upgrade.hex -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m
Here is the breadboarded Paperduino circuit.

The circuit board to the right contains the circuitry necessary to connect the USBTINY AVR to the ATtiny85 chip on the bottom half and a USB breakout at the top. USB sockets do not plug in to breadboards so some kind of adaptor was required.

I used Fritzing to lay out the circuit board. From Fritzing I export an etchable svg file which I bring into Corel Draw so that I can make the traces thicker and add text.

I like the way the Paperduino brings out the ATtiny85 pins to a female header so I did the same thing below the chip on my board. 22 gauge hookup wire can be used to connect to a breadboard.

The Digispark Arduino IDE package contains the driver installation. The red LED is on Digital pin 1 so the Blink program with the output set to pin 1 is all that is needed to verify operation. Change the Programmer to Digispark and the Board to Digispark (Tiny Core). You start with the board unplugged and after hitting Upload the IDE tells you to plug in the board. The breadboard version worked once and the circuit board a couple of times. Most of the time I end up with a USB Not Recognized warning from Windows. The computer sees it as an unknown device. Despite this the code has loaded on three occasions. I suspect something is going on in Windows.

Despite having problems with the Windows driver it did work a couple of times and my red LED is happily blinking away as I write this. I think of Blink as a kind of Hello World on my own home-made ATtiny85 based Arduino board. Nice!

No comments:

Post a Comment