I'm trying to flash a bootloader to my attiny85 by using an Arduino uno as an ISP but I keep getting the following error:
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
From what I've read so far I seem to have bricked it.
I think this may be caused by me selecting External 8MHz instead of Internal 8MHz, but I'm not entirely sure.
I've done this with three Attiny85s so far and have gotten the same results every time.
You need to "burn bootloader" to an ATTiny85 in order to set the fuses so it runs at the selected speed, even if you are not using it with a bootloader - unless you want it to run at 1mhz instead of 8 or 16!
0x000000 device signature usually indicates:
Fuses were previously set for Crystal or External Clock, but such is not present.
Incorrect wiring (eg, DO/MISO shorted to ground)
It sounds like it's the first one - if you select external 8mhz crystal as clock source, you need to have an external 8mhz crystal connected; If you have a crystal like that and a couple of loading caps lying around, that's definitely the easiest option. (for the purpose of unbricking it, you can use anything from 1-20mhz though - you just need something in approximately the right range so that it can respond to programming commands). Try it both with and without the loading caps - many breadboards have enough stray capacitance that you don't need the external loading caps and it won't even use them if you try
Also - your circuit is missing the 0.1uf ceramic capacitor connected between Vcc and Gnd right next to the chip (I usually put these over the top of the chip when working with breadboard to minimize the distance). You should not expect anything to work without this cap - IME, you normally can't even program the chips without the cap; this may be part of your problem. Sometimes you can program them, but then they hang when trying to run the sketch, or you can program the fuses, but it crashes when you commit the flash).
I don't have any 0.1uf capacitors but I have some 10uf capacitors, will that do the trick? I put that between the VCC and ground on the attiny85 chip correct? That's with the negative side facing the ground and the positive side facing the VCC?
Additionally, I'm confused about the crystals. What are they for, where do they go and why are they needed? Also, where can I get them?
Is there any way to unbrick them without buying any additional components?
No, you must use 0.1uf, and it needs to be ceramic (or tant). They're dirt cheap(eBay is cheapest source). Get a bunch, you'll use them all over the place.
Crystals are used for timing - they're much more accurate than the internal clock (better than 1% vs +/- 10% for internal, and much less dependence on temperature and voltage). They get connected between xtal1 and xtal2 pins, and 0~22 pf cap from each pin to ground (often breadboard don't need the loading caps due to stray capacitance). Also super cheap, great prices on eBay for common speeds.
I think arduino as ISP sketch outputs an 8mhz square wave on...pin 8? That can be connected to one of the crystal pins (forget which onr)
What a lovely tutorial - it leaves out the decoupling cap. It boggles my mind that so many "tutorials" omit a critical component like that. They clearly have not done much work with the Tiny85 in that configuration, or they would have recognized the stability issues that occur! I have first hand experienced problems with the tiny85 caused by lack of decoupling cap. Yes, it sometimes works without it - but sometimes it doesn't!.. and intermittent issues caused by not having a decoupling cap installed are maddening to debug.
Do you mean the 10uF cap they show between RESET and GND or do you mean a decoupling cap between VCC and GND? I've never had any problem without using a cap for the VCC of the ATtiny.
androidfanboy:
Do you mean the 10uF cap they show between RESET and GND or do you mean a decoupling cap between VCC and GND? I've never had any problem without using a cap for the VCC of the ATtiny.
A 0.1uf cap between Vcc and Ground. I absolutely have had problems on the ATTiny85 without this decoupling cap in place. Some would work, some wouldnt, some would start to program, but then die after committing the first page of flash... And everything was fixed when I put a 0.1uf cap across the top of the chip (these were the SMD ones). I guess that's why such misinformation persists - because sometimes, with some individual chips on some breadboards, it works (presumably getting by on stray capacitance in the system).