Introduction: Attiny Serial Monitor Using Arduino Walkthrough

Allllllllllright dudes and dudets. Here is whats up, we're going to make attiny and arduino bestest of friends.

If you have ever worked with capacitive switches you know how much it makes you want to smash your face into a wall...Now imagine you have no way to monitor output, well that is what I was running into. Problem is you can never know what the output is with stock settings of an attiny. So my solution comes from the good boys/gals of MIT. However, It's not super clear on their walkthroughs so I thought I would provide a more in depth explanation.

Step 1: W-w-w-wire It Up

Lets set up a little basic “hello world” type example. Wire your arduino like the following:

1. Make sure you connect a 220Ω resistor between pin 2 and Tx(transmit) input of arduino. Resistors aren't directional so it doesn't matter which way you insert it.

2. Now put a 10uF capacitor between ground and reset with negative going to ground and positive to reset

If you do not do this, you could damage your board/attiny or make the universe implode. (refer to pictures above). SO SERIOUSLY, IF YOU MAKE THE UNIVERSE IMPLODE I WILL FIND YOU IN A PARALLEL DIMENSION AND PUSH YOU IN TO A DEEP PUDDLE OF WATER, AND YOU WILL HAVE TO WALK HOME WITH WET SOCKS.

Step 2: Burn Baby, Burn!

Next what we do is burn the bootloader. What this does, according to arduino guide, is burn a sort of firmware (correct me if this term is wrong) on the chip that allows us to compile code on it. here is an excerpt (Boring info alert: skip if you don’t care about details, just know you need a bootloader):

The items in this menu allow you to burn a bootloader onto the microcontroller on an Arduino board. This is not required for normal use of an Arduino board but is useful if you purchase a new ATmega microcontroller (which normally come without a bootloader). Ensure that you’ve selected the correct board from the Boards menu before burning the bootloader…When you upload a sketch, you’re using the Arduino bootloader, a small program that has been loaded on to the microcontroller on your board. It allows you to upload code without using any additional hardware. The bootloader is active for a few seconds when the board resets; then it starts whichever sketch was most recently uploaded to the microcontroller. The bootloader will blink the on-board (pin 13) LED when it starts (i.e. when the board resets).

But what if I haven’t installed attiny for arduino?! I’m freaking out maaaan.

Lo, and behold! If you do not have attiny85 (or other attiny) installed for arduino, it’s you’re lucky day! If you do, just skip to next step. Here is how to install:

Support for third-party hardware can be added to the hardware directory of your sketchbook directory. Platforms installed there may include board definitions (which appear in the board menu), core libraries, bootloaders, and programmer definitions. To install, create the hardware directory, then unzip the third-party platform into its own sub-directory. (Don’t use “arduino” as the sub-directory name or you’ll override the built-in Arduino platform.) To uninstall, simply delete its directory. —arduino website

Download latest version (choose the with arduino-tiny in title):
http://code.google.com/p/arduino-tiny/downloads/list

For example, my directory looked like:
/Users/[username here]/Documents/Arduino/hardware

Step 3:

choose your chip (ATtiny 84 (44/24), ATtiny 85 (45/25), ATtiny 2313 processor) in our case we have an attiny85. Remember we have to set at 8MHz because that is only speed the processor can use serial! 

lets start simple, some test code, brace yourself it's pretty tough:

https://gist.github.com/4477296

Once code is uploaded you are good to go. Open up your serial monitor and you should see the all the magicalness manifest in tangible ascii format. yeah mannn!

FIN!

checkout my website for more tutorials: http://hellowoo.com/blog
follow me on twitter: hilukasz.

Comments

author
alanflores7 (author)2017-05-03

Hi guys, I'm getting the following error:

avrdude: Yikes! Invalid device signature.

Double check connections and try again, or use -F to override

this check.

Error while burning bootloader.

How can I fix this? I checked the connections and everything is identical like to hilukasz pic. Any help will be greatly appreciated!

author
jman 31 (author)2016-04-03

I was looking over your tutorial here and I am confused about one thing. You show going to the TX (transmit) pin on the arduino. Aren't you sending info to the arduino from the attiny, in which case you should use the RX (receive) pin?

author
keaaw (author)jman 312017-03-24

From what I understand, no: this is an exception to the usual rule of "Tx to Rx and Rx to Tx". The tiny is not communicating with a sketch running on the uno, but instead the tiny is piggy-backing on top of the uno's Tx, passing its own Tx through the uno which leads back to the host system running the Arduino serial monitor. The uno is just lying there inert, letting the tiny use its Tx pin as it wishes. There must not be a "live" sketch (at least not one that uses Tx) on the uno or there could be contention for the pin, potentially damaging one or both parts.

