Arduino projects are very popular but also big and expensive. There are many times that we don’t need so many input or output pins. As a matter of fact, most projects could be accomplished with only 2 or 3 inputs and outputs. Besides the size, using one Arduino board for each small project can be costly.
So the solution is given (again) by Atmel with the ATtiny microcontrollers. Especially the ATtiny85 chip, which has 8 Kb flash memory, 6 input/output pins, low power supply at 1.8-5.5V, small 8-pin packaging and costs only 2-3$.
It is very easy to program the ATtiny85 using our own Arduino board based on the tutorial Arduino-based ATtiny programming published by MIT’s High-Low Tech research group.
In this instructable I will try to guide you step by step, through the whole procedure of constructing a small board – shield for the Arduino, so that the programming can be made easily and fast. This is what I named the ATtinyShield.
For more Arduino and ATtiny85 projects, check my blog: http://attiny85.blogspot.com
If anyone needs the PCB and/or the Shield premade check here:
(WITH NEW PCB CHECK PHOTO 4 below)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What Are We Gonna Do...
Before we start, let’s overview what our objective is.
As pointed out by the MIT’s High-Low Tech tutorial, we have to connect the ATtiny85 (pins 1, 5, 6, 7) with 4 digital outputs of our Arduino (pins 10, 11, 12, 13), give 5V and Ground to pins 8 and 4 of the microcontroller and finally place a 10uF Electrolytic Capacitor between the Reset and Ground of the Arduino.
In my project I have added an indicator LED on pin 9 of the Arduino that shows that the programmer is running properly and a reset tact switch for the ATtiny85.
All this can be seen on both the schematics above.
So by creating a small shield with all these connections, it’s easy to plug it on our Arduino and worry only about the programming stuff.
Step 2: Gathering the Components...
Let's start by gathering all the necessary components. I’ve bought them from taydaelectronics.com but you can find them anywhere.
The total cost is about 3 dollars without calculating the etching procedure you’ll follow.
• ATTINY85V-10PU Microcontroller IC [$2.38]
• 8 pin DIP IC Socket [$0.03]
• 10uF Electrolytic Capacitor 25V [$0.02]
• Resistor 200 Ohm (Red-Black-Brown) [$0.01]
• Tact Switch 2 pins SPST-NO [$0.04]
• 12 Pin Header 2.54 mm (in three parts of 5-4-3) [$0.15]
• 11 Female Pin Header (in three parts of 4-4-3) [$0.39]
• Jumper Connector for 2 pins (any old CD-Rom should have)
Pcb (you can skip if use a prototype board):
• Small 6cm X 2.5cm one side copper board
• Etching solution like Ferric Chloride or Sodium Persulfate.
And of course an Arduino board (mine is an Uno Rev. 3, but any other will do) and the Arduino IDE version 1.0.1 installed.
Step 3: Making the PCB...
PCB is a Printed Circuit Board and it will make this shield very easy to build and use. The two rows of pins that should be connected on the Arduino board must be aligned for easy fit, and for that a PCB is the best solution. So let’s make one.
• Download the rar file that contains the files of the PCB schematics and some pictures of the circuit to be printed as silkscreen.
• Print the circuit on a glossy paper with a laser printer. As shown on the pictures it must be the negative version of the circuit.
• Prepare the small part of one side copper board by scrubbing and cleaning it. It should be 6cm X 2.5cm.
• Put the printed paper on the board and press it with a hot iron. After 5 minutes, soak it in warm water, then peal the paper and you will have the toner transferred on the copper. (If you want, you can find more info about this procedure by searching for Toner transfer method.)
• Prepare your etching solution by dissolving Ferric Chloride or Sodium Persulfate on water. Then place the board in it and wait for the etching to be completed. (Be very careful with these stuff and if needed find more info about this procedure by searching for etching PCB.)
• Clean the finished board and it must look like the last picture, with only the copper tracks - that where protected by the toner - left. Nice work.
Step 4: Finishing the PCB...
Once you have finished the PCB etching, its time for drilling. With a small 1mm drill bit (or smaller), open the holes indicated by the copper schematic.
The board side that was left with no copper is blank, but not for long. We are going to place a little card known as the Silkscreen. In the rar package you’ve downloaded earlier, there is an image file called ATtinyShield Silkscreen. Print it – in colour if available – and place it on the board. A little tip here is to laminate the paper, because the soldering might affect it in the next step.
Now, with the Silkscreen glued on the surface of the PCB, we are ready to proceed to the soldering stage.
Step 5: Soldering the Components...
Here is the easy and fun part. Place the components on the board with the help of the Silkscreen layer and one by one solder the parts on the PCB.
It’s better to start with the pins that connect the shield to the Arduino. Make sure after the soldering that you have a nice fit on your board.
Note that the ATtiny85 chip isn’t attached to the shield, during the soldering process. We will add it to the next stage.
Step 6: Finished Shield...
Attach the ATtiny85 on the shield and the little jumper connection on the 5V selection (5V - SEL). We are ready to place it on the Arduino board.
The connections are as following:
• The 5 pins connector (DATA) of the ATtinyShield to pins 9 – 13 (DIGITAL) of the Arduino board.
• The 4 pins connector (POWER) of the ATtinyShield to pins RS – 3.3 – 5V – GND (POWER) of the Arduino board.
If everything went normally, you must have an easy fit. If not you could tilt the pins a bit.
Step 7: Setting Up the Arduino IDE and Uploading...
Now that the construction part is over, we have to set the software of the Arduino IDE for the programming phase.
As seen on the photos above, we have to follow some more steps:
• 1: Open your Arduino IDE 1.0.1 version. Make sure you have the COM port and your Arduino board set correctly.
• 2: Go to File – Preferences.
• 3: Copy the Sketchbook location mentioned on this window.
• 4: Navigate to this folder and you’ll find a subfolder named Hardware in it – if not create it.
• 5: Download the necessary files for the ATtiny85 ATtiny (from this GitHub repository) and put it in this folder (Hardware).
• 6: Restart the Arduino IDE and in the Board section you must have a lot of new choices. Do not change the board yet.
• 7: Select Arduino as ISP on the Programmer menu.
• 8: Now let’s run the script that will turn our Arduino into and ISP programmer. Go to File – Examples ArduinoISP.
• 9: This sketch will also test our shield. The LED we have connected on pin 9 is the Heartbeat LED that shows the programmer is running fine. Let’s upload it and see if it will light.
• 10: Now that the sketch is uploaded the LED must light, like a heartbeat… If not, check the ATtiny85 installation on the DIP socket and rerun steps 5 to 9.
• 11: Go to Tools, change the Board and select the ATtiny85 with internal 1 MHz clock.
• 12: Now it’s time to upload the Blink sketch to ATtiny85. Load it from the Examples menu.
• 13: Change the pin of the LED on line 10, from 13 to 0. Refer to the ATtiny85 pin-out image on Step 1.
• 14: Finally uploaded it and ignore the 2 avrdude error messages. You are DONE.
Step 8: Testing...
The small microcontroller is ready to be tested. You can leave it on the ATtinyShield and test it there, while it is powered by the Arduino. But let’s try it out on a breadboard and see if the Blink function is activated.
Connect pin 4 of ATtiny85 to the Ground and pin 8 to 5 Volts. Then connect the pin 5 (that is referred as pin 0 on the pin-out schematic) to a LED (through a small 200 Ohm resistance). It must blink with a second of period. The programming worked!
Step 9: Finally...
We finally got here. After constructing the PCB, soldering the components, setting up the software and testing it, we have a working shield which can be used to quickly upload any sketch to our small ATtiny85. By doing so, a lot of our projects can shrink and fit anywhere and furthermore reduce the cost significantly.
Thanks for your patient and since this is my first instructable, I’ll be waiting for your comments and corrections.