1. The Tiny
The ATtiny differs a little from the Arduino, don't expect it to be "fully compatible". It's a microcontroller which is just a part of an Arduino and not a full Arduino itself.
It's more of a device for "advanced users" and gives some more flexibility (at cost of usability). You can easily add this microcontroller on a breadboard, since putting a full Arduino on a breadboard makes little sense.
Since the ATtiny is a microcontroller (like the ATmega on an Arduino) and not a development board (as an Arduino), it does not have an USB connector.
The ATtiny series also does not have hardwareUART (Rx/Tx). The
You'll have to take care for a steady power-supply to your Microcontroller and the programming will be a little more tricky (details further below).
It is however possible to use
SoftwareSerial and a customized bootloader. My ATtiny85 runs software serial with 115200 fine, though I have found a post which states that the internal oscillator should be tuned for a reliable connection.
1.2 RAM/program memory
The ATtiny has less RAM and program memory. This essentially means your program can't be as 'big' as on a normal Arduino. It also means that you can't use as much variables. A program for the tiny should be "small" or very efficient.
My ATtiny came with 1Mhz internal clock set, but if you change the fuse bits you can make it run at 8Mhz. An standard Arduino has a 16Mhz clock on the board. So your code would run 16x slower on default and 2x slower on "max". You could use an external clock for the ATtiny, but that eats up 2 pins.
The cool thing is, when you set it to 1Mhz it can run on about 2.7V (check datasheet first).
ATtiny (standard) 1Mhz
ATtiny (set fuses) 8Mhz
ATtiny (external crystal) up to 20Mhz
Higher Mhz is faster. Keep in mind that 1Mhz is roughly 1000000 instructions per second, which is still blazingly fast and good enough for most occasions, especially on such a tiny device.
2. Programming the Tiny
Most of the ATtiny's don't come with a customized (software serial) Arduino bootloader. This essentially means that you have to burn a custom bootloader by yourself or use another type of programmer. You should really watch the video from Ben Heck. He explains that Arduino boards have an USB converter on board and have custom code that is able to "bootload" your Arduino. But that ICSP/ISP programmers are used to upload programs without a bootloader/uart connection.
2.1 The programmer
You've got a load of options, check the "Programmer" item in the "tools" tab in your Arduino IDE. I'm using an USBasp which can be bought on ebay for as little as 3€. You should get one that has a selectable voltage (3.3V and 5V).
(If your ATtiny85 already has the bootloader, which is unlikely, you can use the software rx/tx pins for uploading)
Check your microcontroller if it really is a ATtiny85 my E-bay reseller actually had one ATtiny45 included, which lead to an "error" when trying to upload.
The Arduino IDE does not know the "ATtiny board" so you can't select it easily. You'll have to let the IDE know that the ATtiny can also be programmed.
I found a very nice tutorial that describes how to do this.
- Open the preferences dialog in the Arduino software. Find the
“Additional Boards Manager URLs” field near the bottom of the dialog.
- Paste the following URL into the field (use a comma to separate it from any URLs you’ve already added):
- Click the OK button to save your updated preferences.
- Open the boards manager in the “Tools > Board” menu.
- Scroll to the bottom of the list; you should see an entry for “ATtiny”.
- Click on the ATtiny entry. An install button should appear.
- Click the install button. The word “installed” should now appear next to the title of the ATtiny entry.
- Close the boards manager. You should now see an entry for ATtiny in the “Tools > Board” menu.
2.3 Changing the internal clock
Some interesting post I found told me that you can change the internal clock/oscillator to 8Mhz by selecting 8Mhz (internal) as the clock and pressing the "Burn bootloader" button. This won't flash a bootloader (since that makes little sense on a Tiny85) but does change the fuse-bits.
You'll not get away with the standard blink tutorial. It uses digital pin 13 (the tiny only has 8 pins).
Mind that you might have to upload using Ctrl+Shift+U (or sketch->Upload with programmer).
I used the diagram below to check the pins (from highlowtech.org)
Your "schematic" isn't complete, I don't see a way to program or power the microcontroller. And you might want to take some precautions.
I personally think a well-drawn schematic looks better as a "breadboard view".
The 10Kohm pull-up resistor on the reset pin is not 100% neccesary according to the datasheet. But the Uno has one in it's reference design (which I use as a reference).
There are two capacitors, one "big" capacitor as a reservoir. If one device suddenly pulls a lot of current, this capacitor will handle that. The smaller decoupling capacitor will damp the noise of other IC's or switching supplies. It may work withouth these, but your circuit will be more reliable with them.
Mind that the decoupling capacitor should be (physically) close to the IC.
You can power the board through the programming header, but mind that you'll need a smooth voltage between (most likely) 3.3V and 5V. If you want to power it with a bigger voltage (9V battery) then you'll need a voltage regulator.