In this modern world we all are aware about USB. We all connect our Pen drives, memory card and other devices using USB. But have you ever thought what is it? Here is the answer; USB is a communication protocol by which two devices communicate with each other. In the same way, microcontroller also communicates with other devices like sensors or PC by using different communication protocols like USB, UART, and I2C.UART stands for Universal Asynchronous Receiver/Transmitter. It is a type of serial communication that uses two wires, one for transmission (Tx) and one for reception (Rx).
Ultrasonic sensor with NRF24LE1 (Part 11/14)
Today we are going to interface a very interesting sensor with NRF module.Have you ever heard bats communicating with each other? We can’t hear them because they use ultrasonic frequency to communicate with each other. Ultrasonic frequencies cannot be heard by human ears. Human can only hear sound between 20 – 20 KHz frequency whereas ultrasonic frequency lies above 20 KHz and expands up to several GHz.The ultrasonic waves have different travelling speed in air, liquid and gases. In air they usually travel at 340 m/s. They have the tendency to get reflected from a solid surface. Due to this functionality they are used in distance measurement.
Interfacing Accelerometer with NRF24LE1 (Part 12/14)
In this series we have learnt the basic functionalities and features of NRF24LE1. Now it’s time to use them for achieving higher tasks. In future, we will combine various functionalities of the NRF with outer world. Today, we will interface an accelerometer sensor with NRF24LE1 using ADC (Analog to digital converter). We will also output the acceleration reading to our PC using Serial communication.
Wireless Communication with NRF24LE1 (Part 13/14)
The invention of radio has revolutionized the world. It was a successful tool for communicating information using wireless communication. Another great invention was the telephone. Do you remember those days when we used those bulky landline phones? Now the era has changed. Landline phones are getting replaced by mobile phones. We have to accept the fact that wireless communication has become an essential part of our life. If we look around ourselves, we will find many devices which work on wireless communication like mouse, keyboard, lock keys, radio, cordless phone and much more. Also, wireless communication is sometimes referred as Radio Frequency (RF) communication.
Atmega 32u4 Based Multimedia Volume Controller (Part 11/25)
How a multimedia keyboard is made has been already explained in the Atmega 32u4 Based Multimedia Keypad Project. In that project a keypad was designed to control media functions of the window media player on windows OS. A set of tactile switches was used to receive the user inputs in that project. This project – Multimedia Volume Control will control main volume of the windows operating system.Also, in the project, instead of using tactile switches, LDR sensors are used for user inputs to demonstrate a gesture recognition application. Like in the multimedia keypad project, in this project as well, the device will be configured to a consumer device instead on generic desktop control device. In the USB protocol, when the usage page report item of the usage page of an HID device is configured to consumer type, the device gets configured for application specific controls.
Introduction to LUFA
Universal Serial Bus (USB) is now a common and vast framework for serial communication. The interface not only allows serial communication, it also works as electronic power supply. The popular AVR microcontrollers fortunately have the USB interface feature and can be programmed to build USB devices. The USB specification is long and intimidating. It can be a daunting task to write a device specific USB driver.
Introduction to USB: Advantages, Disadvantages and Architecture (Part 1/6)
Universal Serial Bus (USB) is the de facto interface for computer peripherals to communicate with the personal computers. The interface that saw the light of day around the mid-1990s was a joint effort of seven companies – Compaq, DEC, IBM, Intel, Microsoft, Nortel, and NEC.
USB Requests and Stages of Control Transfer (Part 4/6)
In the previous article of this series, USB Descriptors were discussed. When a USB peripheral is connected to a host device, the host sends queries in the form of requests. The peripheral responds by sending Descriptors. The Descriptors contain the information required for identifying and configuring the peripheral device, implementing the interfaces and setting endpoints. The device descriptor is the first descriptor sent to the host and it helps in configuring the peripheral with respect to the host. The subsequent descriptors implement the functioning, the peripheral is meant for. The Control Transfer is the only transfer type which is supported even when the device is yet not configured. That is the reason, it is used for sending requests and obtaining the descriptors. The default endpoint is endpoint 0 which is bidirectional and used for control transfers.
Atmega 32u4 Based Generic USB Mouse (Part 1/25)
A Mouse is a common computer peripheral apart from the keyboard. Even the touchpad is not able to dent the popularity of mouse. Nowadays the keyboards, as well as mouse connect through the computers via USB cable or the fancier one connect to the PCs wirelessly through Bluetooth. This project is an attempt to demonstrate the functioning of a generic USB mouse. The 8-bit USB AVR – Atmega 32u4 is used as the USB device controller in the project. In order to avoid complexity, the project uses AVR based Lightweight USB Framework (LUFA) as the firmware.
Atmega 32u4 Based USB Digital Voltmeter (Part 25/25)
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.
Atmega 32u4 Based USB Controlled Servo Motor (Part 24/25)
In this project, a device will be designed which will allow controlling a servo motor from the desktop computer on USB interface. For controlling a servo motor, PWM output needs to be generated from the microcontroller. The length of the ON time of the PWM signal at the control pin of the servo determines the angle the servo should rotate.The project device receives data from the host computer on USB interface which will determine the ON time of the PWM signal and according a PWM signal will be send out to the control pin of the servo using in-built timer. 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.
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.
USB Controlled Atmega 32u4 GPIO Pins (Part 22/25)
In Atmega 32u4 Based USB Controlled LED Series Project, how data is communicated from computer to a generic HID device was seen. Then, in Atmega 32u4 Based LED Status Project, how microcontroller configured as generic HID device can communicate data to the computer was studied. For data transmission from computer to device, control transfer was used while for data transmission from device to computer, interrupt transfer was used.In this project, a generic HID device will be designed that will exchange data with a computer both ways. Primarily, it will receive data packets from the host computer and will use those data packets to control input/output ports of the microcontroller.
Atmega 32u4 Based LED Status (Part 21/25)
In the Atmega 32u4 Based USB Controlled LED Series Project, it was demonstrated how to use control transfer to receive data from computer to the peripheral. In this project, it will be demonstrated to transfer data from microcontroller to the host computer. 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.When data has to be exchanged from default endpoints i.e. endpoint 0 IN and endpoint 0 OUT only, the control transfer is sufficient to perform the data communication. Usually, HID devices only use control transfer for enumerating with the host.
Atmega 32u4 Based USB Controlled LED Series (Part 20/25)
Throughout this USB series, different types of USB devices have been designed and developed. These devices were enumerating with the host computer and then were using Class Specific transfers for further USB communication. Like the Keyboard, Mouse and joystick devices were using interrupt transfers for their operations after enumeration.Similarly, the audio class devices were using isochronous transfers for their operations after enumeration. The CDC Class devices were using bulk transfers for their operations after enumeration. Any of these transfers (Bulk, Isochronous or Interrupt) are enabled only after the control transfer which let the device get enumerated with the host. These transfers are required when data is also sent from the device to the host computer.
Atmega 32u4 Based USB EEPROM Reader (Part 19/25)
External memories are frequently used to store and carry computer data. The USB flash drives are quite common nowadays. This project is an attempt to demonstrate making of USB storage devices. The project converts an external EEPROM which basically has I2C interface to an USB device. The project actually works like a protocol changer between I2C and USB standards. The external EEPROM used in the project is AT24C512 which has 512 Kb memory space.In this project a desktop application written in Python will be used to write, read and erase data from the EEPROM. The 8-bit USB AVR – Atmega 32u4 will be used as the controller chip on the device to accept control instructions from the host computer according to USB protocol and implement the data control operations on EEPROM through I2C protocol.
Atmega 32u4 Based USB Musical Keyboard (Part 18/25)
The music keyboard is one of the most common musical instruments. The electronic musical keyboards have been around for a long time. The electronic music keyboards synthesize musical sounds electronically according to MIDI (Musical Instrument Digital Interface) standards. Fortunately, the USB protocol does have provision to implement the MIDI standard under Audio Class Devices. The USB protocol has the MIDI subclass under the Audio Class 1.0. In this project, the device designed is based on the MIDI subclass and it transmits the MIDI Data Packets using Audio Class of the USB protocol.On any musical keyboard, there are physical keys pressing which specific musical notes having predetermined pitch and volume are generated. Any electronic music keyboard also works similarly.
Atmega 32u4 Based USB Speaker (Part 17/25)
A speaker is a device that produces sounds from the electrical signal having audio encoded. The speakers usually have a 3.5 mm jack for audio output from the computer. Nowadays USB interface is also gaining popularity for interfacing audio devices with the computer. A lot of portable audio and musical devices nowadays have USB connector for interfacing with the computers.The USB pluggable portable devices are easy to carry away along with a laptop or notebook computer anywhere. Plus, USB is now such a universal interface that it is more common than any other computer interface for serial communication. The USB pluggable devices also have the advantage that they can draw power from the USB port itself. When USB interface is used by an audio device for connecting with the computer, the audio stream coming from the device also needs to be according to the USB protocol.
Atmega 32u4 Based USB Microphone (Part 16/25)
A microphone is a device that senses the sound waves and sends the digitized audio signals to the computer. The commonly used microphones have a 3.5 mm jack for audio input to the computer. Nowadays USB interface is also gaining popularity for interfacing audio devices with the computer. Even a lot of microphones and portable speakers nowadays have USB connector for interfacing with the computers.When USB interface is used by an audio device for connecting with the computer, the audio stream also needs to be sent according to the USB protocol. In this project, a typical audio jack input of a regular microphone is replaced with the USB interface to connect with a computer.
Atmega 32u4 Based Wireless USB Mouse (Part 15/25)
How a generic mouse is made was explained in the Atmega 32u4 Based Generic USB Mouse Project. In this project a wireless mouse will be designed. For making a wireless mouse, there will be two circuits involved in the project – a transmitter circuit which will have a keypad included for getting the user input and a receiver circuit that will connect with the PC through USB port. The two circuits will connect wirelessly using NRF24lO1 module.The NRF module is a Wireless Transceiver that works on 2.4 GHz ISM (Industrial Scientific Medical) band. It is manufactured by Nordic Semiconductors. The transmitter section will have Arduino Mega as the controller board. At the receiver section, the computation will be handled by two controller boards – Arduino UNO and Arduino Pro Micro, each having their own computational roles.