Introduction: A Tiny Programmer for ATtiny Microcontrollers With Arduino UNO : Part1-Older ATtinys

It is currently interesting to use ATtiny series microcontrollers due to their versatility, low price but also the fact that they can be easily programmed in environments such as Arduino IDE.

Programs designed for Arduino modules can be easily transferred to ATtiny microcontrollers.

That's why ATtiny programming with Arduino is interesting.

This project aims to program the ATtiny13,85,84 microcontrollers and the range they belong to.

Special attention will be paid to ATtiny2313 programming (and the range it belong to).

We will build a shield for Arduino UNO on which there is a ZIP socket through which ATtiny to be programmed is connected.

It is cheap, easy to make and useful.

For the newer ATtinys I have published a separate Instructables. Those interested can find it at:

https://www.instructables.com/A-Tiny-Programmer-for-ATtiny-Microcontrollers-With/

Supplies

All components can be found on AliExpress at low prices.

Exceptions are those from their own workshop, which are even cheaper.

Step 1: Schematic Diagram


The shield is powered by Arduino UNO, the presence of the supply voltage being indicated by the LED lighting.

Of course, only one chip can be programmed at a time, main photo being only illustrative of how the chips to be programmed are inserted. This is also shown in the schematic diagram.

Important is the presence of C1 = 22uF / 16V at the Arduino Reset pin. Its lack leads to not being able to do the programming due to the Arduino reset at the start of programming.

Connector J5 will be in the ON position when programming ATtiny13, 84, 85 and OFF when programming ATtiny2313 (C1 is in circuit only in the first case).

C2 = 47uF / 16V is anti-oscillating on the power supply.

The actual programming is done at J1 pins 3,4,5,6, respectively D10, D11, D12, D13 Arduino.

Because programming is done on 4 wires only, it is easy to adapt the programming of other ATtiny instead of ATtiny 84, using appropriate adapter plates. This is the case of programming the ATtiny2313 (see Step 9).

The shield is connected to the Arduino UNO so that there is a 1 to 1 correspondence of the pins of the 4 connectors (see main photo).

Step 2: List of Components, Materials, Tools.

1. Arduino UNO R3-1 pc.

2. ZIP socket 2X14 pin-1pc.

3. C=22uF/16V-1pc, C=47uF/16V-1pc.

4. R=0,33K/0,25W-1pc.

5. LED 5mm. Red-1pc.

6. Connector pinheader vertical 10pin-1pc, 8pin-2pcs, 6pin-1pc, 2pin-1pc.

7. SMD adapter socket 8in-1pc., 14pin-1pc. There are attachments to the shield, only if you use SMD chips.

8. PCB to plant these components.

9. Fludor, soldering tools, tool for cutting component pins.

10. Digital multimeter (any type).

11. Lust for work.

Step 3: Making PCB

Method1- Using KiCad program

The PCB project in KiCad can be found at:

https://drive.google.com/drive/folders/1J0Cu18p_j_...

From here all the files will be downloaded under the ZIP archive (there is a special command for this), it is unzipped and we get all the details of the project, including the labels.

For those who want to make PCB themselves, uses 1.6mm thick FR4,double sided.

No metallic holes.

The crossings are made with uninsulated wire.

After drilling and echting, cover with tin, manually.

We check with the digital multimeter the continuity of the routes and the possible short circuits between them.

The project in KiCad also allows the generation of Gerber files, for factory order.


Method2-Using EasyEda online program

For those who want to order PCBs at the factory,the address will be accessed:

https://easyeda.com/TedyS/attiny-programmer-1

Here, in addition to the wiring diagram, there is also the PCB project under EasyEda.

You can get:

-BOM (bill of materials)

-Gerber files

-Ordering PCB to factory simply and directly.

For this, we open the PCB in the editor(Open in Editor) and obtain the desired information and actions in "Fabrication".

Step 4: PCB Assembly.

It is simple (as in photo) using fludor and soldering tools.

It is useful to cover with plastic (white in the photo) 2X3 pins of ZIP socket. It helps a lot to correctly insert the chips in the socket. Pin 1 of the chip to be programmed was marked with a red dot.

The labels are made with the Inkscape program and are covered with transparent foil.

Once the assembly is finished, check.

Step 5: Upload Arduino UNO With Arduino ISP (In System Programmer).

It's simple, but care must be taken not to have the programmer board inserted in the Arduino!

Connect Arduino board to PC / laptop.

In PC / laptop--> Start--> Control Panel--> Device Manager, we see where the Arduino UNO board appears.