author
keaaw (author)keaaw2017-03-24

Actually I must correct myself. In order to get the ATtiny to send through the Arduino's USB connection I had to connect the ATtiny's Tx signal to the Rx pin on the Arduino.

author
N.fletch (author)2013-03-20

I'm in a quiet office and the wet socks bit made me burst out laughing...

author
hilukasz (author)N.fletch2013-03-23

:)

author
OscarL1 (author)hilukasz2015-03-03

Hello everyone

I followed the tutorial to the letter and I can not communicate for the serial. The sckech of the Blink if it works. I've seen on other forums that have the same problem but I can not find a solution.

Please could you help me, I have long been trying to communicate the attiny by serial but am not able to.

Thank you

author
AnkushJ4 (author)OscarL12015-12-30

Were you able to make it work?

author
robot797 (author)2014-12-24

question

can the attiny be used as a serial debugger

i have a project in mind that needs that

so it goes arduino to attiny with lcd on shift register

author
sühab (author)2014-09-23

Burning the bootloader has saved my life! Thans so much, you're great!

author
renelm (author)2014-04-11

While your style of writing captures the audience and let us slip out a not-so-silent snicker, you elegantly skip the steps on how to actually program the Attiny.. even in the step where you talk about burning the bootloader on the 'tiny, the correct wiring isn't mentioned (I am assuming you are using ArduinoISP..?)

author
hilukasz (author)renelm2014-04-20

not sure what your question is. please read the entire tutorial. the first page shows the wiring.

author
renelm (author)hilukasz2014-04-20

I did and It's hard to program the Attiny or burn a bootloader through the TX-pin.. Nice drawing otherwise, but that's all good and fine for listening to what the Attiny is telling us..

author
electro18 (author)2013-07-26

In the diagram it shows 2nd pin but in the description it says 3rd pin , does it matter if pin 3 or pin 2 is connected?

author
hilukasz (author)electro182013-12-28

sorry this is a bit confusing. I should clarify this its analog input pin 3, but pin 2 on the diagram. so basically follow the picture :)

author
electro18 (author)hilukasz2013-12-29

Thanks ! :D

author
hilukasz (author)electro182013-12-28

side note: I have fixed this in the post to avoid confusion.

author
tigerbomb8 (author)2013-01-08

On the UNO there should be a 10 uF cap between reset and and ground.

author
Veda88 (author)tigerbomb82013-03-07

I don't know what was before in the instructable, but I always use a 120 ohm resistor between reset and 5v for my duemilanove. Works great.
Source: http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection

author
hilukasz (author)Veda882013-12-28

hmm, interesting. I've seen it done all sorts of ways. Some people just use a jumper even.

author
hilukasz (author)tigerbomb82013-01-08

ah, you're totally right. I was using a few sources for this. But MIT one also says 10 uF, so I will go with that. thanks for the catch.

author
vawi2003 (author)2013-10-27

I'm getting following errors:
tiny_debug.ino: In function ‘void setup()’:
tiny_debug.ino:2:2: error: ‘Serial’ was not declared in this scope
tiny_debug.ino: In function ‘void loop()’:
tiny_debug.ino:7:2: error: ‘Serial’ was not declared in this scope
tiny_debug.ino:8:10: error: ‘delay’ was not declared in this scop

author
hilukasz (author)vawi20032013-12-28

link me to a gist of your code please. can't do much without knowing what you have.

author
manu08 (author)2013-05-04

Hi, nice tut btw. Still I have some questions. Why are you setting attiny like that as oppose to http://hlt.media.mit.edu/wp-content/uploads/2011/06/Screen-shot-2011-06-06-at-1.46.39-PM.png. Do you send your sketches just by one wire?

author
hilukasz (author)manu082013-05-22

Manu, this is for reading/sending serial via MISO and MOSI pins, not programming. What that diagram shows is how to program the attiny45/85, they are two very different things. As far as I know you cannot program via TX/RX pins

author
manu08 (author)hilukasz2013-11-28

thanks man!

author
Dantex (author)2013-03-30

I have arduino mega2650 wich doesn't support working as ISP programmer

bu i have bought USBtinyISP wich is suported in arduino IDE

but I dont know how to programm attiny85v via USBtinyISP!
some help?

author
hilukasz (author)Dantex2013-04-05

that's not true at all. mega2650 should support ISP mode, just have to make sure you have reset jumper in since the IC is not removable.

About This Instructable

55,775views

108favorites

License:

Bio: hacker, designer, all around fun-timer. yuhno?
More by hilukasz:Attiny serial monitor using arduino walkthroughProximity sensing mouse wheel scroller
Add instructable to: