Gul MAR SHAH
KASHIFUALLAH
Introduction
With the advancement in technology the use of microcontroller for communication became very popular. As we know that FM receiver of analogue tuning method is difficult to tune and various environmental effects changes the tuned frequency of FM receiver. In order to overcome the frequency variation problem, various digital tuning methods implement. The use of microcontroller makes it very easy to overcome the above problem by interfacing the FM receiving module with microcontroller to give commands to the TEA5767 module.
For the amplification of the audio signal received by the TEA5767 module, we are using an audio amplifier LM386 circuit.
Side by side we are also alocating space for the Mp3 player in our final product. For Mp3 player we are using DFplayer Mini module.
A two way switch allows user to listen either FM or Mp3.
The prototype is designed using ATmega328 Microcontroller based Arduino UNO development Board.
The main disadvantage of manual tuning is that it is not accurate and various natural factors can change the frequency.
Using digital tuning methods accurate tuning is possible. The prototype is designed to function in auto scan mode in which a channel is searched automatically. The signal level is constantly monitored and the microcontroller is programmed
to set receiver frequency accurately. The output from the TEA5767 module is fed to amplifier section. The antenna can be designed as per the application need.

Aim of the project is to build a device having the characteristics of FM Radio as well as MP3 player.
We three group members ABDUL REHMAN, GUL MAR SHAH, KASHIFUALLAH working to design a device that meets the design requirements. The mechnical design of the project is given below.

High Level Design
The main components of the project are:- The Microcontroller(ATMEGA328)
- TEA5767 FM Module
- DFplayer Mini
- Amplifier Circuit
- LCD

Microcontroller(ATMEGA328)
The Atmel 8-bit microcontroller combines 32 KB ISP flash memory with read-while-write capabilities, 1 KB EEPROM,2 KB SRAM,23 general purpose I/O lines, 32 general purpose working registers, three flexible timer/counters with compare modes, internal and external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface, SPI serial port, programmable watchdog timer with internal oscillator, and five software selectable power saving modes. The device operates between 1.8-5.5 volts. The device achieves throughput approaching 1 MIPS per MHz.

TEA5767 Module:
FM Stereo radio Module is a high sensitivity, low power, ultra-small size of the FM stereo radio module. All-digital single-chip integrated circuits.
High receiver sensitivity,generic I2C bus control,external components,the minimum noise figure. With small size,low power, low cost,a simple,using a wide range of advantages.
The module uses the TEA5767 radio chip, the module used in this project uses the I2C interface, so it is straightforward to use with Arduino.
This FM module has a builtin audio amplifier. But unfortunately, this is amplifier is suitable for headphone, so we cannot connect a speaker to the output of the module directly since the audio signal is very weak.
We need to amplify it first. Also, there is no way to control the volume that comes out of the module with software,
so we are going to use a potentiometer later on. On the module there are two headphone jacks, one is for the antenna,
and the other one is the standard headphone output. The module comes with a small antenna, but you can easily build your own if you wish.


DFplayer Mini Module:
DFPLayer Mini module is a serial MP3 module provides the perfect integrated MP3, WMV hardware decoding. While the software supports TF card driver, supports FAT16, FAT32 file system.
Through simple serial commands to specify music playing,as well as how to play music,volume adjustment up to 30 levels and other functions,easy to use, stable and reliable are the most important features of this module.


LM386:
The LM386 is a power amplifier designed for use in low voltage consumer applications. The gain is internally set to 20 to keep external part count low, but the addition of an external resistor and capacitor between pins 1 and 8 will increase the gain to any value from 20 to 200.
The inputs are ground referenced while the output automatically biases to one-half the supply voltage. The quiescent power drain is only 24 mW when
operating from a 6-V supply, making the LM386 an ideal for battery operation.


LCD:
The Nokia 5110 LCD module is a basic graphic LCD display that can be used in a wide range of applications.
Its operating voltage is 2.7V to 3.3V and current consumption is 6mA. The Nokia 5110 is a basic graphic LCD screen which was originally intended for as a cell phone screen. It uses the PCD8544 controller which is a low power CMOS LCD controller/driver. Because of this, the display has an impressive power consumption.
It uses only 0.4mA when it is on, but the backlight is disabled. It uses less than 0.06mA when in sleep mode! That's one of the reasons that make this display my favorite. The PCD8544 interfaces to microcontrollers through a serial bus interface.
That makes the screen very easy to use with Arduino. You only need to connect 8 wires. I have prepared a detailed tutorial on how to use the Nokia 5110 LCD with Arduino.
LCD consists of 48 rows and 84 columns (84×48) monochrome pixels, It works using SPI interface and can be easily interfaced with Arduino. Nokia 5110 LCD supports decent graphics of bitmap images available in Green and Blue Backlight


