I'm pretty new to the whole Arduino thing, but I've been having a lot of fun so far!
I'm trying to use an ATTiny45 as an IR remote control, and I'm just using the internal 8MHz clock. It's been intermittent at best.
Searching around, I see people are using 20MHz crystals with these chips, but all I have on hand are the 16MHz ones.. which is really fast enough for what I'm doing.
I know I need to set fuse bits for it, but I don't know how to do that and I don't see any options for it in the Arduino IDE.
I'd just use the ATMega328, but since I'm only using 2 digital IO pins, this seems like crazy overkill.
Speed isn't the question (since 1MHz is plenty fast enough for what I'm doing), just simpler to do this than to try to rely on the internal oscillator.
edit:
avrdude: Expected signature for ATtiny85 is 1E 93 0B
Double check chip, or use -F to override this check.
danrulz98:
I know I need to set fuse bits for it, but I don't know how to do that and I don't see any options for it in the Arduino IDE.
The Arduino IDE sets the fuse bits when you do "Burn bootloader" (even when there's no bootloader to burn).
The easiest way to edit them is in your "boards.txt". Make a copy of the ATTiny45 section with a different name and change the fuses in there. Now select your custom entry and do "burn bootloader".
###########################################################################
attiny45at16e.name=ATtiny45 @ 16 MHz (external crystal; 4.3 V BOD)
# The following do NOT work...
# attiny45at8.upload.using=avrispv2
# attiny45at8.upload.using=Pololu USB AVR Programmer
# The following DO work (pick one)...
attiny45at16e.upload.using=arduino:arduinoisp
# attiny45at8.upload.protocol=avrispv2
# attiny45at8.upload.using=pololu
attiny45at16e.upload.maximum_size=4096
# Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms; [CKSEL=1111 SUT=11]
# Brown-out detection level at VCC=4.3 V; [BODLEVEL=100]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]
# Serial program downloading (SPI) enabled; [SPIEN=0]
attiny45at16e.bootloader.low_fuses=0xFF
attiny45at16e.bootloader.high_fuses=0xD4
attiny45at16e.bootloader.extended_fuses=0xFF
attiny45at16e.bootloader.path=empty
attiny45at16e.bootloader.file=empty85at16.hex
attiny45at16e.build.mcu=attiny45
attiny45at16e.build.f_cpu=16000000L
attiny45at16e.build.core=tiny
###########################################################################
danrulz98:
Anyway, I just want to run with the external 16MHz crystal so I can get reliable timings without messing with it too much.
You appear to be under a substantial misunderstanding here. You clearly have not looked inside a standard remote control unit.
I'll wager you will not find a crystal inside. More likely a ceramic resonator at 455kHz (cheapest sort), but quite possibly not even that.
If you are having trouble getting your circuit to operate reliably, look for anything other than the frequency stability. More likely, you are simply not getting the frequency generation correct due to code faults.
It's actually the receiver, but a couple of points are notable. One is that the 38 kHz is handled by the IR sensor and accuracy for that is minimal - a kilohertz either way is not generally a problem.
The other is that the oscillator calibration is significant not for the decoding of the IR codes, but for the USB interface.
Yeah, I've seen the USB receiver, that's pretty neat.
Well, since burning that bootloader with those fuses and using it with the 16MHz crystal, it works perfectly.
I was using the ATMEGA328 to test my code and that worked totally fine, and now that the ATTiny is running with a crystal, it's working 100%.
If you look at something like the TV-B-Gone, it uses one of those cheap little resonators too.
But, the 16MHz crystals is just what I have on hand. I don't see much of a point in ordering resonators when I have the overkill-accurate crystals in my parts bin.