You Are Here: Home » AVR ATmega Projects » Interfacing(USB - RS232 - I2c -ISP) Projects » Atmega 32u4 Based USB Data Logger (Part 23/25)

Atmega 32u4 Based USB Data Logger (Part 23/25)




In this project, a device will be designed that will read analog data from any analog sensor and will send the digitized form of that data to a personal computer on USB interface. On PC, a desktop application will store the data in an excel spreadsheet therefore performing the data logging. For this, the device will be configured as HID Class Device again. An HID Class device has USB communication over two types of transfers – Control transfer and Interrupt transfer. The control transfer will be used for enumeration of the device.  After enumeration, the analog readings will be digitized and sent to the host computer on a real-time basis using Interrupt Transfer. In this project, Accelerometer Sensor – ADXL335 will be used as analog sensor. Any other analog sensor can also be used and tested with minor modifications in this project.

The device will need a controller chip to handle send digitized data on USB interface to the host computer. The 8-bit USB AVR – Atmega 32u4 is used as the device controller chip in the project. The project uses AVR based Lightweight USB Framework (LUFA) as the firmware which will be responsible for implementation of the USB Protocol. The device is tested on a Linux system using Python based Pyusb and Libusb frameworks for receiving data from peripheral device to the host computer.  Another Python based desktop application – openpyxl is used for data logging to an XML file. . For using the project device with windows operating system, similar desktop software for reading or writing data to USB and data logging has to be used.Atmega 32u4 Based USB Data Logger

The Generic HID device driver class of the LUFA firmware is used and  modified to program the project. With the use of LUFA firmware, the device driver code to implement USB protocol is not needed to be written explicitly. Modifying the firmware code will be sufficient to implement the USB protocol.

PREREQUISITES

This project is based on Arduino Pro Micro which has the USB AVR – Atmega 32u4 as the sitting MCU. In order to understand this project, one must have basic knowledge of the AVR microcontrollers and the embedded C programming for AVRs. WinAVR Studio is used to write, edit and compile the project code, so closely following the project shall require familiarizing with the above stated IDE as well. Though LUFA framework takes care of implementing the USB protocol and has APIs to abstract the lower level codes, understanding USB protocol is recommended to understand how actually the project is working. In fact, if anyone has already worked on some other microcontroller, it will not be much pain to understand and follow this project as the project code is more or less about modifying the LUFA device driver to work as generic HID device and using ADC channels for analog to digital conversion. One must have additional knowledge of Linux operating system (Ubuntu) and should be knowing basic Linux commands. One having knowledge of Python programming language is recommended but not mandatory for implementing the project.

SchematicSchematic Atmega 32u4 Based USB Data Logger

For more detail: Atmega 32u4 Based USB Data Logger (Part 23/25)

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Controlling a BLDC Motor with an ESC

REQUIREMENTS: 1. Microcontroller (AtMega 16) 2. A Brushless DC motor (BLDC) 3. An Electronic Speed Controller (ESC) 4. Power source...

Close
Scroll to top