Yes, this is a little bit mad, the ATTiny13 8bit AVR microcontroller, has a staggering 64 BYTES of ram, and here we are using the Arduino IDE to program it, but yes, you can do it, and you can do some useful stuff in it too (for varying definitions of the word "useful").
As an example, here's a Candle Flickering LED project I did with an ATTiny13 in the Arduino IDE
Tell me James, how do I do this amazing stuff with the ATtiny13 in Arduino?!
Easy, using my specially crafted Arduino Core which has been tuned for the Tiny 13 you can really do a lot with this little chip, you can even do such sorcery as serial communications, or tone() music, in 1 kb, with just 64 bytes of ram, and all in the Arduino IDE using (relatively) standard Arduino programming conventions!
Automatic Installation through Board Manager (Recommended)
- Start the Arduino IDE
- Select File > Preferences
- Locate the "Additional Boards Manager URLs" setting and click the button next to it.
-
Add the following URL to the list
https://raw.githubusercontent.com/sleemanj/optiboot/master/dists/package_gogo_diy_attiny_index.json
-
Hit OK
- Select Tools > Board > Boards Manager
- After a few seconds you will find that the new boards are available for install, select the new Boards and click the Install button
- Close the Boards Manager window
Arduino Pinout (Pin Mapping)
Here is the Arduino Pin Mapping for the ATtiny13 as implemented by my core (other cores may be different)
Examples
A number of examples are available in File > Examples > ATTinyCore > Tiny13 which will help you to get the hang of special considerations about writing code for the Tiny13.
Old Core13 Information Below, Ignore Unless You Are Really Interested
Core13 was a third party core for the earlier Arduino IDE’s which had support for Tiny13, it’s very much superceeded by the above, don’t use it, information left just for the curious.
The below download is the "Core13" I used and a hardware definition file, open the ZIP and you'll find a README.TXT to tell you how to install the files into your Arduino IDE.
Download James' Version of the Arduino Core13 for the ATTiny13 With His boards.txt For It Here
Arduino Pin Mapping For Core13
For the Analog pins, you need to use the ADC Number, for the Digital pins it's the PB number (without PB).
Therefore the mappings for most purposes are something like this for the DIP or SOIC version of the ATTiny13…
1 | RESET (or if disabled, D5, A0) | VCC | 8 |
2 | D3, A3 | D2, A1 (SCK) | 7 |
3 | D4, A2 | D1 (MISO) | 6 |
4 | GND | D0 (MOSI) | 5 |
For example, analogRead(1) gets the value from pin 7 of the IC, and digitalRead(0) gets the value from pin 5 of the IC.