Connectivity:
This section tells you how the componets of the prototype is connected with microcontroller.
Connection of FM Module
We connect the ground pin of every part to the breadboard’s ground rail and the Vcc pin of every part to the breadboard’s positive rail except the Potentiometer which will control the volume.
Now, let’s connect the radio module.
The SLC pin goes to analog pin 5 of the Arduino Nano, and the SDA pin goes to analog pin 4. Now we connect the middle pin of the potentiometer to analog pin 0. With this potentiometer, we are going to select the frequency. Now we need to connect the Volume potentiometer to able to control the volume. I used an audio cable. I plugged in one end of the cable to the audio output of the module.
Next, I cut the other end to find 4 wires inside the cable. The module outputs stereo sound, but we are going to use only one audio channel this time. So, I connect only two of the wires. One of them is GND, and the other one is the audio signal which needs to be amplified.
The audio signal wire goes to the input pin of the volume potentiometer. The middle pin of the potentiometer is the audio signal that comes out.
Connection of Amplifier
To amplify the audio signal we use this module which uses the LM386 amplifier chip. The audio signal goes to this pin, the ground pin from the audio cable goes to this pin. Now, all we have to do is to provide power to the module.
So we connect this pin the positive rail of the breadboard and this pin to the negative rail of the breadboard. The only thing that we have to do now is to connect a small speaker to the output of the module like this. With this small potentiometer, we can control the amplification of the signal.
Connecting the Nokia 5110 LCD Display
- RST goes to Digital Pin 5 of the Arduino
- CE goes to Digital Pin 6 of the Arduino
- DC goes to Digital Pin 7 of the Arduino
- DIN goes to Digital Pin 8 of the Arduino
- CLK goes to Digital Pin 9 of the Arduino
- VCC goes to Arduino 3.3V
Connection of Dfplayer mini
This module is following SPI protocol.So its RX pin goes to the digital pin 11 of microcontroller .
similarly, Tx pin goes to the digital pin 10 of the microcontroller.
Rx - D11
Tx - D10
VCC - 5v
Gnd - Gnd
Protocols:
Communication between the microcontroller and other componets are following differs protocol including I2C and SPI protocol.
Microcontroller is communicating with TEA5767 Fm modelusing I2C protocol which means data is transferred bit by bit along a single wire.
While Dfplayer Mini is communicating SPI protocol for receiving data from the heart of circuit(microcontroller).
And the remaining component LCD is also using I2C protocol for its functionality.
Side by side output of Fm is directly amplified by an amplifier circuit in prototype.
A two way Switch is used to select either Fm radio or Mp3 player.
I2C Protocol:
I2C is a serial communication protocol, so data is transferred bit by bit along a single wire (the SDA line).
Like SPI, I2C is synchronous, so the output of bits is synchronized to the sampling of bits by a clock signal shared between the master and the slave.

SPI Protocol:
The Serial Peripheral Interface (SPI) is a synchronous serial communication interface specification used for short-distance communication, primarily in embedded systems. SPI communicate in full duplex mode using a master-slave architecture (alternate terminology being main and secondary) with a single master.

Deligation of Tasks
Taks is divided into the following categories although team work is also considered.Name | task | ABDULREHMAN | Selection of components | ABDULREHMAN | Review of literature/datasheets | KASHIFUALLAH | Design of electrical circuit | GUL MAR SHAH | PCB layout | KASHIFUALLAH | Design of finished product | GUL MAR SHAH | Writing firmware | GUL MAR SHAH | Testing/debugging of hardware | KASHIFUALLAH | Testing/debugging of software | ABDULREHMAN | Report writing (html) |
---|


Intellectual Property and Ethical Considerations
The product we have established as our semester project has some basic references.
We did not created this stuff from level-0 , but we have modified these separate ideas in such a way that we made a durable and a modified version of the original designs.
As our product includes three main items, the first one is the Fm radio. We collected most of the data to develop a radio from one reliable source which is "Arduino.cc".
The second part is MP3 player, we collected its lead from the web-tutorial on "www.electronics-lab.com".
The third one one is the amplifier and in this regard we followed the lead of "www.circuitsbasics.com"
We acknowledge that these were originally created by these sources we modified these three concepts using a microcontroller on board and developed a single new product.
We would like to keep our project as Open-Source thats why we are providing zip files. Any one can interested in this project can use these resources to design this prototye.
Commercialization Aspects
This product goes commertial on a higher level. The cost of this product is around 1800 rupees. We are providing a product having Fm radio ,Mp3 player and an interesting colourful LCD. So, you can easily see the running frequency and song.

The Design Process
The design process has several layers to it. Electrical Design, PCB layout, Software Design and the Final Hardware package.Electrical Circuit
For electrical design of protype we use arduino uno for testing purpose. Before that we came up with amplifier circuit so that the output signal coming from the FM module must be amplified up to the audible range. To display the FM radio frequency, we interfaced an LCD with arduino. MP3 player is controlled through two buttons.
Following picture is all about electrical design.


