Instructables

Easy ATTiny Serial Communication with Tiny AVR Programmer

Picture of Easy ATTiny Serial Communication with Tiny AVR Programmer
AtTinyPins.PNG
ATTinies (like the ATTiny 85) are super awesome! They are super cheap, low power, and they do what most Arduino projects accomplish anyway (give a simple output or take in a simple input).

One difficulty can be quickly seeing what's going on with their internals for easy debugging. The ATTInies can't use the hardware serial built in to many larger arduinos, and so you need to use the SoftwareSerial library. This can be a bit tricky or confusing. Other people use software serial for directly programming their Tinies in the first place with all kinds of crazy hookups, and maybe capacitors, and USB to serial devices. You might even have to put special software on the arduino talking to the hardware serial, and the one just using software serial.

Some of us who have only used Dave Mellis's tinyAVR programmer get a bit confused, or are just too lazy to try that all out. It can be confusing for beginners, and I wanted the simplest way to teach my animal interaction design students how to use these great little microcontrollers.

So thanks to help from Paul O'Neil, I wanted to describe really quickly a simple method for talking with your ATTiny and the only extra necessary material is an Arduino Uno or Duemillanove (or Seeeduino that acts like one).

If you are new to programming ATTinies go check out the nice tutorial over at HLT and then come back here after you get your environment setup. 


MATERIALS
  • ATTINY 85
  • TinyAVR Programmer (it's on sparkfun)
  • 2 wires
  • "Slave" Arduino Uno or Duemillanove (or Seeeduino that acts like one).


++Photo of Pinouts

++Photo of 

Special Extra Learning Notes
  • We'll find out that your
  • We'll find out that analog input 2 is a bit tricky on the ATTiny
 
Remove these adsRemove these ads by Signing Up

Step 1: Program the ATTINY with Software Serial Commands

Picture of Program the ATTINY with Software Serial Commands
Check out this example code where you invoke SoftwareSerial, and then use it like you normally use it in your sketches. Program your ATTiny with this:

https://github.com/quitmeyer/ATtinyBareDemos/blob/master/ATTinyAnalogInputTOSerial/ATTinyAnalogInputTOSerial.ino

(BTW Anyone know how to embed github code in an instructable? I tried gists, and gist-it)
morthole1 year ago
I forget one thing Configuring the ATtiny to run at 8 MHz (for SoftwareSerial support) on the hlt (http://hlt.media.mit.edu/?p=1695) website.
I got al garbage on the screen, after setting de fuse bits correct as mentioned it works but i have one exception i only get "input value :0" also if i put 5v on input port.
Am i missing something? i'm using a attiny45 but this is the same pinout as a attiny85.
blorgggg (author)  morthole1 year ago
Ahh yes, you def need to make sure it is 8MHz for Software serial. Good trouble shooting! As for the input value 0, there is probably just a pin mapping problem. For example, maybe the input pin you are touching has a different number than on the 85, and when you are plugging in 5V, it is just not talking to the right port. You could use the serial to discover the port, by turning on all the inputs and see what gets affected. maybe!