Starting with ATTiny13
As any beginner electronics hobbyist I have recently came to conclusion that using Arduino(or even Mega328) for small projects is neither cost-effective or educational (I’ll explain why later).
Another reason for writing this article is that I came across few ATTiny13A-SSU chips @ less than $0.90 each, which is even lower the official retail price, so I just had to buy 5 of them, although I didn’t know at the time
whattahellamigointodowithit what is it really capable of.
I’ve decided to dive into some info on entry-level AVR microcontrollers and come to find out there are some cool and equivalently complex projects built with ATTiny-family ICs. Basically, if you need to make something simple, like blink a few LED’s or control a pair of relays for your smart appliance, while keeping your expenses at bay – this material will be very useful to you.
So, why do I think that ATTiny is better than your Arduino for small projects? Well, there are at least 5 reasons:
1) Cheap. An average retail price is >$1.00/piece, but you might get lucky(as I did) and get it even cheaper. In contrast, a close equivalent “Trinket Mini” (Tiny85-based board) from Adafruit will cost you $6.95.
2) Versatile. You can use it with almost any simple peripheral extensions (w/ some reasonable limitations), including 16×2 LCD, HC-05 module, sensors, keypads, etc.
3) Small. You can minimize most of your permanent little projects to the size of a matchbox with little to no extra effort.
5) Challenging. 1KB flash and 64B RAM will teach you some good practices of writing an efficient code. Plus, you’ll get something to brag about
So, enough chat. We have some great things to make!
On today’s agenda:
- Building a simple breakout board for ATTiny13A-SSU MCU
- Setting up a programming environment
- Writing our first program in AVR assembly
MAKING A PCB
I’ve already compiled a detailed tutorial on making custom PCB, which is available here. The only additional info I can provide at this point is that you could create your own design which will fit your own needs using Eagle CAD. Remove a RESET button, if you need an additional IO pin, or add a few debugging LEDs to IO pins – whatever suits you.
I will attach sample breakout board with 6 GPIO pins, power indicator LED and a hardware reset button. You may add a few debugging LEDs to I/O pins the same way, or make duplicate pins for each of 6 GPIOs, if you are planning to use multiple things on the same I/O line, but at this point I’m just trying to keep it simple.
As you can see, at the bottom there is an SMD LED with 1K resistor (serves as our power indicator). And at the top we have a 10K pullup resistor, which connects VCC and RESET pins, combined with a RESET switch, which in its turn connects to the GND pin of ATTiny.
I did not find any suitable 2-pin SMD buttons in Eagle, so I just used a resistor of an equivalent size as a placeholder.
The download link for both board/schematic and PDF files are right below:
NOTE: Remember to disable all unused layers before printing (leave Layer1 and green landing pads). Don’t forget to enable “Mirror” and “Black” in Eagle print dialog.
Soldering components together is fairly easy even with a regular soldering iron, but I would still recommend using a hot-air soldering station for surface-mounted components in order to avoid headaches and component damage.
For more detail: Starting with ATTiny13
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
JLCPCB Prototype: Only $2 for 10pcs 10×10cm, 24 hours Quick Turn, DHL Delivery in 3 days
This Post / Project can also be found using search terms:
- attiny13 code samples
- attiny84a-ssu project