In this project, a digital voltmeter will be designed which will show the voltage reading on a desktop application. The device will read analog voltage with respect to the ground, digitize the reading and send the reading to personal computer on USB interface. The device could read four different voltages in range from 0V to 5V. For this, the device will be configured as CDC Class Device. A CDC Class device has USB communication over two types of transfers - Control transfer and Bulk transfer. The control transfer will be used for enumeration of the device. After enumeration, device will use bulk transfers for sending the voltage readings to the computer.
The project device will need a controller chip to convert analog reading to digital form and send USB data to the PC. 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.
The CDC Class device driver 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.
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 CDC class device and using in-built ADC channels of the microcontroller. 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.
1. Arduino Pro Micro
2. Connecting wires
3. Micro USB cable
SOFTWARE TOOLS REQUIRED
1. WinAVR Studio
2. AVR Dude
3. ]]>LUFA Firmware]]>
4. ]]>Python 2.7.12]]>
5. ]]>Pyserial 2.7]]>
Arduino based DIY USB Digital Voltmeter Building Blocks
The project uses Arduino Pro Micro as the USB controller chip and uses Analog In pins for voltage reading. A wire is connected to common ground and four wires are connected through the pin 4, 5, 6 and 7 of Port F. The wires taken from the Analog In pins are used to sense the voltage in a circuit with respect to the ground. The device could read four different voltages at a time in range between 0V and 5V. The Program code for the project is burnt to the Arduino Pro Micro using AVR Dude. The Arduino board is connected to the USB port of a PC by a USB cable.