Attiny13 Serial Port
Ever since I started making projects with the Arduino, I’ve had a desire to shrink them down to a single, small circuit board. One of my first projects, a customizable SLR intervalometer, was packed in a phonebook-sized cardboard box and used the Arduino Deumilanove connected to a breadboard with jumper wires. I brought the box out to Central Park at 5am to make a timelapse of the sunrise, but when I got to the park, I spent 20 minutes fixing the connections between the Arduino, the breadboard, and the components. Since then, I’ve explored a few different ways of shrinking projects down and making them more robust. For the intervalometer, I designed a circuit board that had female header pins to seat an Arduino Nano. It was a huge improvement on the design, but I knew I could do a lot better.
Mar 31, 2016 Connect your favorite serial devices Tx pin to SDA and an LED (plus current limiting resistor) to PB4 and you can set the brightness of the LED by sending bytes of serial. USI Serial Send. If you want to transmit serial data from an ATtiny using the USI then take a look at my blog post USI Serial UART Send on ATtiny. Sources of inspiration. Serial communication with the Tiny's. When you use the Arduino with the Arduino IDE, you are used to use Serial.print and the serial monitor, when you want to get some debug information. Something like this. Using knockbang on ATtiny13. Newer Core for ATTiny13 and knockbang. Serial Terminal Basics. Serial Port Profile (SPP) - The Serial Port Profile is a Bluetooth profile that allows for serial communication between a Bluetooth device and a host/slave device. With this profile enabled, you can connect to a Bluetooth module through a serial terminal. This can be used for configuration purposes or for.
I tried to teach myself AVR programming, but ran into a lot of snags along the way. By the time I got an LED to blink, I had invested hours in the project (a stark contrast to my first Arduino experience) and was feeling quite discouraged. I also tried using PICAXE chips. While it was much easier to get started with these chips than with AVR programming, I felt like I was abandoning all my years of C programming to learn a form of BASIC that’s an entirely different animal from when I used it as a kid.
When I came across the Programming an ATtiny w/ Arduino Tutorialbelow, I was elated. They walk you through the process of using the Arduino IDE and programming language to program 8 pin ATtiny45 or ATtiny85 chips. Not only that, but they also walk you through using an Arduino board to act as the programmer, or ISP. I had everything I needed, except for the chips, so I eagerly awaited my rush shipment of ATtinies.
I followed the tutorial and found that it was actually rather easy to program these little chips using the Arduino code and IDE. I tried out the basic digital and analog I/O functions and they all worked as expected. I did a little experimentation with a few other functions with some success, so your milage may vary. To test it all out, I even made a cute little blinky toy within about an hour. I’m now thinking about revisiting my intervalometer project and shrinking it down from a cardboard box to a mini Altoids tin!
Watch the video here
Programming an ATtiny w/ Arduino Tutorial
This tutorial shows you how to program an ATtiny45 or ATtiny85 microcontroller using the Arduino software and hardware. The ATtiny45 and ATtiny85 are small (8-leg), cheap ($2-3) microcontrollers that are convenient for running simple programs.
This tutorial is obsolete! See the updated version of this tutorial (with support for Arduino 1.0).
They are almost identical, except that the ATtiny85 has twice the memory of the ATtiny45 and can therefore hold more complex programs. We like to use both of them with paper circuits and other craft electronics. To program them, we’ll use a port of the Arduino core libraries created by Alessandro Saporetti and slightly modified by HLT.
Materials and Tools
For this tutorial, you’ll need:

For more information, see our list of materials and parts and our list of prototyping supplies.
Software
You’ll need the Arduino software (version 0022) and a plugin to add support for the ATtiny45/85. Installation instructions for the Arduino software are available for Windows and for Mac OS X.
Download: Arduino software, attiny45_85.zip
The ATtiny45 / ATtiny85 Microcontroller
Here’s the pinout of the ATtiny45 and ATtiny85:
Installing ATtiny45 / ATtiny85 support in Arduino
· Download: attiny45_85.zip
· Locate your Arduino sketchbook folder (you can find its location in the preferences dialog in the Arduino software)
· Create a new sub-folder called “hardware” in the sketchbook folder.
· Copy the attiny45_85 folder from the attiny45_85.zip to the hardware folder.
· Restart the Arduino development environment.
Turning the Arduino board into a programmer
We’re going to use the Arduino board to program the ATtiny45 or ATtiny85. First,
we’ll need to turn the Arduino board into an “in-system programmer” (ISP). To this:
Connecting the Arduino board and the ATtiny
We’ll connect the Arduino board to the ATtiny as shown in the following diagram. Use the dot in the corner of the ATtiny to orient it properly. We’ll also connect a 10 uF capacitor between reset and ground on the Arduino board as shown in the diagram (the stripe on the capacitor that’s marked with a negative sign (-) should go to ground). The capacitor prevents the Arduino board from resetting (which starts the bootloader), thus ensuring that the Arduino IDE talks to the ArduinoISP (not the bootloader) during the upload of sketches. (The capacitor is needed if you’re using an Arduino Uno, and might also be necessary for an Arduino Duemilanove.)
Pin connections:

