Introduction: Demystifying ATTINY 85 Serial Comms


This is a short instructable to demystify serial comms on the ATTINY85. Why is this important? Well, this powerful low cost chip can do a lot of what the Arduino can do but it doesn't have a debug facility. Therefore, for example, if you want to ensure that your temperature sensor program is working then without serial comms you are in the dark. You can set up serial comms between the ATTINY85 and your PC using external libraries and configure the pins as RX/TX to communicate with a serial programmer. However, this is very problematic and I spent a lot of time trying to figure this out, which I eventually did. Here's how:

Firstly, please refer to my previous instructable about basic programming of the ATTINY -

The additional components that you will require are

a) Four x Dupont cables

b). A serial programmer such as a Silicon Labs CP2104. Again, these are very cheap.

Programming the chip

Load the attached ino file into Arduino IDE. Adjust the settings to that shown in the attached image. Most importantly set the internal clock to 1mhz - (see settings in image above) - Using a USBasp programmer, upload the code to the ATTINY85 - It may display" avrdude: warning: cannot set sck period. please check for usbasp firmware update." but this is advisory only.

Running the program (See attached image)
Insert the Silicon Labs CP2104 programmer into the usb port of your laptop.

Connect as follows:

CP2014 <---> Attiny85


RXD PIN 3 (This is a adjacent to the ground pin)

Power the ATTINY85, e.g. using a 3.3 volt supply from a Breadboard Power Supply (+/- power rails to +/gnd pins on ATTINY) and then open the Arduino Serial Monitor (see attached image) . You should see number being printed.