using_attiny_microcontrollers_with_arduino_on_windows_11

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
using_attiny_microcontrollers_with_arduino_on_windows_11 [2025/08/28 14:11] tkbletscusing_attiny_microcontrollers_with_arduino_on_windows_11 [2025/08/28 14:35] (current) tkbletsc
Line 1: Line 1:
 ====== Using ATtiny microcontrollers with Arduino on Windows 11 ====== ====== Using ATtiny microcontrollers with Arduino on Windows 11 ======
  
-It'2025, and there's a lot of outdated docs on programming ATtiny microcontrollers (ATtiny85, ATtiny84, etc.) on ArduinoYou CAN do this on Arduino IDE 2.x on Windows 11. +ATtiny microcontrollers such as the ATtiny85 are nice, because they're dirt cheap and can run with no outside components. However, now (in August 2025), there's a lot of outdated docs on programming these on Arduino, so I want to set the record straight: You CAN program these on Arduino IDE 2.x on Windows 11 (as well as other platforms)
  
 ===== Arduino support ===== ===== Arduino support =====
-The core you want is [[https://github.com/SpenceKonde/ATTinyCore|ATTinyCore]]. To [[https://github.com/SpenceKonde/ATTinyCore/blob/v2.0.0-devThis-is-the-head-submit-PRs-against-this/Installation.md|install]] it:+Hardware support for a given family of chips on Arduino is called a "core", and the core you want is [[https://github.com/SpenceKonde/ATTinyCore|ATTinyCore]]. To [[https://github.com/SpenceKonde/ATTinyCore/blob/v2.0.0-devThis-is-the-head-submit-PRs-against-this/Installation.md|install]] it:
   * This core can be installed using the boards manager. The boards manager URL is: \\ ''[[http://drazzy.com/package_drazzy.com_index.json|http://drazzy.com/package_drazzy.com_index.json]]''   * This core can be installed using the boards manager. The boards manager URL is: \\ ''[[http://drazzy.com/package_drazzy.com_index.json|http://drazzy.com/package_drazzy.com_index.json]]''
   * File→Preferences on a PC, or Arduino→Preferences on a Mac, enter the above URL in "Additional Boards Manager URLs"   * File→Preferences on a PC, or Arduino→Preferences on a Mac, enter the above URL in "Additional Boards Manager URLs"
Line 11: Line 11:
 ===== Setting up your sketch ===== ===== Setting up your sketch =====
  
-Programming for the ATtiny series is out of scope, but here are key Arduino settings you'll need. Under the Tools menu: +Writing the code for the ATtiny series is out of scope, so we'll assume you have a sketch written. If you need one to test, why not the plain "Blink" demo? 
-  * **Chip**: Pick which chip you have! + 
-  * **B.O.D. level**: this enables auto-restart on brownouts.+Set your "Board" under the "Tools" menu to the appropriate family under "ATTinyCore". You choose not just the chip family, but if it's going to need a "bootloader" (see later on for discussion on that, but for now, I'll assume you're using bare chips with no bootloader, e.g. "ATtiny25/45/85 (No bootloader)"). 
 + 
 +With that chosen, here are key Arduino settings you'll need. Under the Tools menu: 
 +  * **Chip**: Pick the exact chip model you have. 
 +  * **B.O.D. level**: this enables auto-restart on low voltage ("B.O.D." = Brown Out Detection). Optional.
   * **Clock source**: These chips can work either with an internal oscillator (no external components needed, but mediocre time accuracy) or an external clock source (you need a crystal or other clock source, but it can be very accurate). For most mild tasks, I recommend "8 MHz (internal)"   * **Clock source**: These chips can work either with an internal oscillator (no external components needed, but mediocre time accuracy) or an external clock source (you need a crystal or other clock source, but it can be very accurate). For most mild tasks, I recommend "8 MHz (internal)"
-  * **millis()/micros()**: Make the sketch bigger, but allow these common functions to work +  * **millis()/micros()**: Enable to make the sketch use more space but allow these common functions to work 
-  * **Programmer**: Set to USBasp if using that (else whatever programmer device you're using)+  * **Programmer**: Set to USBasp if using that (else whatever programmer device you're using -- see "Programming" below)
  
 For the settings marked "Only set on bootloader", these are only configured into the chip if you use the "burn bootloader" option. Some remarks on that: A "bootloader" is special code that helps the device to program itself in the future, e.g. via a native USB connection. I don't mess with bootloaders usually, instead opting to use a separate programmer like the USBasp, since that's much more reliable. HOWEVER, even if you're using a bare chip with no bootloader (e.g. by choosing "ATtiny85 (no bootloader)" as the chip), the "burn bootloader" option will still set low-level settings like those listed above as "fuses" (special permanent registers that set basic operating settings for the chip). Google "attiny fuses" to learn more, or use this [[https://eleccelerator.com/fusecalc/fusecalc.php?chip=attiny85|ATtiny fuse calculator]]. For the settings marked "Only set on bootloader", these are only configured into the chip if you use the "burn bootloader" option. Some remarks on that: A "bootloader" is special code that helps the device to program itself in the future, e.g. via a native USB connection. I don't mess with bootloaders usually, instead opting to use a separate programmer like the USBasp, since that's much more reliable. HOWEVER, even if you're using a bare chip with no bootloader (e.g. by choosing "ATtiny85 (no bootloader)" as the chip), the "burn bootloader" option will still set low-level settings like those listed above as "fuses" (special permanent registers that set basic operating settings for the chip). Google "attiny fuses" to learn more, or use this [[https://eleccelerator.com/fusecalc/fusecalc.php?chip=attiny85|ATtiny fuse calculator]].
Line 23: Line 27:
  
 You can program it several ways. Here's two: You can program it several ways. Here's two:
-  * **USBasp**: A dirt cheap dedicated USB programmer. USBtinyISP wasn't tested, but likely works similarly.+  * **USBasp**: A dirt cheap dedicated USB programmer. I'll be documenting this. USBtinyISP wasn't tested, but likely works similarly.
   * **Arduino as ISP**: Use an existing Arduino Uno, Nano, or similar as a programmer. I'm not gonna document this approach, but it googles easily.    * **Arduino as ISP**: Use an existing Arduino Uno, Nano, or similar as a programmer. I'm not gonna document this approach, but it googles easily. 
  
Line 30: Line 34:
 === Getting the right USBasp driver === === Getting the right USBasp driver ===
  
-To allow Windows 11 to support USBasp, you need to download [[https://zadig.akeo.ie/|Zadig]], a tool that associates various open source USB Windows drivers with connected hardware. Hook up your USBasp, run Zadig, then set the driver to "libusbK", and hit "install driver"+To allow Windows 11 to support USBasp, you need to download [[https://zadig.akeo.ie/|Zadig]], a tool that associates various open source USB Windows drivers with connected hardware. Hook up your USBasp, run Zadig, select the "USBasp", then set the driver to "libusbK", and hit "install driver"
  
 (Note: In Windows 10, libusb-win32 was recommended, but this doesn't work in Windows 11.) (Note: In Windows 10, libusb-win32 was recommended, but this doesn't work in Windows 11.)
Line 48: Line 52:
 | MOSI | Blue (hey that's a common color we haven't used yet) | | MOSI | Blue (hey that's a common color we haven't used yet) |
  
-(Yeah the mnemonics are dumb/bad, but they work for me)+(Yeah my mnemonics are dumb/bad, but they work for me)
  
 === Initiating programming === === Initiating programming ===
  
-In Arduino 2.x, they did a dumb thing, and made the upload button NOT respect the ATtinyCore's setting to use a separate programmer. So you'll need to go to Sketch menu and pick "Upload using programmer" (Ctrl+Shift+U). If all goes well, your chip should be programmed successfully+In Arduino 2.x, they did a dumb thing, and made the upload button NOT respect the ATtinyCore's setting to use a separate programmer such as USBasp. So you'll need to go to Sketch menu and pick "Upload using programmer" (Ctrl+Shift+U) to initiate programming. If all goes well, your chip should be programmed successfully!
using_attiny_microcontrollers_with_arduino_on_windows_11.txt · Last modified: by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki