This shows you the differences between two versions of the page.

Link to this comparison view

tutorials:choosing_an_avr_microcontroller_for_data_acquisition [2018/11/01 18:55]
tutorials:choosing_an_avr_microcontroller_for_data_acquisition [2018/11/01 18:55] (current)
Line 1: Line 1:
 +====== Choosing an AVR Microcontroller for Data Acquisition ======
 +[[http://​arduino.cc/​|Arduino]] is a wonderful platform for designers, artists and anybody who doesn'​t want to spend hours picking out chips and learning the AVR toolchain. But for tasks that require high-speed data acquisition,​ the Arduino has a fatal flaw: no built-in USB means that funneling data to a PC is sub-optimal. The Arduino uses an FTDI chip to do serial to USB conversion, which doesn'​t allow you you to take full advantage of USB speed.
 +The new Arduino UNO uses the [[http://​www.atmel.com/​dyn/​products/​product_card.asp?​part_id=4600|ATmega8u2]] for serial to USB conversion, but it's unclear whether there are hidden bottlenecks according to [[http://​www.google.com/​search?​hl=en&​q=+site:​arduino.cc+arduino+uno+usb+speed|posts on the Arduino forum]]. Moreover, the Arduino is quite large and it's smaller alternatives,​ such as the Arduino Pro Mini and the Arduino Nano are still using the FTDI approach.
 +AVR offers a number of [[http://​www.atmel.com/​dyn/​products/​devices.asp?​category_id=163&​amp;​family_id=607&​amp;​subfamily_id=760&​amp;​source=left_nav|ATmega chips]] with A/D converters + built-in USB capability that can give you better data throughput. This page collects notes on how to find and use these chips.
 +=====ATmega Chips with A/D + USB Support=====
 +Atmel offers a range of chips with built-in USB support, but not all of them have A/D converters. The chips in the table below have either 8 or 12 10-bit A/D converts each.
 +^Chip            ^A/D     ​^PWM ​   ^Flash ​   ^RTC     ^IO Pins ^ 
 +|AT90USB1286 ​    ​|8 ​      ​|9 ​     |128      |Yes     |48 |
 +|AT90USB1287 ​    ​|8 ​      ​|9 ​     |128      |Yes     |48 |
 +|AT90USB646 ​     |8       ​|9 ​     |64       ​|Yes ​    |48 |
 +|AT90USB647 ​     |8       ​|9 ​     |64       ​|Yes ​    |48 |
 +|ATmega16U4 ​     |12      |8      |16       ​|No ​     |26 |
 +|ATmega32U4 ​     |12      |8      |32       ​|No ​     |26 |
 +^Packages: ​  ​|TQFP/​VQFN 64/44 |
 +^USB:        |LS/FS Device (+OTG) |
 +^Fmax: ​      ​|16MHz |
 +^Vcc:        |2.7V-5.5V |
 +=====Breakout Boards=====
 + * The [[http://​www.pjrc.com/​teensy/​|Teensy 2.0]] board from PJRC provides a breakout for the ATmega32u4 along with a bootloader, lots of documentation,​ example code and support for Arduino via [[http://​www.pjrc.com/​teensy/​teensyduino.html|"​teensyduino"​]]. Thanks to the &#​8220;​halfkay&#​8221;​ bootloader, the Teensy can be programmed over USB.
 +  * The [[http://​www.pjrc.com/​teensy/​|Teensy++ 2.0]] board from PJRC is similar to the Teensy 2.0, but uses the ATmega90USB1286 chip, which has almost double the I/O, but fewer A/D converters. It's also almost twice the size.
 +  * The [[http://​code.google.com/​p/​micropendous/​|Micropendous]] [[http://​code.google.com/​p/​micropendous/​wiki/​ClassicMicropendousBoards|2,​ 3 and 4]] boards from Opendous are open source designs utilizing the range of USB-compatible AVR chips listed above. The [[http://​code.google.com/​p/​micropendous/​wiki/​Micropendous2|series 2]] uses the ATmega32u4, the [[http://​code.google.com/​p/​micropendous/​wiki/​Micropendous3|series 3]] uses the AT90USB647 and the [[http://​code.google.com/​p/​micropendous/​wiki/​Micropendous4|series 4]] uses the AT90USB1287.
 +  * The [[http://​www.adafruit.com/​|Ada Fruit]] [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=16&​products_id=296|ATmega32u4]] breakout board is alot like the Teensy 2.0, but a bit bigger. It includes an open source avrdude compatible bootlader and space for an ISP header, so, unlike the Teensy, you need to program it using an AVR programmer.
 +  * Adrian Freed from [[http://​cnmat.berkeley.edu/​|CNMAT]] (creator of Open Sound Control) has written an Arduino sketch called [[http://​adrianfreed.com/​content/​oscuino-arduino-osc-sketch-open-sound-control-work|OSCuino]] that turns most Arduino compatible microcontrollers into an OSC data acquisition device. The usual Arduino chips as well as the ATmega32u4 (Teensy) are supported. (Note: OSCuino does not implement the entire OSC protocol; most notably time tags are left out. This is in part due to the fact that there is no real-time clock (RTC) on the ATmega32u4.)
 +  * Also at CNMAT, Andy Schmeder has written a [[http://​cnmat.berkeley.edu/​library/​uosc_project_documentation/​downloads|µOSC implementation]] for the SparkFun Bitwhacker and the [[http://​code.google.com/​p/​cui32/​|CREATE USB Interface]],​ both PIC-based boards (though you can add an AVR chip to a CUI to get the best of both worlds).
 +  * [[http://​code.google.com/​p/​lufa-lib/​|LUFA]] seems to be considered the best library for doing USB on AVR microcontrollers.
 +  * [[http://​code.google.com/​p/​micropendous/​wiki/​LUFAduino|LUFAduino]] is firmware for the Micropendous boards that combines LUFA and the Arduino libraries. This could probably be ported easily for use with other boards (such as the Teensy).
 +  * [[http://​www.mil.ufl.edu/​~chrisarnold/​components/​microcontrollerBoard/​AVR/​avrlib/​docs/​html/​main.html|Procyon AVRlib]] is a set of high level libraries for AVR microcontrollers. Additional instructions on using these can be found at the CCRMA websites listed below.
 +=====References on A/D Conversion=====
 +  * [[http://​www.avrfreaks.net/​index.php?​name=PNphpBB2&​file=printview&​t=56429&​start=0|Newbie'​s Guide to the AVR ADC]] at AVR Freaks
 +  * [[https://​www.mainframe.cx/​~ckuethe/​avr-c-tutorial/​|A Brief Tutorial on Programming the AVR without Arduino]]
 +  * [[https://​ccrma.stanford.edu/​wiki/​AVR|CCRMA Wiki: AVR]]
 +  * [[https://​ccrma.stanford.edu/​workshops/​pid2004/​lectures/​programming/​programming/​programming.html|How to Program the AVR with avr-gcc and AVRLib]] (CCRMA)
 +  * [[https://​ccrma.stanford.edu/​courses/​250a/​toots/​avr-osx.html|Using AVR Microprocessors Under OSX]] (CCRMA)
 +You may find a more up-to-date version of this tutorial at the [[http://​d474.net/​notes/​avr-microcontrollers-for-data-acquisition.html|d474 blog]]