 |
$3 in parts Runs 4 days on 2 AA's |
Tired of the boring steady blink? Sport a blinker that will get the attention of any old school ham radio operator! Check the Youtube video of the action.
This is my first project using an AVR microcontroller and really the first embedded systems project I've done since college. I had two options for programming languages C and assembly. I chose assembly because I was familiar (at least with the 8051) and because it is well documented in the datasheets. Another advantage of assembly is the ability to know exactly what is going on especially when using a device simulator. |
- Step One: Install the USBtinyISP Drivers. I've found the LadyADA writeup to be quite adequate.
- Step Two: Install WinAVR. This Ladyada writeup is also worth a look.
- Step Three: Install AVR Studio 4 (requires registration).
- Don't bother to install the Jungo USB Driver.
- Step Four: Write your program in AVRStudio.
- Open Start -> Programs -> Atmel AVR Tools -> AVR Studio 4
- Select New Project
- Select ATMEL AVR Assembler
- Give your project a descriptive name and choose a folder. Remember the folder name, you will need it later.
- Choose a debug platform, if you aren't sure use AVR Simulator.
- Choose the target device. ATtiny85.
- Copy and paste the code. If you're brave feel free to tweak it a little.
- Press F7 to compile the code.
- Step Five: Program Fuses (this needs to be done once per IC)
- Check out the The Engbedded AVR Fuse Calculator.
- Choose the ATTiny85 AVR Part. (There is no ATtiny85v option).
Feature Configuration
- Select "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6CK/14CK + 64ms: [CKSEL=100 SUT=10]
- A slow clock requires less battery power.
- Uncheck "Divide clock by 8 internally; [CKDIV8=0]
- Check "Serial program downloading (SPI) enabled; [SPIEN=0]"
- All other's should be unchecked.
- Brown-out detection should be disabled.
- No changes will be made to the Manual Fuse Bits section
- Under Current settings copy down the generated AVRDUDE arguments
- These should look suspeciously like -U lfuse:w:0xE4:m -u hfuse:w:0xdf:m -U efuse:w:0xff:m
- Stuff to watch out for:
- Any Clock selection beginning with EXT (you will need a crystal to program your chip)
- Forgetting to check serial program (SPI) enabled. (Chip is bricked).
- Disabling reset to gain an extra pin. (Chip is bricked, reset needed for programming.)
- Open a DOS Prompt and execute the following command: avrdude -p attiny85 -P USB -c USBTINY -U lfuse:w:0xe4:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
- Step Six: Breadboard the programmer and microprocessor.
- Set the processor on the breadboard across the channel.
- Press the pins into the breadboard by gently pressing on the processor.
- Use #22 solid wire to connect the pins on the processor to the ones on the programmer's 6 pin cable.
- Keep in mind that your processor may have a dot above pin 1 rather than the notch shown.
- Step Seven: Program the microprocessor
- Open Dos and change to the folder your project resides in.
- type: avrdude -p attiny85 -P USB -c USBTINY -U flash:w:my_project.hex -B 10000 (the -B 10000) slows down the programmer for the slow clock speed.
- Step: Eight: Connect up the circuit
- This is much easier to do on the breadboard to get started.
Advanced Concepts
Integrating USBTinyISP w/AVR Studio
The Simulator (See AVR Studio Help Screens)
In this case I mounted the whole deal to a Fi'zik - Saddle Attachment system.