For electronics beginners, Arduino boards like the Uno and the newly enhanced Nano line are hard to beat. These boards are intuitive, affordable and versatile.
Once you build a solid foundation of skills, you may want to shrink your project down even more. For simple applications, the ATtiny85 can be a great choice.
ATtiny85 Specs
Microchip Technology's ATtiny85 is available for around $1-$2, depending on the quantity and version you select, such as:
- Through-hole ATtiny85-20PU
- SOIC ATtiny85-20SU
- QFN format ATtiny85-20MU
Ähnliches Produkt:
Ähnliches Produkt:
Ähnliches Produkt:
The chip features five I/O pins, or six if you reprogram the reset pin to function as an extra I/O pin.
If you're concerned about power consumption, the ATtiny85 chip boasts impressive power efficiency:
- Functions with a supply voltage of between 1.8-5.5V its 10MHz in the "V" implementation
- The 20MHz version can still run from 2.7V-5.5V, allowing it a wide range of power options
- Consumes 300μA of current when active in V variation at 1 MHZ at 1.8V, or .1μA when powered down
Let's dig into power usage a bit more: a fairly small 750mAh 3.7V LiPo can theoretically supply such a device when active for over 200 days (neglecting power conversion losses and converting voltage to half its normal value), and when in "Power-down Mode", the value would be 3000 times that number, well over a millennium.
ATtiny85 Arduino ProgrammingTutorial
Now that you're sold on the idea of this little chip, how do you get started?
1. Pair the ATtiny85 with the Arduino IDE
As with many dev boards and chips today, the easiest way to get started with the ATtiny85 is via the Arduino IDE and a programmer. Follow these simple steps:
1. Install the Arduino IDE
2. Navigate to the Arduino IDE ATtiny microcontroller support GitHub page
3. Follow the instructions to add this new feature
4. Once properly installed, navigate to Tools > Board on the Arduino IDEs, and you'll see a pair of selections listed under ATtiny Microcontrollers.
2. Program the ATtiny85 with Arduino
As you may have noticed, the ATtiny85 doesn't feature a programming port like the Arduino Uno or Nano do. Instead, you'll need to use a programmer as a go-between from the computer and the chip. One option is to use an Arduino Uno as an in-system programmer (ISP). While that's the most cost-effective option if you have an unused Uno, another option is to purchase a dedicated programming device. The ATtiny85 will plug directly into the device, which plugs into your computer's USB port.
Most likely, you'll need to install the correct driver, especially if you're using Windows. Installing the proper driver "libusb-win32" is the final step.
With the drivers sorted out, follow these steps:
1. Go into your Arduino IDE under Tools > Board
2. Select the option under that says ATtiny25/45/85
3. Under Tools, select Processor: ATtiny85 and the Clock: Internal 1 MHz. You may note that this is a slightly different procedure than you normally go through when working with Arduino boards. The 1 MHz speed may change later, but this speed is a good starting point for experimentation
4. Change the Programmer setting to USBtinyISP
5. When you're ready to upload, plug the ATtiny85 into the dedicated socket
6. Hit the arrow key to start the process (no port selection needed)
But what shall we upload?
3. Program the ATtiny85 to make an LED blink
One benefit of using a dedicated programmer is that it features a blinking LED attached to pin 0. Visible light makes it easy to do the traditional microcontroller "hello world". However, since the ATtiny85 doesn't feature a built-in LED, the stock Arduino Blink sketch won't work. The good news is that modifying it to work is easy:
1. Load the blink example on your Arduino IDE
2. Change where it says LED_BUILTIN to 0 (the number)
3. Press the arrow key or Ctrl+U to upload, and you'll then see it blinking away
4. Advanced Programming with ATtiny85
ATiny85 freed from its programmer, happily blinking 5 LEDs
Blinking an LED is well and good, but the real beauty of the ATtiny85 is that you can set it up to operate with nearly no supervision. There are a couple of ways to set this up:
First, the programmer includes eight female header pins that accommodate jumper use. This allows you to send signals from the chip to a breadboard while still attached to the programmer. Once you're satisfied with your setup, you can then pop off the chip and insert it into your breadboard or PCB. You're good to go.
Programming clip incorrectly spaced for ATtiny85-20PU
Once the chip is in place, however, reprogramming can get cumbersome. You'll either need to remove the chip and place it into your programmer again, or run wires from your programmer to pins that may or may not be available beside the board.
Another option is to use a chip clip for easy connection and removal. This clip attaches to the sides of the ATtiny85, but pay attention to sizing. Normal breadboard spacing is 2.54mm, while most of the clips on the market have a 1.27mm spacing. This is great if you're using a smaller SOIC (Small Outline Integrated Circuit) variation, but it won't fit the "full-sized" model correctly. Choosing a larger clip might be worth the investment, but be sure you select the proper size.
ATtiny85: An Excellent Option for Small Projects
When you're ready to move on to the next level of microcontroller projects, the ATtiny85 can offer you increased capability and flexibility. Its low power requirements and small price tag make it ideal for embedded projects. While the ATtiny85's five (or six) I/O pins might be restrictive in some circumstances, it may be plenty for your next application.