Audio/Video interface to a microcontroller/embedded system:
Need of an audio and video interface: If you look at the way human naturally communicate; it's by voice and the best way to explain any subject is to show the real picture i.e. video. The present electronics communications can be more natural if they handle audio and video data in all aspects (Both as data and commands). In fact today's digital device much more capable in accepting audio and video input and also outputting audio and video to speaker and LCD display or any display device. However streaming audio and video in/out of a processor is not that easy task. This article helps you in understanding designing audio/video interface to an embedded system.
The audio and video signal (analog and digital):
Audio: Audio in the form of sound energy is converted into electrical signal by using different types of microphones (the most popular now are electret/condeser microphone and MEMS microphone). The video in the form of light is converted into electrical signal using image sensors (the key component inside digital camera).
Analog vs Digital audio (comparison): The analog and RF electronics engineers have found it challenging to provide high quality audio over radio. However best the audio is converter to electrical signal, different types noise were added to the audio signal while it is getting amplified, transmitted, stored and retrieved, so that over the time the audio looses its originality. This is the problem with analog signal. Where as a digital signal, either it is signal or no-signal (1 or 0). Even the noise modulates or ride over the digital signal it does't impact the signal o/p as long as it is detectable as '0' or '1' (as long as noise stays below threshold). So digitizing audio into logic '1' and '0' helped to get rid of all major noise except one noise called quantum noise, which caused least effect to the fidelity of the audio. The audio once digitized it is easy to store in digital format and easy to copy multiple copies without adding any noise to it.
Digital audio is nothing but binary coded audio. See the picture below explaining one method of converting analog audio to digital audio.
Video: In case of video the picture in the form of light energy is converted to electrical energy using CCD or CMOS image sensors. They produce electrical analog signal in proportional to the red green yellow colors. Handling video data is much complex compared to audio due to sensor complexity, multiple signals and also the signal bandwidth, just like the difference between our ears and eyes. The video signal is not just plain signal it also carries sync signal for the display to sync the picture frame. The analog video spec is based three popular specs called PAL, NTSC and SECAM.
Complete audible frequency range: 20 to 20,000 Hz
Voice range: 300 HZ to 3400 Hz
Frame rate: 25 frames to 120 frames per second
Bandwidth: 4- 5 MHz for analog video (PAL/ NTSC and SECAM)
For High Definition (HD) video: in the range of 200 MHZ
The video signal falls in the RF range and complexities are higher. Visit the link below to know common analog video signal characteristics:
Use the software in the link below to calculate bandwidth for different video signals:
So the raw video signal and audio signals coming out of the sensors are plain analog signals except for frequency the bandwidth difference. Digital audio and video is again much similar except the procedures used for encoding, compressing and decoding.
Encoding, compressing and decoding: Converting of plain analog audio/video signal into digital signal is called encoding. There are various encoding standards available. Compressing is done to reduce the size of the encoded digital signal so that the repetitive and blank signals are stored with a reduced digital code. Decoding is a procedure to convert the compressed digital signal into analog signal.
The first stage of digitizing is done through a analog to digital converter IC/chip (ADC) and the final stage of retrieving the analog signal is done using Digital and Analog Converter IC/chip. The rest in between i.e. further coding, compressing and decoding is achieved through processor using software programs called codecs. The latest and most used encoding standards for digital video is H.264 and MPEG. Understanding H.264 and MPEG takes more time, we will cover that in our next module. Meanwhile you can refer to the wikipedia.org (search for H.264 and MPEG) which provides good introduction to H.264 and MPEG.
Interfacing audio/video to a DSP/processor or advanced microcontroller (MCU) with DSP capabilities:
Now let's get into how to interface audio and digital audio to microcontroller/processor. Mainly for the microcontroller to handle audio it needs DSP engine or an external audio processor chip. Below is the block diagram of audio interface to a microcontroller/embedded system.
In the above diagram the microphone is connected to pre- amplifier and then to a input of a Analog to Digital Converter (ADC chip/IC). The digital output of ADC is fed to data bus of processor and the ADC is controlled through processor. The processor can be exclusive DSP chip or a high performance general purpose processor or a DSP capable Microcontroller.
ADC can be an external device or it can be on-chip ADC in the microcontroller/processor chip.
The digitized audio from the ADC after once it enters the processor, it can be encoded further for any audio format such as wav, mp3, wma using a software program called codec. The encoded data can be stored on a SD card or any such flash memory based storage connected through SPI interface.
The retrieval is just the opposite of storing. The data from SD card is decoded by the processor and fed to a Digital to Analog converter (DAC chip) and to a speaker (again see above diagram). In stereo-audio the number of analog audio channels are two.
In case of video interface the microphone is replaced by a image sensor and the three light outputs RGB are connected to 3 different ADC chips before feeding to the data bus of processor .The rest of process is same as Audio where H.264 and MPEG codecs are used to store the data in H.264 and MPEG format. The video retrieval procedure is same as audio retrieval except for the increase in complexity, number of channels, and the higher bandwidth. Some of latest microphones have built-in analog and digital circuits to deliver the diigital audio directly.
The audio and video can together be stored and retrieved using modern codecs.
Here below provided are the links to nice articles on this subject for further reading:
By opening the application note by visiting this link below you can design a voice recorder using Atmel Micrcontroller AVR AT90S8535 and dataflash card. This has complete voice recorder circuit diagram. The name of application note is "AVR335: Digital Sound Recorder with AVR and DataFlash". The theory of operation is well explained.
The link is http://www.atmel.com/dyn/resources/prod_documents/doc1456.pdf
If you wish to learn how the video signal from the image sensor is handled by ADC, there is a exclusive video ADC from NXP Semiconductor called TDA8754. The datasheet available in the link below can help you to understand how the RGB channels are connected to ADC. The title of the data sheet is "TDA8754 Triple 8-bit video ADC up to 270 Msample/s"
You can learn about specifications and characteristics of NTSC, PAL and SECAM video signals in this application note titled "Introduction to Analog Video" by ON Semiconductor at the link http://www.onsemi.com/pub/Collateral/AND8261-D.PDF
The video is playing increasing important role in making a digital product successful. To know some of market facts and trends on importance of video in electronics systems, read this ppt from imagination technologies at the url below.
ARM and MIPS processors are capable of handling audio and video effectively and so is gaining popularity in use for various convergence application. A paper titled "Developing Video Phones with ARM Processor-based Solutions" at the link below explains how ARM processor used for video phone application.
Click on the text below to enter next module
Next module - (HDMI and displayport interface) (to be published sooner)
Click on the text below to enter previous module
ABOUT THIS COURSE:
This free tutorials on embedded systems is prepared by embedded professionals with fairly good industrial experience, however we want your feedback on this course content; please email your questions, suggestions and comments to firstname.lastname@example.org. Your questions on present modules will be answered in the revised modules. We may change the course content based on the majority of your requests and feedbacks.
Please let your friends know about this course, we request you to email this link to your friends and colleagues who are interested in embedded system.