ATtiny85: a microcontroller that gives a lot of play ...

ATtiny85

Microchip It is a well-known company within the maker and DIY world, since it has a large number of products to create projects. It is famous for its programmable microcontrollers for all kinds of applications. Within its range of microntroller products today we will focus on the ATtiny85, a very practical MCU that you will want to use in your future work.

Also, you should know that Digispark also has boards or modules that integrate this ATtiny85 with some extra elements that are needed to start programming this device, such as the serial interface connection to be able to pass the code to the memory of the device. Its low cost, tiny size, and compatibility with Arduino boards, end up making this board a good option.

ATtiny85

ATtiny85 pinout

Microchip has created a low-power, high-performance 8-bit microcontroller. It is based on the ISA AVR, which is RISC type. Includes 8KB flash memory, 512 Bytes of EEPROM, 512 Bytes of SRAM, 6 general purpose I / O pins (GPIO), 32 general purpose registers, an 8-bit timer / counter with comparison modes, a timer / 9-bit high-speed counter, USI, internal and external interrupts, 4-channel 10-bit A / D converter, programmable watchdog with internal oscillator, three software-selectable power consumption modes, debugWIRE for on-chip debugging, etc.

This ATtiny85 has a performance of 20 MIPS working at 20 Mhz. To get to that frequency, operate between 2.7-5.5 volts. Its performance allows it to run at almost 1 MIPS per Mhz. Its packaging is simple, of the DIP type and with 8 pins, although there is also it with other types of packaging if you need it. And I would like to add, that it can work under quite extreme temperature conditions, from -40 to 85ºC, which makes it suitable for many industrial applications or in extreme conditions.

Get documentation and tools

If you want to get Microchip ATtiny85 documentation and tools, you can do it from the official source:

  • Go to page about the ATtiny5.
  • Then, you can select the Documents tab, to download datasheets and other types of PDF documentation for free.
  • You can also select the Development Environment tab where you will find IDE programs or development environments to program this type of microcontroller, etc.

Remember that this microcontroller is different from Arduino, and therefore has its quirks vs. Arduino IDE and the way to program it that you must keep in mind thanks to the documentation provided.

Options to get started with ATtiny85

ATtiny85 boards

This ATtiny85 chip it can cost a little more than € 1, or a little more if you buy a board or module with it integrated. You can find it in some specialized stores to start trying it. Although it is cheaper separately, I recommend using modules to start, since they will avoid having to do some steps manually when you want to program it.

Here some options on amazon:

Some of the recommended boards, apart from the one mentioned above (Digispark), you also have the ZengBucks that I have put in the Amazon example. These boards, among other additional elements, include a serial interface for programming that you can connect directly to the USB port of your PC to program them with the IDE.

How to program?

Be careful, because also you can do it from Arduino IDE selecting the ATtiny85 device from the menu boards! If you haven't bought a module or board with the interface to program it, and you only have the ATtiny85 chip, you can use an Arduino board as an ISP (select that option from the Arduino IDE menu) connected directly to its pins to program it with the Arduino IDE. Programs, then you remove the programmed chip, and you can connect it to the project you need to make it work with an independent battery ...

Steps to use Arduino as ISP

Arduino boards integrate their own microcontroller to program from Arduino IDE, right? So far everything is normal. Well, if you activate the Arduino option as ISP From the development environment, you will be getting the Arduino board itself to work as an ISP to be able to program other external microcontrollers such as the ATtiny85, sending the program you want to work with to said chip. That way you don't need a module or a programmer.

To use Arduino as ISP, what you need is:

  • Your badge Arduino UNO.
  • A PC with Arduino IDE installed.
  • USB cable connecting PC-Arduino.
  • Cables and electronic elements necessary to connect the pins of the microcontroller that you want to program to the Arduino board.
  • The microcontroller you want to program.

Well once you have it all you open Arduino IDE with your board connected and all the wiring diagram made as in the previous images, and you follow these simple steps:

  1. Go to the File menu of the Arduino IDE.
  2. Select the Examples option.
  3. Inside the menu look for one called Arduino ISP and select it.
  4. Now the code for this sketch opens on the main screen.
  5. Now you give the arrow (Upload) to upload the code to your Arduino board and it will be ready to program your microcontroller. It is possible that if you have a different Arduino board, like Leonardo, etc., you will have to modify the ISP code a bit.
  6. Now your Arduino board is ready to act as an intermediary and program the ATtiny85 microcontroller using Microchip's IDE software. In other words, the only thing the board does is provide an interface for the code you write in the IDE to pass through and stay in the memory of the ATtiny85.
  7. From the used Microchip IDE, select the ATtiny85 microcontroller and start programming using the appropriate code. You screw it up and that's it. The programming language can be C / C ++, such as those supported by the IDEs provided by Microchip.
  8. Now you can disconnect the ATtiny85 from the Arduino board and put a battery on it to power it independently and make it work.

The truth is that it is pretty simple. Remember to look at the Microchip ATtiny85 documentation to know how to program it. For more information, you can look at this link:

Code examples

If this is your first time trying to program one of these microcontrollers, you can start using a few example codes and test or modify them to better learn how they work. You have many code samples on the net, also on GitHub.

Although it is in English, I also recommend you see this video to teach you the basics of MCU ATtiny85 from Microchip in just a few minutes:

Now I hope that you are more clear about how to use Microchip's ATtiny85 and that it will be practical for your future projects as a maker ...


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.