Circuit Board Layout
A printed circuit board (PCB) mechanically supports and electrically connects electronic components or electrical components using conductive tracks, pads and other features etched from one or more sheet layers of copper laminated onto and/or between sheet layers of a non-conductive substrate. Fabrication of the PCB is done by using EAGLE software. For that first of all schematic file is designed after that we headed towards printed circuit board.
Schematic:
Schematic is basically a circuit diagram. It uses agreed symbols to represent components and shows how they are electrically connected. Following figure shows the schematic file generated in the Eagle file.

Board Layout:
A Gerber file is basically an image of a PCB. It showcases each individual layer as it appears throughout your circuit design. Gerber files represent copper layers images, solder mask, legend, and drill and route data helping to simplify the process of seeing how the circuit board should be fabricated.

Outline:
Before placing footprints we need to create a board outline. The board outline must be drawn on the Board OutLine layer. So,set Board OutLine as the active layer. This layer is all about the boundary of the pcb board.

Traces:
In the picture below, there are traces that electrically connect the various connectors and components to each other. A PCB allows signals and power to be routed between physical devices. Traces are made by 1/64 pin header.

Drills:
PCB drill hole is one of the important part for PCB design. Two main technologies that are used to produce accurate and repeatable holes of microns in diameter are mechanical drilling and laser drilling. The through hole diameters can range from 50-300 microns and run about 1-3 mm deep using these PCB drilling techniques. we are using a 1/32 (inch) tool for the drills.

PCB:

Software Development
Coding is also a major part of the prototype. Writing proper code according to our requirements is also a challenging part of this project. The following flow chart is easy for understanding purpose that how code is executing in microcontroller:

Design of finished Product
CAD design for the prototye is necessary to give the proper shape. For our implementation we have used Solidworks as our CAD sofware. We developed our design through the skteches.
Results
FM radio receiver is implemented using TEA5767 Module. The TEA5767 Module is successfully interfaced with ATMEGA328. Using TEA5767 module frequency tuning can be done accurately through software. The soldering of PCB traces with TEA5767 module requires special tools and skill. The audio signal obtained from the MP3 module is much more reliable, unlike the analogue signal obtained FM Receivers. LCD displays channel information. We have used a potentiometer as input device to tune to different channels. Similarly, ATMEGA328 also operating our Dfplayer Mini. we can forward/backward the songs by pressing forward/backward button. Volume is increased by continuous pressing forward button and Volume is decresed by continuous pressing backward button.

Project Description:
Conclusions
Embedded Systems is all about the controlling the dedicated function. It includes the electrical, mechanical and computing constraints. In the electrical domain, we majorly talked about microcontrollers their used for soft and programmed running of any device. While we learnt a lot of softwares for desinging PCB, designing casing etc. During this course we people go through a lot of phases. This is first time in the histroy of department that a course is fully based on practical work. Hence practical work is much more different from theoretical. During the project we faced a lot of difficulties. All of them are sorted out during the troubleshooting.
Appendix
This section should contain all your Eagle Circuit/PCB Layouts files, Arduino Code, Solid work Desings etc.PCB Files
Arduino Code
CAD design
Bill of Materials
This details of components required for implementation of this project.
No. | Component | Package | Quantity |
---|---|---|---|
1 | LED | LED1206FAB | 2 |
2 | Voltage Regulator | LM1117 | 1 |
3 | Capacitor 10uF | C1206FAB | 4 |
4 | Capacitor 100uF | C1206FAB | 1 |
5 | Capacitor 22pF | C1206FAB | 2 |
6 | Capacitor 0.1uF | C1206FAB | 3 |
7 | Capacitor 1000uF | C1812K | 1 |
8 | LM386N-1 | DIL08 | 1 |
9 | LM386N-1 | Jacket | 1 |
10 | Resistor 499 ohm | R1206FAB | 2 |
11 | Resistor 10k ohm | R1206FAB | 2 |
12 | Resistor 1k ohm | R1206FAB | 1 |
13 | Resistor 0 ohm | R1206FAB | 4 |
14 | TEA5767 | Tj-102BC | 1 |
15 | DFplayer | DFplayer | 1 |
16 | Connector | 1x02 | 7 |
17 | Connector | 1x08 | 1 |
18 | Connector | 1x03 | 3 |
19 | Connector | 1x01 | 1 |
20 | Connector | AVRISP 2x03 | 1 |
21 | Connector | 1x06 | 1 |
22 | ATMEGA328 | TQFP32-08 | 1 |
23 | Crystal Oscillator | HC49U70 | 1 |
24 | Sliding Switch | EG1218 | 1 | 25 | Speakers | N/A | 2 |
The following picture is showing the bill of material required for this prototye.

Report Submitted on Time | 7 December 2019 |