This page is still very much under
construction and I'll add more as I explore this tiny MCU...
would like to cover the following: [Updates to eventually follow]
• Installing a good working "core" in the Arduino
IDE which will make working with the Tiny (almost) as easy as an Uno.
• Setting up a programmer interface for the ATtiny.
• Building a programming 'shield' for the Uno.
• Building a Fuse Setter for the ATtiny and its
• Using an FTDI and 1 pin (using SendOnlySoftwareSerial) to
debug and talk to the Serial Monitor.
• Pitfalls and workarounds - including no UART and the Tiny's
noise in its ADC while switching I/O states.
• Improving code (low-level stuff) to gain the most space and speed.
• Example sketch, as well as powersaving/sleep features.
• Moving over to the newer UPDI ATtiny devices including breakout board solutions and programming options.
Most of the information I provide will be a compilation of
various sources online, including YouTube, plus my own example, and I felt that a one-stop
primer wouldn't hurt.
The ATtiny85 and is a small 8-pin AVR
microcontroller which is the much smaller cousin to the Arduino's
ATmega328p. The 'Tiny' comes with a lesser fraction of the
features of its larger cousin but is a perfect solution for the
majority of Arduino projects which tend to be smaller and simpler.
The ATtiny85 is part of a much larger family of AVR's. It
was released back in 2005 but because of its low price point and Maker
friendly 8-pin DIP(DIL) through-hole package, it is still in production
by Microchip today. There are still
large quantities available from vendors including Digi-Key despite
recent chip shortages, and is basically the go-to for DIY maker
options in 8-pin SOIC and 20-pad QFN/MLF.
An ATtiny ISP Programming Shield for the Arduino Uno
Instead of wiring up a solderless breadboard
project every time you need to program your Tiny, strap this on!
Shown here is a homebrew ISP Programming Shield prototype for the Arduino Uno.
This shield will allow for programming of ATtiny 8-pin
chips as well as external AVR devices via connector, and when detached from the host Uno, this shield becomes a breakout board to try out sketches.
[I'll be having a PCB version made by JLCPCB soon (Files Below) and I'll post pics and results here!]
Included is an 8-pin DIP socket for an ATtiny chip,
breakout female Dupont headers for each representative pin,
a 6-pin standard ISP (ICSP) header for programming of
other devices such as other Arduino boards, ATmega328p and etc.,
3 status indicator LED's for the Arduino as ISP sketch,
an external power supply header (5v) for running detatched from the Uno,
an LED connected via enable jumper to pin #3 for Blink
sketch verification and a header for choosing 3.3v and 5v operation. I'm considering a PCB design for JLCPCB for anyone interested to have made.
[Click on the schematic image above to download the .PDF.] . Here is a through-hole PCB version. [Untested as of this post] You can download the GERBER file HERE and use a service such as JLCPCB or PCBWay to make them for you for a few bucks a piece. . .. . ..
How to use this shield: Upload the "Arduino
as ISP" sketch from the Examples list in your Arduino IDE and attach
the shield pins to the correct Arduino header sockets. Where you
see "H3" on the top of the PCB is the pin that aligns into digital I/O
pin 7. The pin on the bottom left of the PCB is aligned with the
Arduino Vin pin. Place your 8-pin ATtiny into the IC socket (mind
the pin 1 orientation, etc.) and follow the established procedures for
either loading a sketch or a bootloader to device. [More
specifics will be written in time.]
Without an ATtiny IC installed, you can use the 6-pin ISP header
on this PCB to connect directly with any other Arduino/AVR device or
bare AVR IC on a breadboard via Dupont cables or a dedicated cable
(such as an ATmega328p). When operating, the Red LED will slowly
fade in and out like a heartbeat to indicate the Arduino as ISP sketch
is running. When Uploading your sketch [Using Programmer],
all the LED's will flash on their established timings to indicate
operation and the Blue LED will mainly indicate a successful
programming process. If the Yellow LED flashes primarily or stays lit,
then that is an indication of a damaged IC or a bad wiring connection!
[Hopefully not in this PCB, but check your wiring with a multi-meter.]
After programming, if you've uploaded the "Blink"
sketch with ATtiny pin 3 (PB3) set to blink an LED, the White LED (or
whatever color you wish) should indicate operation. You can try
reducing the input voltage to the ATtiny by moving the power jumper (on
the bottom left) from 5v to 3.3v and is a good way to test variances in
timing and such. DO NOT initiate a programming sequence with the
power set to 3.3v! It might not matter, but you will be
programming with 5 volt data lines on a 3.3v powered device.
ALSO, another thing to look out for is programming
a target device which is already under power. If it is not
running off the same power supply, this can cause a serious problem for
the programmer Arduino or target device.
With a programmed ATtiny, you can remove the shield from the
Arduino Uno and connect a 2v - 5.5v power supply up to the supplied
external power header pins (upper left of PCB) and run your ATtiny on
its own development board! The female header pins adjacent to the
IC are directly linked.
If there are
any errors in the PCB I apologize up front as I have not had any made
yet, it's not exactly easy to double check the traces either from the
files. Well, it will be good soldering practice for some of you
builders anyway. ;)
Will work for ATtiny13, ATtiny24, ATtiny44, ATtiny84, ATtiny25, ATtiny45 and ATtiny85
. Shown above: I built this project as an Arduino Uno shield and it works as advertised. The physical size of the capacitors is not crucial (and these were the only ones I had in stock.) .
Get control of your ATTiny's hidden settings, change your
Reset pin to I/O Pin 6 (and vice versa) and un-brick your chip with this useful Fuse Setter (with built-in 12 Volt charge pump supply) designed by Wayne Holder at Wayne's Tinkering Page.
This device is based on his ATTiny Fuse Reset project - Read the page at this link for overall instructions!...
NOTE: Building this project and implementing fuse
settings will require a bit of experience and a willingness to do a bit
of research first and is not recommended for newbies.
The Arduino pin designations are on the left in the
schematic. Schematic shows the target device as the ATtiny13 but
the setup will be the same for the other 8-pin
chips. For the 24, 44 and 84 series, you will have to reassign
the lines to the appropriate pin locations.
4) Upload sketch and just Enter anything in the input field on the Serial Monitor.
Serial Monitor should display the detected AVR chip model,
initial fuse settings and new settings for verification.
NOTE: BEFORE changing the Reset (PB5/IC pin 1)
feature to that of a 'weak' I/O (FHUSE45 0x5F,) remember to upload your
sketch FIRST as ISP programming will no longer be possible
until you reset the HFUSE45 back to 0xDF.
Bits are not set with this sketch - if anyone is able to add this
feature with some explanation, please contact me: firstname.lastname@example.org
You should try this out on a protoboard first and you can
verify the changing of the Reset/IO option on (pin 1) PB5 by running an
LED blink sketch on that pin. Building a shield for you Arduino
Uno R3 will make this a convenient process.
Copyright - Michael A. Maynard, a.k.a. K4ICY