INTRO…
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.
Atmel's tiny... ATtiny85 |
ATtinyShield - easy Arduino programming |
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.
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. This is what ATtinyShield is doing for us.
If you want to buy this shield check, my EBay listing:
You will get:- The shield with printed and already etched PCB with color silkscreen on it, and of course the components soldered on it. It will be fully functionable ready to program.
- An Attiny85 20PU chip for your first experiments.
- A detailed printed (and pdf) guide (in color) for the connections and the whole programming procedure.
- The RGB-Tiny board, a small PCB with RGB Led, controlled by an ATtiny85 for your first experiments. With code provided you will be able to fade the Led to all colours or any other programming you want.
WHAT ELSE IS NEEDED…
• An Arduino Uno board (Uno is a verified version that works fine).
• An ATtinyShield (to be placed on the Arduino) with an ATtiny85 on it.
• The Arduino IDE (the software) version 1.0.1 (also verified version that works fine).
• Attiny.zip (https://github.com/damellis/attiny/), containing the necessary files for the software.
SETTING UP THE HARDWARE…
First attach the ATtiny85 on the shield (check the indicator) and the little jumper connection on the 5V selection (5V – SEL, just confirm it). 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 it might help tilting the pins a bit.
SETTING UP THE ARDUINO IDE…
Now that the connections are done, we have to set the software of the Arduino IDE for the programming phase.
As seen on the photos below, 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.
• 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.
• 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 https://github.com/damellis/attiny/) and extract it in this folder (Hardware). This step is only done once.
• 6: Restart the Arduino IDE and in the Board section you must have a lot of new choices. Do not change the board yet.
• 8: Now let’s run the script that will turn our Arduino into an 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.
• 12: Now it’s time to upload the Blink (or any other) sketch to ATtiny85. Load it from the Examples menu.
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!
TROUBLESHOOTING…
If something went wrong and the chip isn’t properly programmed these might be some reasons.
PROBLEM
|
REASONS
|
SOLUTIONS
|
1. When uploading the Arduino ISP, the Heartbeat LED doesn’t work and the IDE returns errors.
|
1.a. The software doesn’t have the necessary ATtiny files.
|
1.a. Check steps 2-5 again, so that the files are in the correct folder.
|
1.b. Sometimes the ISP must be uploaded without the ATtinyShield on the Arduino board.
|
1.b. Just remove the shield and re-upload the ISP sketch. Then – after uploaded – plug the shield.
| |
2. When uploading a script the Arduino IDE returns errors.
|
2.a. The ISP isn’t properly uploaded.
|
2.a. Check Troubleshooting case 1.
|
2.b. The ATtiny board isn’t correctly selected.
|
2.b. In the board section select ATtiny85 with 1 MHz clock.
| |
2.c. Some errors, like Avrdude type, may not cause any problem.
|
2.c. Try ignoring them if the script is uploaded despite the errors and test the chip.
| |
3. When tested the LED connected on ATtiny85’s pin 5 doesn’t flash.
|
3.a. The ATtiny85 isn’t connected properly on the shield.
|
3.a. Check the DIP pin holder for the mark and match it with the chip.
|
3.b. The Input / Output pins of the ATtiny85 are 0-5.
|
3.b. In the Blink sketch, the pin must be changed from 13 to 0.
|
The only trouble that I had, was that with the shield connected, I couldn't upload the ArduinoISP sketch. With the shield removed, the sketch uploaded fine, and then after connecting the shield and selecting the right attiny board, everything went smoothly.
ReplyDeleteThis is a good quility Arduino shield. It is much easier than using jumper wires and breadboards if you want to program attiny chips.