Programming the ATtiny45 or ATtiny85
Next, we can use the Arduino as an ISP to upload a program to the ATtiny45/85:
Attiny13 Datasheet
Now, connect an LED and see if it blinks.
Python subprocess library.
Reference
The following Arduino commands should be supported:
Taken From:
http://blog.makezine.com/2011/10/10/how-to-shrinkify-your-arduino-projects/
How to program ATtiny13 – If you need a microcontroller for a simple use, the ATtiny microcontroller is the choice. One is ATtiny13. Not much different from ATtiny85, with a cheaper price than ATtiny13 it can save a program of 1KB. With the size of a flash memory the size of 1KB is enough if you make a simple program. For example, turning on the lights with a motion sensor, turning on the lights with an infrared remote, opening the door with a password, making flash lights and others.
ATtiny13 has the following specifications:
- 8-Bit Microcontroller
- External frequency up to 20 MHz
- Internal frequency up to 9.6 MHz
- 1KB Flash Memory
- 64 Byte EEPROM
- 64 Bytes SRAM
- 4-Channel 10-bit ADC
- 8-Pin with 6-Pin I / O
- Operating voltage starts from 1.8V – 5.5V
- Learn more.
The ATtiny13 Pin scheme is as follows:
How to program ATtiny13, you can use an Arduino Uno, Nano, Micro and others that support Arduino as ISP. The SPI pins used are PB2 (SCK), PB1 (MISO), PB0 (MOSI) and PB5 (Reset).
1. Install Library
To be able to install the library there are two ways, through the Board Manager on the Arduino IDE or manually install at Arduino Folder. This library only supports Arduino IDE version 1.6.4 or above.
a. Install through the Board Manager
- Open the Arduino IDE Software
- Go to File > Preferences
In the Additional Boards Manager URLs, enter the link below then click OK:
- Click Tool > Board > Boards Manager
- Please wait for the file to be downloaded.
- Look in the search field with the name MicroCore, then click Install.
- After the board is installed, friends will see a list of these boards as shown in this picture.
- The installation was successful.
b. Manual Installation
- Download this library first, Download the ATtiny13 Library.
- Then extract the ZIP file.
- Move the extract folder to / Document / Aduino / hardware.
- If there is no hardware folder, please create it first.
- Open the Arduino IDE, select menu Tools > Board (see the two images above).
- Installation complete.
2. Schematic
Follow the schematic below for how to program ATtiny13 . with pin configuration:
3. Program
a. Make Arduino an ISP
- Open the Arduino IDE
- Select File > Example > 11. ArduinoISP > Arduino ISP
- Select the Tools > Board > Arduino / Genuine Uno
- Select the Programmer > AVRISP mkll
- Then click Upload
- Finish, go to point 3.2.
b Burn Bootloader
Burn Bootloader program is quite important and only once at the beginning. This is necessary so that ATtiny13 will define all the internal settings of the ATtiny13 such as the value of the frequency used. If ATtiny13 is not on the bootloader, the performance is not suitable. For example, we set the delay of the ATTiny13 program to turn on and turn off the light for 1 second. If there is no bootloader, the program can run with 1.5 or 2 seconds delay. This will affect all ATtiny13 performance.
- Select the Tools > Board > ATtiny13 menu
- Select the Tools > Programmer > Arduino as ISP menu
- Select the Tools > Burn Bootloader
- Finish
c. Upload Main Program
- Select File > Examples > 01. Basics > Blink
- Change the word LED_BUILTIN, follow this program:
- Connect an LED to the PB3 pin as shown below.
- If it blinks for 1 second, then our program has succeeded.