Skip to main content

Posts

Let's Build a Music Player!

Digital Music Player's are one of the many sensational devices that were developed in the 20th century. They have been around for a while now and have become a part of our life. In the last few years, they have been integrated within Smart Phones and hence, have reached the masses. Now, Let us try to dive into knowing how these devices work and I guarantee that we all would be fascinated by the kind of engineering which goes into making these magic boxes. There are various topics which must be covered in order to build our own music player and so there will be several blogs to build a SOUND foundation. Now let us make a list of the required components and then we will walk through each of them in the upcoming blogs. There are 3 basic parts which are required to build a device which can output Audio:- Storage Medium. Micro-controller. Audio Output device. We will store the required music file onto a storage medium as the onboard memory on a microcontroller is low...
Recent posts

Introduction to Embedded Programming!

In the last sections, we discussed the communication protocols in general and then shifted to discussing the Spi in detail. The last discussions were based on the hardware part of the MCU and Spi peripheral but from this section, we will shift our focus to the software implementation. We have already discussed that any digital circuitry requires binary instructions i.e, we need to provide the machine language(binary) code. Now we can either write our program in assembly language which is more user-friendly than the machine code or we can write in other high-level languages such as C.The assembly code is a low-level code i.e it is much more dependent on the architecture of the processor. Hence the use of a higher-level language such as C is much more efficient as it is portable across all the architectures. There are some cases in which the use of assembly is preferred such as while writing the Reset handlers or accessing the CPU registers, but other than these cases, ...

The Serial Peripheral Interface.

The Spi is one of the most popular communication protocol in the MCU’s. Many of the available components such as an SD card and TFT displays drivers such as ST7735 can be interfaced by using it. This blog will not be centered around any MCU rather it would be just a general overview of the process of data transfer. As discussed in the earlier section, the high-speed data transfer often requires a Sync between the receiver and the transmitter. So this peripheral also requires one line to be the clock. Here it is referred to as the Serial Clock(SCL) line. In every MCU which supports Spi, there will be an SCL line for each of the available Spi’s. Now since we have given a common reference to the MCU’s, we need to have dedicated lines for the data transfer. The Spi is a Full-Duplex communication protocol i.e there are dedicated lines for transferring data as well as receiving it and both transfer and receiving can be done at the same time. It also supports other modes such as the...

Understanding Communication in MCU’s.

This Blog paves a way to understand how Microcontrollers are able to transfer data i.e communicate and it also lays a strong foundation for the upcoming series of blogs which are all related to the specific protocols through which any two MCU’s transfer Information between them. An Embedded system may contain many Mcu’s and hence it becomes very necessary for them to communicate for sharing different information. This blog is a general introduction to various protocols which are involved in the process and in the subsequent blogs we will be focusing on the use of them to communicate our device with many standard devices such as the Sd-Card and the TFT displays. As we know that transfer of Information Requires a transmitter, receiver and a common language.  Here the transmitter and the receiver are the microcontrollers. The common language for such Mcu’s is nothing but the Binary language. There can be two ways in which data is transferred, In the first approach ...

The General Purpose Input/Output.

The GPIO is one of the most frequently encountered acronyms in the embedded domain. It stands for General Purpose Input/Output and exactly does the same thing i.e either it is used to take input or to give output. These are hardware lines which are general purpose in the sense that they are not specifically used for only one functionality by any peripheral. For example, if any MCU contains 8 Gpio’s then one at any given instance one Gpio may be used in taking input from a button, other may be used to give output to an LED and the next one may be used to communicate with other MCU.So by using these Gpio’s an MCU can give/take instructions/inputs from other electronic components such as LED’s, buttons, sensors etc. In a nutshell, the Gpio’s are the mediators through which the internal peripherals such as the different communication protocols, Timers, analog to digital converters can perform there functionalities. In the case of an ADC(Analog to digital converter), It requires a...

Introduction to Microcontrollers.

We often come across these tiny electronic components in our day-to-day  life. These  small Integrated circuits have many applications ranging from your Coffee maker to the ATM  machines. This  blog will be more of an introduction to the world of embedded systems. The term Microcontroller can be understood just by understanding its two components i.e Micro which resembles small size and controller which can be anything used to control/provide instructions to other  components. So  an MCU(microcontroller unit) is a chip which can be used to control various other components such as sensors, relays, Led’s etc. Imagine a scenario in which many people are traveling in a  bus. There  are several locations where any one person may leave the bus and the tickets for different locations are at varying  prices. So  the Conductor of the bus is responsible for providing the tickets to all the passengers and telling the driver when and wh...

Let's Write the Program!

We have completed all the necessary parts required for developing the Software. From understanding SD-Cards as Storage Medium to choosing the right Audio Format to deal with, we have travelled a long way together in our quest to develop our own Music Player. From this post, we will start the last part of this project i.e the software development. Let's divide the software into smaller pieces of code and we will then take a bottom-up approach to develop a finished piece of a efficient and user-friendly software. First, we will start with writing the parser of WAV file in C for our PC and then we will move to our embedded platform. The Input to our WAV parser is a .wav file and it will show the header information as the output. We will create a structure and store the header info in it. The code will open the .wav file, parse it up to the "data" tag in the header and then map the structure from the start of the metadata and hence fill the corresponding values. From t...

Audio Formats.

We have completed our first step towards building a music player by developing a way to store the music files locally on the sd card. Now we will shift our focus towards understanding the way in which music is stored. The first audio was stored as analogue signal transcribe mechanically on a paper or glass but since then we have rapidly developed various other more efficient ways to store an audio signal. The digital formats revolutionized the whole industry as it was easier to store, process as well as replicate. Currently, we deal with various digital formats such as AIFF, AAC, MPEG standard etc. The MP3 is the MPEG-1 Audio layer 3 and is one of the most recognized audio file formats as it uses lossy data compression which drastically decreases the file sizes and is one of the reasons which caused the boom in the music industry in the 1990's. The format itself is quite complex as it uses advanced compression techniques such as the Huffman coding and so we will begin our discussio...