Difference between revisions of "AVR Drivers"

28 bytes added ,  18:48, 1 May 2011
(info on compiling the code in AVR Studio 5)
Line 5: Line 5:
==Things You Will Need==
==Things You Will Need==


===Drivers===
===Flashlight Drivers===


Of course you will need a flashlight driver circuit board first. The stock driver in some flashlights already has an Atmel driver on board. There are also several NANJG drivers available that include an Atmel TINY13A chip that can be programmed. These chips can also be locked down so they can't be changed, but so far none seem to be. However, some variants of NANJG drivers use a PIC chip that can not be programmed with AVR tools. See [[Popular drivers]] to see some of the drivers people have been using. Most of these use current regulators to limit the current delivered to the LED while the Atmel chip itself turns the power on and off very quickly, leaving it on for full power, or flashing on and off quickly to simulate a lower mode. As the percentage of off time increases, the light gets dimmer. By setting the on-off cycles to a high frequency, the eye just sees this as a lower mode even when the LED is barely lit. This is called Pulse Width Modulation (PWM). By slowing the flashing more, you get a visible strobe mode or SOS modes. So essentially the Atmel chip is just a computer-controlled on-off switch.
Of course you will need a flashlight driver circuit board first. The stock driver in some flashlights already has an Atmel driver on board. There are also several NANJG drivers available that include an Atmel TINY13A chip that can be programmed. These chips can also be locked down so they can't be changed, but so far none seem to be. However, some variants of NANJG drivers use a PIC chip that can not be programmed with AVR tools. See [[Popular drivers]] to see some of the drivers people have been using. Most of these use current regulators to limit the current delivered to the LED while the Atmel chip itself turns the power on and off very quickly, leaving it on for full power, or flashing on and off quickly to simulate a lower mode. As the percentage of off time increases, the light gets dimmer. By setting the on-off cycles to a high frequency, the eye just sees this as a lower mode even when the LED is barely lit. This is called Pulse Width Modulation (PWM). By slowing the flashing more, you get a visible strobe mode or SOS modes. So essentially the Atmel chip is just a computer-controlled on-off switch.


The Atmel ATTiny13A has an 8-bit processor with 1 kb of flash memory, 64 bits of RAM, and 64 bits of EEPROM that can be written several thousand times. There are also settings called "fuses" which can be set or cleared.  
The Atmel ATtiny13A has an 8-bit processor with 1 kb of flash memory, 64 bits of RAM, and 64 bits of EEPROM that can be written several thousand times. There are also settings called "fuses" which can be set or cleared.  


===Hardware===
===Hardware===
Line 20: Line 20:




[[File:Soic8clip.jpg|thumb|200px|SOIC 8 clip with wires rearranged]]The other piece of hardware is a SOIC 8 clip to attach to the pins of the Atmel chip on the flashlight driver. There are cheap blue ones on eBay that have been very problematic, but sometimes work. They cost about $12. It is best to get one with a ribbon cable that attaches to pins coming out of the clip. The individual wires of the ribbon cable can be moved to the correct pins for the ISP programmer. See below for the proper configuration. There are [http://cgi.ebay.com/SOIC-8-SOIC8-8-Way-SMD-Programming-Testing-Test-Clip-/380333853764?pt=LH_DefaultDomain_0&hash=item588daa0c44 more expensive ones on eBay] as well that might work better. These are black, cost about $21, and don't seem to include the cable. The programmer itself includes a cable but you will need some way of connecting the wires in the ribbon cable to the pins sticking out of the clip.
[[File:Soic8clip.jpg|thumb|200px|SOIC 8 clip with wires rearranged]]The other piece of hardware is a SOIC 8 clip to attach to the pins of the Atmel chip on the flashlight driver. There are cheap blue ones on eBay made by Pomona that have been very problematic, but sometimes work. They cost about $12. It is best to get one with a ribbon cable that attaches to pins coming out of the clip. The individual wires of the ribbon cable can be moved to the correct pins for the ISP programmer. See below for the proper configuration. There are [http://cgi.ebay.com/SOIC-8-SOIC8-8-Way-SMD-Programming-Testing-Test-Clip-/380333853764?pt=LH_DefaultDomain_0&hash=item588daa0c44 more expensive ones on eBay] made by 3M that might work better. These are black, cost about $21, and don't seem to include the cable. The programmer itself includes a cable but you will need some way of connecting the wires in the ribbon cable to the pins sticking out of the clip.


===Software===
===Software===


You need some kind of software to interface with the USB programmer and read or load programs into the Atmel chip.
You need some kind of software to interface with the USB programmer to read or load programs into the Atmel chip.


You will at least need AVRDUDE (AVR Downloader UploaDEr) to upload and download files to the Atmel chip. It is a command line interface (DOS). If you use Tido's programs then you don't need to compile anything: those programs are ready to be loaded. If you install WinAVR, AVRDUDE will be included. You can also install AVRDUDE separately.
You will at least need AVRDUDE (AVR Downloader UploaDEr) to upload and download files to the Atmel chip. It is a command line interface (DOS). If you use Tido's programs then you don't need to compile anything: those programs are ready to be loaded. If you install WinAVR, AVRDUDE will be included. You can also install AVRDUDE separately.
confirmed, developer
1,668

edits