In Arduino IDE -->Tools --> Board -->choose Arduino UNO.

In Arduino IDE -->Tools-->Port-->the port to which Arduino is connected is given.

In Arduino IDE -->Tools-->Programmer:"AVRISP mkII"

In Arduino IDE -->File->-Examples-->ArduinoISP-->ArduinoISP. Upload this sketch on Arduino board.

Now we may insert the programmer in Arduino.

Step 6: Upload ATtiny Cores

In order to be programmed with the Arduino IDE, the ATtiny microcontrollers must be recognized by it. For this, some software sequences will be introduced in the Arduino IDE that will allow the Arduino programming environment to recognize microcontrollers in the form of "Boards". These are the "ATtiny cores".

For historical reasons, for ATtiny13 there is one "core", and for ATtiny84,85, 2313 and others of the same generation there is another "core". Their installation (for Windows operating system) will be done as follows:


ATtiny13 core

To install it, follow these steps:

1. Launches Arduino IDE-->File--Preferences.-->Aditional Boards Managers URLs. Here add adress:

https://mcudude.github.io/MicroCore/package_MCUdude_MicroCore_index.json

This is done with Copy -->Ctrl + V.(Copy-->Paste not working).-->OK .A good Internet connection is required.

2. Tools-->Board-->Boards Manager. In the table that appears, scroll until we find MicroCore -->Install. Installation may take some time.

After it is done, in Tools --> Board --> MicroCore we will find ATtiny13.


ATtiny84,85, 2313 core

We will access the address:

https://github.com/SpenceKonde/ATTinyCore

From here we will download the zip archive using the "Code" command. We will unzip and get a folder called "ATTinyCore-2.0.0". It can be saved in the PC for later use.

With Arduino IDE closed, we will copy this folder to Computer-->C:/-->Program Files-->Arduino-->Hardware. This is done with Copy-->Paste after granting permission to the Administrator.

Now we can launch the Arduino IDE and on the path Tools-->Board we will find the ATtinyCore which contains the desired microcontrollers and others of the same generation. From here we will choose exactly what we want: ATtiny84 or 85 or 2313 or others.

Step 7: Programming ATtiny13, 85

There are quite a few differences between ATtiny13 and ATtiny85, the most important being that the first one has 1 Kbytes of FLASH memory, the second one has 8 Kbytes.

However, the programming with this device is similar, the two microcontrollers having the same pin configuration in the case of connection with Arduino (see pin map below):


ATtiny13, 85 pin.........Arduino IDE reference

1................................D5, A0 if Reset is disabled

2............................... D3, A3

3............................... D4, A2

4(GND)

5..............................D0(PWM)

6..............................D1(PWM)

7..............................D2, A1

8(Vcc)

A program that flashes an LED at pin 2 of ATtiny13,85 looks like this:

