ATTiny 8MHz wrong timing in delay(), FastLED and NeoPixel

Are you sure it takes twice as long? With the default fuse settings you have:

  • Internal RC oscillator at 8MHz
  • Divide (clock) by 8 enabled.

You are running at 1 MHz, not 8 MHz.

If you run the standard “blink” sketch on your attiny85, what do you see? I suspect you get an 8 second delay when you ask for 1.

There’s an excellent fuse calculator at AVR® Fuse Calculator – The Engbedded Blog and when you’ve chosen the options you want, it even shows you the avrdude commands to set them. With PlatformIO, you won’t need to do that manually, just set the fuses in the platformio.ini and pio run -t fuses.

So, to turn off the divide by 8 fuse bit, you need to set your LOW fuse to 0xE2 and that will get you an 8MHz clock. Add the following to your platformio,ini file:

board_fuses.lfuse = 0xE2
board_fuses.hfuse = 0xDF
board_fuses.efuse = 0xFF

Then program the fuses, with an ICSP device, using either:

  • pio run -t fuses

or, in VSCode:

  • Click the ant/alien head icon
  • Click to open Project Tasks on the left side
  • Click to open attiny85 (your environment name)
  • Click to open Platform
  • Choose “set fuses”

Now try the blink sketch again. It should delay for 1 second. If so, you can go back to your original projecy.

HTH

Cheers,
Norm.