void setup() {
// initialize D3 (ATtiny pin 2) as an output.
pinMode(3, OUTPUT);
}
void loop() {
digitalWrite(3, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(3, LOW); // turn the LED off
delay(1000); // wait for a second
}

It can be seen that pin 2 of ATtiny13,85 is considered D3 (see pin map); is declared output, then raised to 1 logic for aprox. 1 s, lowered to 0 logic for aprox.1 s, after which the cycle repeats.

To program a chip with this sketch, using this programmer, we will connect it to the PC, insert the desired chip into the ZIP socket in the appropriate position (see main photo), open the Arduino IDE and copy the above program. Then:

For ATtiny13 :

Arduino IDE-->Tools-->Board-->MicroCore-->ATtiny13. From here, choose the working frequency of the internal oscillator (typically 9.6MHz), the working port with the PC, and then Upload from Arduino IDE.

Important! In ArduinoIDE-->Tools-->Board-->Programmer it must be "Arduino as ISP"

For ATtiny85 :

Arduino IDE-->Tools-->Board-->ATtinyCore-->ATtiny85(No bootloader). From here, choose the working frequency of the internal oscillator (typically 8MHz), the working port with the PC,possibly other options and then upload sketch from Arduino IDE.

Important! In ArduinoIDE-->Tools-->Board-->Programmer it must be "Arduino as ISP"


In both cases, the check is done by connecting to pin 2 of the microcontroller a series LED with R=330 ohm, with the cathode towards the ground, powering the assembly with 5V. Can use a breadboard. The LED should blink.

Step 8: Programming ATtiny84



ATtiny84 has a program memory of 8 Kbytes and a higher number of I/O pins than the ATtiny13, 85. That is why it is a frequently used microcontroller.

The correspondence map between its pins and the Arduino is given below:

ATtiny84 pin.............Arduino IDE reference

1(Vcc)

2..............................D10

3..............................D9

4..............................Reset

5..............................D8

6..............................D7,A7

7..............................D6,A6

8..............................D5,A5

9..............................D4,A4

10............................D3,A3

11............................D2,A2

12............................D1,A1

13............................D0,A0

14(GND)


We propose to program an ATtiny 84 with the small program from Step7 (LED blink). This will make it possible to flash an LED at the pin10 of the microcontroller (see pin map).

ATtiny84 is inserted in the ZIP socket in the correct position (see main photo), directly if it is THT or through the adapter if it is SMD.

Connect the programmer to the PC and then follow the path from Step 7, the programming sequence of ATtiny85, with the difference that (of course}, instead of ATtiny85 we will choose ATtiny84 in ATtinyCore.

Check by connecting to pin10 of the microcontroller a series LED with R=330 ohm, with the cathode towards the ground, powering the assembly with 5V. Can use a breadboard. The LED should blink.

Step 9: Programming ATtiny2313

ATtiny2313 has a program memory (Flash) of 2 Kbytes and a number of GPIOs (general purpose inputs-outputs) higher than ATtiny84. It is a commonly used microcontroller.

The correspondence map between its pins and the Arduino is given below:

ATtiny2313 pin........Arduino IDE reference

1..............................Reset

2..............................D0

3..............................D1

4..............................D2

5..............................D3

6..............................D4

7..............................D5

8..............................D6

9..............................D7

10(GND)

11............................D8

12............................D9

13............................D10

14............................D11

15............................D12

16............................D13

17............................D14

18............................D15

19............................D16

20(Vcc)

Physically, the ATtiny2313 will be programmed in the slot of the ATtiny84, through an adapter plate that can be seen front-back in Photos 9.1, 9.2.

On the front there is a 2X10 pin (THT) socket. The red dot marks pin 1.

Strings of 2X10 pins are mounted on the back. They will be inserted into the ATtiny84 socket.

Electrical connections are made between them as follows:

Nr. pin from front socket Nr. pin from back socket(top view)

10.............................................14

1................................................4

17..............................................7

20..............................................1

19..............................................9

18..............................................8

An ATtiny2313 will connect to the programmer as in Photo9.3 if it is THT or as in Photo9.4 if it is SMD (an appropriate adapter socket will be used).It looks complicated, but it works well.


We propose to program an ATtiny2313 with the small program from Step7 (LED blink). This will make it possible to flash an LED at the pin5 of the microcontroller (see pin map).

Connect the programmer to the PC and then follow the path from Step 7, the programming sequence of ATtiny85, with the difference that (of course}, instead of ATtiny85 we will choose ATtiny2313 in ATtinyCore.

Check by connecting to pin 5 of the microcontroller a series LED with R=330 ohm, with the cathode towards the ground, powering the assembly with 5V. Can use a breadboard. The LED should blink.

Step 10: Alternative Method for Programming ATtiny Microcontrollers

Several chips were programmed using the method presented above.

It worked correctly, with the exception of 2 pcs. ATtiny2313.

I tried an alternative programming method, to see if they are defective or not, but also to see if I can program the microcontrollers from the ATtiny13,84,85,2313 series by another method.

The design of the program is also done in ArduinoIDE, but the inscription of the chip is done with the specialized programmer TL866.

We will write an ATtiny2313 with the small LED blink program from Step7.

We will bring this program into the Arduino IDE.Here all the settings must be the same as in Step 9.

Then, Sketch-->Export compiled Binary. A .hex file will be obtained, in the same folder as the LED blink sketch (see Photo 10.1,the selected file).

We connect the TL866 programmer to PC and insert the chip to be programmed into the ZIP socket (see Photo 10.2).

We are launching "MiniPro", the program that governs the operation of TL866 (see Photo 10.3). Here we will follow the steps:

-From "Select ICs" (also using the search box) we will choose and select ATtiny2313). We can see how it must be entered in the ZIP socket in "Information".

-From "Open file" we will look for the previously obtained .hex file. We get what is seen in Photo 10.4.

Click "OK" and we get what you see in Photo 10.5, that is, the .hex file loaded into the TL866 buffer.

-We do the actual Programming from the Programming chip.We get what is seen in Photo 10.6. The chip has been successfully programmed.


In the present case, I programmed an ATtiny2313 from the two that could not be programmed by the previous method, but through this last method, any chip from those presented here can be programmed, TL866 and more recent programmers "know" these ATtinys.

Arduino Contest 2020

Participated in the
Arduino Contest 2020