SlideShare a Scribd company logo
1 of 33
Sound-Level Meter
System Design and
Development
MicroelectronicApplications
Andrew Dilucia A10938
2
Contents
Introduction........................................................................p3
Experiment 1&2
Investigation of Light Emitting Diodes (LEDs).....................p4
Investigation of a Comparator..............................................p7
Experiment 3
Investigation of a Peak Detector Circuit..............................p10
Experiment 4
Investigation of a Digital to Analogue Converter................p13
Experiment 5
Investigation of a Switched Capacitor Filter........................p19
Experiment 6
Investigation of a PIC Microcontroller.................................p24
System Integration...............................................................p30
Conclusion..........................................................................p31
References..............................................................................p32
3
Introduction
For this laboratory programme I was tasked with creating a low cost, flexible sound level
meter for use within the entertainment industry as well as the health and safety industry. The
sound level meter should be designed around a PIC microcontroller (16F84 or 16F88) that
uses a programmable low pass filter. During the course of my investigations I was to build a
prototype and if I were successful, we could go ahead and mass produce the meter in order to
bring down the cost even further. This report has been created to document the various stages
of my investigations of building a prototype meter. Below is a block diagram of the proposed
overall system.
Overall system block diagram
(Cowey 2014)
As you we can see from the picture above, the overall system can be broken down into six
separate sub-systems. For my investigations I started with sub-system F (the LED display)
and continued backwards through sub-systems E to A. The prototype meter was created by
designing, building and testing individual sub-systems on bread boards and all experiments
were performed in the lab with the relevant Integrated Circuits (I.Cs). The information in this
report has been put together over a semester (following guidelines set out in the student
handout) and it includes information from both the lectures and practical sessions, plus
information gathered through student self learning.
4
Investigation of Light Emitting Diodes (LEDs)
The first subsystem I investigated was system F, a Light Emitting Diode (LED). LEDs are
part of the diode family and are semiconductor devices that allows current to flow through it
in one direction but not the other direction.
“A diode is a semiconductor component that lets current flow through it in one direction but
blocks current in the other direction depending on the polarity of the voltage applied to it”
(Frenzel, Jr, 2010, p50).
V-I Characteristics of a Diode
(Storr, 2014a, Accessed 2014)
From the V- I characteristics graph (as seen above), we can see that the diode switches on at
about 0.6V. This means that when the voltage applied reaches 0.6V or greater a forward
current begins to conduct through the diode.
A light emitting diode is similar to a conventional diode, but it is constructed with different
materials. It has been stated that LEDs are Gallium Phosphide(GaP) or Gallium-Arsenide-
Phosphide(GaAsP) devices and when a forward bias voltage applied across the diode is
greater than the voltage that turns it on, the LED gives out energy in the form of light (Green
1999).
5
LEDs are extremely common and are used throughout industry. They are perfect for the
system I am developing because they have low power consumption and they instantaneously
switch-on, which is vital for our new products, with regards to accuracy. They also are low in
price, which helps keep overall costs to a minimum and they last a long time, which is good
for reliability.
The picture below shows LEDs I-V curve characteristics for the different colours and as we
can see the curves are different for each colour;
I – V Characteristics of an LED
(Storr, W. (2014b) Accessed 2014)
An LED must be connected in series with a resistor so the forward current is limited when it
conducts current, otherwise it will overheat and stop working. An LED has some
specifications and they should be followed when using otherwise there will be problems.
"If more current passes through an LED than its maximum rating specifies, the LED burns up
like a marshmallow in a campfire" (Ross et al, 2010, p121).
So to begin with I needed to consult the Data sheet that came with the experiment instructions
to find out its maximum values. The LED we were using was the colour Red so I found out
that the LED I was using had a maximum operating current of 20mA, however it was
typically operated at 15mA and the LED had a turn on voltage of 2.2V. With this information
I could calculate the size of the resistor that would drop enough voltage to create the correct
size of current that was needed for the LED to work correctly which is 15mA or 0.015A.
6
Using the formulas;
Vr = Vcc – Vled & R =
𝐕
𝐈
So if Vcc = 5V and Vled = 2.2V
Vr = Vcc – Vled = 5V – 2.2V = 2.8V
Then when using Ohms law and wanting to drop 2.8V and to use a forward current of 0.015A
R =
𝐕
𝐈
=
𝟐.𝟖
𝟎.𝟎𝟏𝟓
= 186.6 Ω
So the resistor that I needed to use needed to be at least a value of 186.6Ω. However the
nearest value we had in the stores was 220Ω and this is the resistor I used in this circuit. From
this information I could design a circuit to test this theory. Below is my circuit diagram.
LED test circuit diagram
From this circuit diagram I built the circuit using the correct components from the store and
began to test the subsystem. I did this by connecting a regulated 5V power supply to the
circuit. When the switch to the power supply was turned on the LED illuminated which is the
outcome I was looking for.
To conclude this circuit was easy to construct. So as it worked correctly first time it was a
success and it proved the circuit was designed and built correctly.
7
Investigation of a Comparator
The comparator is an electronic device, which compares two voltages or currents on its inputs
and switches to give an output according to which is larger.
Basic Comparator Schematic
(Wikipedia, 2014, Accessed 2014)
For my test circuit the comparator will be comparing two voltages to give an output that will
make the LED illuminate. For my overall system this will be the component that will switch
the LED on by comparing the sound level input in the form of a sine wave with the reference
level from the PIC microcontroller and the reference level would be set to the desired level
for the application the meter was being used for.
For my investigations I used an LM311 comparator IC and it is a monolithic, low input
current voltage comparator and this device is also designed to operate from a dual or single
supply voltage of 5V. It also has fast response times and strobe capabilities.
For this part of my investigations I had to design a circuit that would be combined with my
LED circuit from earlier to test the operation of a comparator. First I had to consult the data
sheet that was given with the investigation instructions to be aware of the pin layout and the
devices absolute maximum ratings to find out what`s the LM311s best operating conditions.
Below is the pin layout diagram for the LM311.
LM311 Pin Layout Diagram
(Texas Instruments Incorporated, 2003, Accessed 2014)
8
The picture below is the LM311s absolute maximum ratings,
LM311 Absolute Maximum Ratings
(Texas Instruments Incorporated, 2003, Accessed 2014)
The picture below is the recommended operating conditions of the device.
LM311 Recommended Operating Conditions
(Texas Instruments Incorporated, 2003, Accessed 2014)
I then had to find the simplest circuit suggested in the data sheet and modify it to incorporate
my LED circuit. On the next page is the picture of the simplest circuit.
9
Basic Comparator Circuit
(Texas Instruments Incorporated, 2003, Accessed 2014)
From all of the information in the data sheet I could design a circuit to test the comparator.
Below is my circuit diagram.
Comparator test circuit diagram
From this circuit diagram I built the circuit using the correct components from the store and
began to test the subsystem. An LED was connected to the output of the comparator (Pin 7),
with a resister connected in series to a power supply of 5V to protect the LED. The emitter
out was connected to ground (Pin1). Two power supplies were connected in parallel to give
us a positive and negative Vcc (Pins 8&4). I then connected a 5V supply to Pins 5&6 and set
the threshold voltage at Pin 2 to 5V. I then connected a variable power supply to the inverting
input at Pin 3. Then starting at 0V the LED showed no change, so I increased the voltage on
Pin 3 and still no change. Then when the voltage was increased to greater than the pre-set
threshold of 5V the LED illuminated which is the outcome I was looking for.
To conclude this circuit was easy to construct. So as it worked correctly first time it was a
success and it proved the circuit was designed and built correctly.
10
Investigation of a Peak Detector
A peak detector is a circuit that is a combination of an op-amp, with a diode, a capacitor and
a resistor connected to the output. The diode is forward biased and this charges the capacitor.
At the highest level of the signal, the capacitor charges and holds this charge while the diode
is reverse biased. The circuit would be unresponsive to levels below 0.6V because the diode
has a switch on voltage of 0.6V so to compensate a negative feedback loop is used.
For my investigations I used a 741 op-amp. Below are pictures of the pin layout diagram and
absolute maximum ratings from the data sheet.
741 Op-Amp Pin Layout Diagram
(Texas Instruments Incorporated, 2000, Accessed 2014)
741 Op-Amp Absolute Maximum Ratings
(Texas Instruments Incorporated, 2000, Accessed 2014)
11
As I mentioned earlier a diode, capacitor and resistor is connected at the output of the 741 op-
amp. The diode was used to chop the negative half of the cycle to leave to positive side. A
time constant was needed so that when the peak level was reached the LED would illuminate
long enough so that it could be detected by the human eye. For this a capacitor and resistor
were used to create this, so I had to choose values for these components.
First I had to choose a time constant that I wanted to achieve, which was 0.2s. Then a
capacitor value which was 1µF. From this information I could calculate the resistor needed to
achieve a time constant of 0.2s.
τ =
𝟏
𝐑𝐂
τ = RC τ = 0.2
C = 1µf CR = 0.2 R =
𝟎.𝟐
𝟎.𝟎𝟎𝟎𝟎𝟎𝟏
= 200kΩ
So for a time constant of around 0.2s I needed a resistor of 200kΩ, however the nearest
preferred value we had in the store was 220kΩ and this is the value I used in my circuit.
From this information I could design a circuit to test the peak detector. Below is a picture of
the circuit I used.
Peak Detector test circuit diagram
12
From the picture on the previous page you can see I again used two power supplies in parallel
to create +5V & -5V and this was connected to pins 7 & 4. As I mentioned earlier the diode is
connected to the output at pin 6 but is also connected at the negative input at pin 2 providing
a negative feedback loop. The capacitor and resistor are also connected at pin 6 (after the
diode) and ground. Next I connected this peak detector circuit with the comparator and LED
circuit from earlier between pin 2 on the 741 op-amp and pin 3 on the comparator. I then
connected to pin 3 on the 741 op-amp a function generator to create a 5kHz sine-wave with a
5V peak to peak amplitude.
I then observed that the output of the diode was chopping the negative half of the cycle,
leaving just the positive half. We also observed the overall output and could use the
oscilloscope to see the time delay that the time constant had created. This helped the sine-
wave decay slower through the capacitor making the output visible to the eye. Also when I
altered the DC reference voltage, the LED switched on when it reached and passed the
threshold of 0.6V. At the oscilloscope display I observed that at every cycle the capacitor
charges and discharges slightly to smooth the signal. Also the signal size is proportional to
the size of the amplitude of the frequency and at higher frequencies the capacitors discharge
is negligible.
To conclude this circuit was quite easy to construct. The Led illuminated when it was
suppose to and the readings on the oscilloscope was what I was trying to achieve. So as it
worked correctly it was a success and it proved the circuit was designed and built correctly.
13
Investigation of a Digital to Analogue
Converter (DAC)
Within electronic systems information needs to be converted between analogue and digital
states and to do this, Analogue to Digital Converters (ADC) and Digital to Analogue
Converters (DAC) are used.
“Circuitry is, therefore, required that is able to interface between the
analogue world outside the system and the digital system itself. The two interface circuits that
are necessary are the ADC and the DAC” (Green, 1999, p329).
For my investigations I focused on a DAC and this operates by inputting a binary number and
outputting an analogue current or voltage signal. Below is a block diagram that shows this;
DAC Operation Block Diagram
(All About Circuits, 2015, Accessed 2015)
The DAC I used was an MC1408 IC. This DAC is based around an R-2R resistor ladder and
the output is dependent on the binary input on each input switch.
14
First I checked the data sheet for the MC1408 to consult the absolute maximum ratings, so to
be aware of them so I did not damage the device. The picture below shows the absolute
maximum ratings.
MC1408 Absolute Maximum Ratings
(Philips Semiconductors Linear Products, 2003, Accessed 2015)
Then I had to find the simplest DAC circuit suggested in the data sheet. The picture below
shows this circuit.
Simplest DAC Circuit
(Philips Semiconductors Linear Products, 2003, Accessed 2015)
15
Next I had to consult the DC electrical characteristics on the data sheet to be able to choose a
suitable power supply. The picture below shows the DC electrical characteristics.
MC1408 DC Electrical Characteristics
(Philips Semiconductors Linear Products, 2003, Accessed 2015)
I then consulted the data sheet to identify the digital input pins and find which pins are the
MSB and LSB. The MSB is pin 5 and LSB is pin12, and are highlighted in the pin layout
diagram below.
MC1408 Pin Layout Diagram
(Philips Semiconductors Linear Products, 2003, Accessed 2015)
16
Next I had to choose adequate values for the resistors and capacitors in the circuit. The
resistors I chose were all 1kOhm and the capacitor which provides noise suppression for the
circuit was 15µf. I then had to choose an adequate reference voltage for the investigation. I
chose around 2V and to achieve this I had to design a potential divider circuit that would be
connected to between pin 14 and +5V. After some testing, the final design of the potential
divider gave me a VREF of 2.1V. From this information I designed a circuit to test the DAC
which is shown in the picture below. The potential divider circuit is highlighted in the red
section.
DAC test circuit diagram
At the output of the DAC, an Op-amp is required because the output signal is current and I
needed it converted to an output voltage. The Op-amp circuit (highlighted in blue) needed a
negative feedback resistor to create the correct output voltage and as you can see I also chose
a 1kOhm value for RO.
17
With the values of the VREF and resistors, I could calculate that the outputs should be what I
was expecting them to be.
VREF = 2.1 Ro = 1kOhm R14 = 1kOhm R15 = 1kOhm
So to calculate the output of the DAC (Io);
IREF =
𝐕𝐑𝐄𝐅
𝐑𝐑𝐄𝐅
0.0021A =
𝟐.𝟏𝐕
𝟏𝟎𝟎𝟎Ω
0.0021A = 2.1mA
IREF = Io Io = 2.1mA
As I mentioned earlier I need to now convert the DACs output from current to voltage and
this is achieved with the use of a 741 Op-amp. So to calculate what voltage (Vo) is expected
at the output of the 741 Op-amp;
VOUT = Io x Ro 2.1V = 2.1mA x 1000Ω
2.1V = 0.0021A x 1000Ω Vo = 2.1V
As I mentioned earlier the DAC I used was an MC1408 IC but as we were not using a PIC
microcontroller for this part of my investigations, I had to simulate the binary inputs. I did
this by connecting a DIL switch with an in-line resistor at pins 5 to 12 on the DAC to
simulate either logic 0 or 1 (low/high) states. In the final overall design of the sound level
meter, the PIC will send the signals to the DAC and then the DAC sends a reference level to
the Analogue Comparator. Finally I connected a volt meter at the output of the 741 Op-amp
and applied the power supplies that were required as shown in the DAC test circuit diagram.
Next I needed to simulate the binary inputs and measure the output voltage preferably with
results for 0, ¼, ½, ¾, and of course a full output.
To achieve this, the binary inputs were 00000000, 01000000, 10000000, 11000000,
11111111. Using the individual switches on the DIL switch, I simulated these numbers and
recorded the output voltage for each number in the table on the next page.
18
DAC Test Results Table
VREF Fraction Binary Input Output Voltage
0 MSB 00000000 LSB 0V
¼ MSB 01000000 LSB 0.51V
½ MSB 10000000 LSB 1.05V
¾ MSB 11000000 LSB 1.56V
Full MSB 11111111 LSB 2.1V
As we can see from the results table, each time I inputted a binary number the output voltage
increased by a quarter and this is the response I was expecting to achieve. From the results
table I then plotted the graph that shows the relationship between the output voltage and the
binary numbers (shown below).
DAC Test Results Graph
From this graph we can see that the relationship between the output voltage and the binary
numbers is of a linear nature.
To conclude this circuit was quite difficult to construct however, I was able to complete my
investigations successfully. At each binary input, the output voltage altered by the correct
percentage that was expected. So as it worked correctly it was a success and it proved the
circuit was designed and built correctly.
19
Investigation of a Switched Capacitor Filter
(LMF100)
For the sound level meter, I needed to investigate possible low pass filters to block any
unwanted frequencies on the input of the circuit. I needed to do this because I am only
interested in audible frequencies that human ears can hear ranging between 20Hz & 20kHz.
The filter I used was an LMF100 High Performance Dual Switched Capacitor Filter.
Switched Capacitor Filters are ICs and, are used throughout microelectronic applications
because they have a low cost compared to highly accurate conventional filters made to a
microelectronic scale and this would be good for keeping the overall cost and size of the
sound level meter to a minimum. Conventional filters rely on the ratio between resistors and
capacitors, where switched capacitor filters only rely on the ratio between the capacitors
values.
Switched Capacitor Filter Circuit Schematic
(Cheever, 2015, Accessed 2015)
The LMF100 Switched Capacitor Filters are extremely accurate and they are very versatile.
One output could be used to create either, all pass, high pass and notch functions, while the
other two outputs are equipped to perform low-pass and band-pass functions. They operate up
to 100kHz and can be used as a 2nd or 4th order filters.
20
First I checked the data sheet for the LMF100 to consult the pin layout diagram and the
absolute maximum ratings, so I did not damage the device. The pictures shown below are of
the pin layout diagram and the absolute maximum ratings.
.
LMF100 Pin Layout Diagram
(National Semiconductor Corporation 1995, Accessed 2015)
LMF100 Absolute Maximum Ratings
(National Semiconductor Corporation 1995, Accessed 2015)
I then had to consult the data sheet to find the simplest circuit to base my circuit design on.
On the next page is the picture of the simplest circuit and its frequency response graph.
21
Simplest Switched Capacitor Filter Circuit
(National Semiconductor Corporation 1995, Accessed 2015)
The circuit in the picture above is a 4th order 100kHz Butterworth Low-pass Filter which
means the cut off frequency (fc) is at 100kHz. For the system I am developing, this fc is way
too high for the applications we were thinking of using it for so I needed to modify this
circuit to make it applicable to my needs. In the final design of the product I would like to be
able to alter the cut off frequency depending on the different applications needed for the
product.
For this investigation I wanted a cut off frequency of 1kHz instead of 100kHz and to achieve
this, the clock input needed to be altered from 3.5MHz to an appropriate value because the
input clock frequency is proportional to the cut off frequency. To calculate this I divided
3.5MHz by 100.
𝟑.𝟓𝐌𝐇𝐳
𝟏𝟎𝟎
=
𝟑𝟓𝟎𝟎𝟎𝟎𝟎
𝟏𝟎𝟎
= 35000 = 35kHz
So to achieve a 1kHz cut off frequency the clock input must be set to 35kHz. Also four
values for resistors were needed to be altered in the simplest circuit from the data sheet. With
this information I could then design a circuit to test the filter. The circuit I designed is
illustrated in the picture on the next page.
22
1kHz Switched Capacitor Filter Test Circuit Diagram
I then constructed the circuit with the correct power supply and clock frequency set. The
clock frequency was created on the ttl output on a function generator using a square wave
output. The clock frequency was set to 35kHz and as the clock frequency basically sets the
cut off frequency, this made the filter a 1kHz filter.
I then entered a range of sine-waves with different frequencies ranging from 10Hz to 20kHz
at pin 4 of the LMF100 via the 56kΩ resistor. I then was able to view the output from pin 16
and record the readings in the table below.
Switched Capacitor Filter Test Results Table
Freq / Hz Vin Pk Vout Pk Gain Av dB
10 1 1 1 0
20 1 1 1 0
50 1 1 1 0
100 1 1 1 0
200 1 1 1 0
500 1 1 1 0
1k 1 0.75 0.75 - 2.50
2k 1 0.075 0.075 - 22.5
5k 1 0.004 0.04 - 48.0
10k 1 Unreadable N/A N/A
20k 1 Unreadable N/A N/A
50k 1 Unreadable N/A N/A
100k 1 Unreadable N/A N/A
23
From the results in the table as seen on the previous page I could then plot a graph depicting
the frequency response of the filter. Below is a picture of the graph.
1kHz Switched Capacitor Filter Frequency Response Test Results
Graph
From this graph I could see that the filter had about a 3dB drop off, 2.5dB to be precise at
1kHz, which proved I had altered it correctly to work as a 1kHz low-pass filter. Also we can
see a drop of around 24dB per octave proving it was a forth order filter.
To conclude this circuit was quite difficult to construct however, I was able to complete my
investigations successfully. So as it worked correctly it was a success and it proved the circuit
was designed and built correctly.
24
Investigation of a PIC Microcontroller
Microcontrollers are a single integrated circuit which has a CPU, memory and input/output
interfaces within it. It is like a microcomputer system in one small chip. It is suitable for
various applications because of versatile input/output capabilities and with it being a single
integrated circuit the power requirements are low for a system. A microcontroller is an
excellent bit of kit as you can connect it to a PC via a development board to program it with
C programming language and reprogram it with little effort other than altering some code.
"The great thing about a microcontroller is that you can simply alter a few lines of code or
reprogram it completely to change what it does; you don't need to swap out wires, resistors
and other components in order to get this flexible IC to take on a new personality"
(Ross et al, 2010, p161).
The first microcontroller I researched was the PIC16F84 but soon realised that with the
PIC16F84 it would be very difficult to produce a good solid square-wave signal. So then I
researched the PIC16F88 and this has pulse width modulation as a feature, so this is perfect
to produce the solid square-wave required. Below is a picture of the 16f88s pin layout
diagram and the absolute maximum ratings are shown on the next page.
PIC16F88 Pin Layout Diagram
(Microchip Technology Incorporated 2005, Accessed 2015)
25
PIC16F88 Absolute Maximum Ratings
(Microchip Technology Incorporated 2005, Accessed 2015)
For the programming of the PIC I used some software called Flowcode. This is a graphical
programming tool using flowcharts that simplifies programming and is especially useful for
inexperienced programmers. For my investigation I wanted to be able to push a button to
switch between states to alter the cut off frequency, level, period and duty cycle. The cut off
frequencies I was hoping to achieve were 1kHz and 200Hz. So to calculate what PWM time
period and duty cycle needed to create a cut off frequency of 1 kHz I used the formula below.
[ (PR2) + 1 ] x 4 x Tosc x (TMR2) = PWM Period
T =
𝟏
𝐟
f =
𝐟𝐨𝐬𝐜
𝟒
=
𝟒
𝐟𝐨𝐬𝐜
T =
𝟏
𝐟
Tosc =
𝟏
𝐟𝐨𝐬𝐜
fc = 35kHz (for fc = 1kHz)
26
TPWM =
𝟏
𝐟𝐜
=
𝟏
𝟑𝟓𝟎𝟎𝟎
= 28.57µsecs = 29µsecs
29µsecs = [ (PR2) + 1 ] x 4 x 0.25µsecs x 1
= PR2 + 1µsecs
PR2 = 29 – 1 = 28
PWM Duty Cycle = (CCPR1L:CCP1CON<5:4>) x Tosc x (TMR2)
14 = (“10 bit binary number”) x 0.25 x 1
“10 bit” =
𝟏𝟒
𝟎.𝟐𝟓
= 56
CCPR1L =
𝟓𝟔
𝟒
= 14
So for a cut off frequency of 1kHz the PR2 = 28 and the CCPR1L = 14. As we can see the
CCPR1L is around half the value of the PR2, so to simplify calculating these values for a cut
off frequency of 200Hz it is done as shown on the next page.
27
fc = 35kHz (for fc = 1kHz)
TPWM =
𝟏
𝐟𝐜
=
𝟏
𝟔𝟔𝟎𝟎
= 151µsecs
PWM Duty Cycle =
𝟏𝟓𝟏
𝟐
= 75.5 = 76
So for the separate frequencies, the required values needed are shown below.
State 1
Level 1 = 100 Period1 = 28 Duty1 = 14 PWM = 35kHz fc = 1kHz
State 2
Level 2 = 200 Period2 = 151 Duty2 = 76 PWM = 6.6kHz fc = 200Hz
When the PIC is in state one and level 1, the DAC receives 1 volt from the PIC and when the
PIC is running the program in state 2 and level 2, the DAC receives 2 volt from the PIC.
As I mentioned earlier in this chapter I used Flowcode to program the PIC16F88 and one of
the benefits of this software is that you can simulate the circuit to check that the code works
correctly. For my investigation I wanted to use two individual switches to switch between
states. There will be one to switch between frequencies and the other switch to switch
between levels 1& 2.
I opened Flowcode and selected the PIC16F88 and clicked ok. I then changed the clock speed
to 4000000Hz or 4MHz, the oscillator to XT and turned the watchdog timer off. I added two
switches, an LED array and a PWM to the panel. Then I added some constants that were the
values from the two states as seen above on this page to the sketch. Next I compiled the
flowchart adding the relevant components like switches, inputs and outputs etc.
On the next page is the flowchart I built in Flowcode that will be tested.
28
Flowchart Built in Flowcode
When the flowchart as seen above was built, I could run the simulation to check to see if the
code had been compiled correctly. When I activated the first switch the PWM changed and
when I activated the other switch, the levels changed between levels 1 & 2.
29
As the simulation test was a success I was ready to program the PIC16F88 via a development
board and test it while connected to the switched capacitor filter. So I clicked on compile to
hex, which in turn created a hex file. I then created a PPP file and could now upload the
program to the PIC via a USB and the PIC development board.
I then connected the development board to the switched capacitor filter at pin 10 to alter the
clock input when pushing a button on the development board. A function generator was
connected to the filters input to create a sine-wave and an oscilloscope connected to the
output.
When running the program on the development board and pushing the button I could see on
the oscilloscopes display that the cut off frequency changed between 203Hz & 1060Hz.
To conclude, this investigation was quite difficult to complete, however it was made easier
with the use of Flowcode rather than a generic C compiler program. Also the use of the
development board made things easier when testing the code. So as the investigation gave the
required results that were expected, it proves the PIC was programmed correctly.
30
System Integration
Through my investigations I have designed and tested each sub-systems starting with an LED
display. First I had to choose an appropriate resistor value to protect the LED and provide the
correct operating current to switch the LED on. Then I investigated the LM311 comparator,
which was connected to the LED circuit and would act as a switch, controlling when the LED
illuminated. Next was the investigation of a peak detector circuit with a 741 Op-amp. A
negative feedback loop was created, using a diode between the output and the negative input
on the Op-amp. With the diode on the output, the output signal was chopped and this was
what I was aiming for because I was only interested in the peak level. After the diode, a
capacitor and resistor were connected in parallel to the circuit to create a time constant so that
the LED illuminated long enough to be detected by the human eye. I then moved on to the
MC1408 DAC and this would convert the output of the PIC so that it could be used as an
analogue reference voltage for the comparator sub-system to compare with the sound level at
the input of the overall circuit. Next was the LMF100 switched capacitor filter and this is
needed to block any unwanted frequencies on the input because I was only interested in
audible frequencies detectable by the human ear. Next was programming the PIC 16F88
microcontroller, using a development board and Flowcode.
In the lab this is as far as I got but I would like to revisit this at a later date where I would
remove the DIL switch from the DAC sub-system and connect the outputs of port b on the
PIC in their place. Then the output of the DAC via a 741 Op-amp would be connected to the
comparator. I would then connect the PIC development board to the switched capacitor filter,
which in turn would be connected to the peak detector circuit, which is already connected to
the comparator and LED circuit. After all this, the overall system would be available for
some testing. At this stage I would set the PIC program going and observe if the correct
output of the LEDs on the development board were the same binary inputs I would be
expecting to see sent to the DAC. Then I would generate say a 1kHz, 1 volt peak to peak
sine-wave at the input of the switched capacitor filter. So then if the level of the sine-wave
was greater than that of the DAC output, the LED should illuminate.
31
Conclusion
To conclude, every investigation was completed successfully, therefore the project to design
and build a low cost sound level meter was a success. The PIC16F88 microcontroller used
within the system is very efficient for controlling the reference voltage and is low in price.
The other components within the meter are perfect for the project and also low in cost. This
also proves that the sound level meter was designed and built to the specifications.
Moving forward, after testing each sub-system and achieving the results I was hoping for, I
can think about transferring my overall circuit design via some software to a printed circuit
board. I also can start thinking about the design for the products casing and user interface.
Maybe if costs can be kept to a minimum, replace the LED with a LCD screen to give an
actual decibel reading.
In the future there would be further design needed so that the consumer could easily switch
between different reference voltages and to be able to control the clock input on the switched
capacitor filter, so that the cut off frequency could be altered easily for the different levels
required for various applications.
32
References
All About Circuits (2015) Digital – analog Conversion [Online]. Available from:
<http://www.allaboutcircuits.com/vol_4/chpt_13/1.html> [Accessed 3rd January 2015].
Cheever, E. (2015) Switched Capacitor Circuits [Online]. Swarthmore: Swarthmore
College. Available from:
<http://www.swarthmore.edu/NatSci/echeeve1/Ref/FilterBkgrnd/SwitchedCap.html>
[Accessed 4th January 2015].
Cowey, J. (2014) Microelectronic Applications Assignment Specification. Leeds: Leeds
Metropolitan University. [Online / Moodle].
Frenzel, Jr. L. E. (2010) Electronics Explained: The New Systems Approach to Learning
Electronics. Oxford: ELSEVIER.
Green, D. C. (ed.) (1999) Digital Electronics. 5th ed. London: Pitman Publishing Limited.
Microchip Technology Incorporated. (2005) PIC16f88 Data Sheet. [Internet], Available
from: <http://ww1.microchip.com/downloads/en/DeviceDoc/30487c.pdf> [Accessed 1st
January 2015].
National Semiconductor Corporation (1995) LMF100 High Performance Dual Switched
Capacitor Filter [Online]. Available from:
<http://pdf.datasheetcatalog.com/datasheet/nationalsemiconductor/DS005645.PDF>
[Accessed 1st January 2015].
Philips Semiconductors Linear Products (2003) MC1408-8 8-bit Multiplying D/A
Converter [Online]. Available from:
<http://pdf.datasheetcatalog.com/datasheet/philips/MC1408-8_3.pdf> [Accessed 1st January
2015].
Ross, D., Shamieh, C., McComb, G. (2010) Electronics for Dummies. Chichester: John
Wiley & sons Ltd.
Storr, W. (2014a) The Signal Diode [Online]. Available from:
<www.electronics.ws/diode/diode_4.html> [Accessed 26th December 2014].
Storr, W. (2014b) The Light Emitting Diode [Online]. Available
from:<http://www.electronics-tutorials.ws/diode/diode_8.html> [Accessed 26th December
2014].
33
Texas Instruments Incorporated (2000) µA741, µA741Y GENERAL-PURPOSE
OPERATIONAL AMPLIFIERS Data Sheet [Online]. Available from:
<http://pdf1.alldatasheet.com/datasheet-pdf/view/177405/TI/UA741.html> [Accessed 28th
December 2014].
Texas Instruments Incorporated (2003) LM111 LM211 LM311 Data Sheet [Online].
Available from: <http://www.ti.com/lit/ds/symlink/lm311.pdf> [Accessed 27th December
2014].
Wikipedia (2014) Comparator [Online]. Available from:
<http://en.wikipedia.org/wiki/Comparator> [Accessed 27th December 2014].

More Related Content

What's hot

30.led .projects
30.led .projects30.led .projects
30.led .projectsToz Koparan
 
Cdi t1 12_gen_unit1&amp;2_revision_notes_eot
Cdi t1 12_gen_unit1&amp;2_revision_notes_eotCdi t1 12_gen_unit1&amp;2_revision_notes_eot
Cdi t1 12_gen_unit1&amp;2_revision_notes_eotCDI Aljeer
 
EWB practical workbook
EWB practical  workbookEWB practical  workbook
EWB practical workbookserjani
 
Electronics Project Book
Electronics Project BookElectronics Project Book
Electronics Project BookVarun Bansal
 
Report Automatic led emergency light
Report Automatic led emergency lightReport Automatic led emergency light
Report Automatic led emergency lightVatsal N Shah
 
Light Sensor (Auto Light on off)
Light Sensor (Auto Light on off)Light Sensor (Auto Light on off)
Light Sensor (Auto Light on off)Haziq Naeem
 
Getting Started with Arduino
Getting Started with ArduinoGetting Started with Arduino
Getting Started with ArduinoSiddharth Bhatter
 
Fundamentals of electrical and electronics engineering
Fundamentals of electrical and electronics engineeringFundamentals of electrical and electronics engineering
Fundamentals of electrical and electronics engineeringHomework Guru
 
Cdi t1 10_gen_unit3_revision_notes_eot
Cdi t1 10_gen_unit3_revision_notes_eotCdi t1 10_gen_unit3_revision_notes_eot
Cdi t1 10_gen_unit3_revision_notes_eotCDI Aljeer
 
Basic electronic components used in robotics
Basic electronic components used in roboticsBasic electronic components used in robotics
Basic electronic components used in roboticsKshitij Wagle
 
Dark sensor using LDR on breadboard
Dark sensor using LDR on breadboardDark sensor using LDR on breadboard
Dark sensor using LDR on breadboardSaqib Iqbal
 
Electric Fences with Automated Monitoring System
Electric Fences with Automated Monitoring SystemElectric Fences with Automated Monitoring System
Electric Fences with Automated Monitoring SystemDilshan Jayakody
 
Edc(electronics devices and circuits)
Edc(electronics devices and circuits)Edc(electronics devices and circuits)
Edc(electronics devices and circuits)rawatsap
 
AVR_Course_Day1 basic electronics
AVR_Course_Day1 basic electronicsAVR_Course_Day1 basic electronics
AVR_Course_Day1 basic electronicsMohamed Ali
 

What's hot (20)

30.led .projects
30.led .projects30.led .projects
30.led .projects
 
Cdi t1 12_gen_unit1&amp;2_revision_notes_eot
Cdi t1 12_gen_unit1&amp;2_revision_notes_eotCdi t1 12_gen_unit1&amp;2_revision_notes_eot
Cdi t1 12_gen_unit1&amp;2_revision_notes_eot
 
EWB practical workbook
EWB practical  workbookEWB practical  workbook
EWB practical workbook
 
Basic Electronics
Basic ElectronicsBasic Electronics
Basic Electronics
 
Electronics Project Book
Electronics Project BookElectronics Project Book
Electronics Project Book
 
Report Automatic led emergency light
Report Automatic led emergency lightReport Automatic led emergency light
Report Automatic led emergency light
 
Light Sensor (Auto Light on off)
Light Sensor (Auto Light on off)Light Sensor (Auto Light on off)
Light Sensor (Auto Light on off)
 
Getting Started with Arduino
Getting Started with ArduinoGetting Started with Arduino
Getting Started with Arduino
 
Electronics
ElectronicsElectronics
Electronics
 
Fundamentals of electrical and electronics engineering
Fundamentals of electrical and electronics engineeringFundamentals of electrical and electronics engineering
Fundamentals of electrical and electronics engineering
 
Section 6
Section 6 Section 6
Section 6
 
Dark sensor
Dark sensorDark sensor
Dark sensor
 
Cdi t1 10_gen_unit3_revision_notes_eot
Cdi t1 10_gen_unit3_revision_notes_eotCdi t1 10_gen_unit3_revision_notes_eot
Cdi t1 10_gen_unit3_revision_notes_eot
 
Basic electronic components used in robotics
Basic electronic components used in roboticsBasic electronic components used in robotics
Basic electronic components used in robotics
 
Dark sensor using LDR on breadboard
Dark sensor using LDR on breadboardDark sensor using LDR on breadboard
Dark sensor using LDR on breadboard
 
Electric Fences with Automated Monitoring System
Electric Fences with Automated Monitoring SystemElectric Fences with Automated Monitoring System
Electric Fences with Automated Monitoring System
 
Report
ReportReport
Report
 
Edc(electronics devices and circuits)
Edc(electronics devices and circuits)Edc(electronics devices and circuits)
Edc(electronics devices and circuits)
 
Electronic letter box
Electronic letter boxElectronic letter box
Electronic letter box
 
AVR_Course_Day1 basic electronics
AVR_Course_Day1 basic electronicsAVR_Course_Day1 basic electronics
AVR_Course_Day1 basic electronics
 

Similar to Microelectronics final project report

How to Build Your Own Power Supply
How to Build Your Own Power SupplyHow to Build Your Own Power Supply
How to Build Your Own Power SupplyEng. Emad Al-Atoum
 
Basic-Electronic-Components .pdf
Basic-Electronic-Components         .pdfBasic-Electronic-Components         .pdf
Basic-Electronic-Components .pdfDesalechali1
 
a simple mobile battery charger with inverter (ups) &night switch
a simple mobile battery charger with inverter (ups) &night switcha simple mobile battery charger with inverter (ups) &night switch
a simple mobile battery charger with inverter (ups) &night switchMuhammad Saif Ul Islam
 
WIRE BREAK CIRCUIT ALARAM
WIRE BREAK CIRCUIT ALARAMWIRE BREAK CIRCUIT ALARAM
WIRE BREAK CIRCUIT ALARAMrookiedope8326
 
EE375 Electronics 1: lab 1
EE375   Electronics 1: lab 1EE375   Electronics 1: lab 1
EE375 Electronics 1: lab 1Loren Schwappach
 
Electronics 01
Electronics 01Electronics 01
Electronics 01snakeaye
 
Real Analog - Circuits 1Chapter 1 Lab WorksheetsReal Analog – .docx
Real Analog - Circuits 1Chapter 1 Lab WorksheetsReal Analog –  .docxReal Analog - Circuits 1Chapter 1 Lab WorksheetsReal Analog –  .docx
Real Analog - Circuits 1Chapter 1 Lab WorksheetsReal Analog – .docxcatheryncouper
 
IRJET- Design and Development of a Programmable High Current Laser Diode ...
IRJET-  	  Design and Development of a Programmable High Current Laser Diode ...IRJET-  	  Design and Development of a Programmable High Current Laser Diode ...
IRJET- Design and Development of a Programmable High Current Laser Diode ...IRJET Journal
 
Diode and its Applications
Diode and its Applications Diode and its Applications
Diode and its Applications Prakash Rao
 
Junior cycle science physics in action. By Theresa Lowry-Lehnen. Science Teac...
Junior cycle science physics in action. By Theresa Lowry-Lehnen. Science Teac...Junior cycle science physics in action. By Theresa Lowry-Lehnen. Science Teac...
Junior cycle science physics in action. By Theresa Lowry-Lehnen. Science Teac...Theresa Lowry-Lehnen
 
securedroomaccessproject-150718081732-lva1-app6892
securedroomaccessproject-150718081732-lva1-app6892securedroomaccessproject-150718081732-lva1-app6892
securedroomaccessproject-150718081732-lva1-app6892shreya sankrityayan
 
Elec581 chapter 2 - fundamental elements of power eletronics
Elec581   chapter 2 - fundamental elements of power eletronicsElec581   chapter 2 - fundamental elements of power eletronics
Elec581 chapter 2 - fundamental elements of power eletronicsTarek Schehadeih
 
Review on Automatic Power Factor Improvement of Induction Motor
Review on Automatic Power Factor Improvement of Induction MotorReview on Automatic Power Factor Improvement of Induction Motor
Review on Automatic Power Factor Improvement of Induction MotorIRJET Journal
 
Electrical and Electronics Engineering
Electrical and Electronics EngineeringElectrical and Electronics Engineering
Electrical and Electronics EngineeringEkeeda
 
Tanya makkar (5003)
Tanya makkar (5003)Tanya makkar (5003)
Tanya makkar (5003)Tanya Makkar
 
minorProject (1).pptx
minorProject (1).pptxminorProject (1).pptx
minorProject (1).pptxROCKINGSTYLE1
 
Power Spikes Isolation to avoid corruption within sensitive ICs Solutions
Power Spikes Isolation to avoid corruption within sensitive ICs SolutionsPower Spikes Isolation to avoid corruption within sensitive ICs Solutions
Power Spikes Isolation to avoid corruption within sensitive ICs SolutionsMistral Solutions
 
LIGHT DETECTOR USING NAND GATE
LIGHT DETECTOR USING NAND GATELIGHT DETECTOR USING NAND GATE
LIGHT DETECTOR USING NAND GATEabdullahkhalid50
 

Similar to Microelectronics final project report (20)

How to Build Your Own Power Supply
How to Build Your Own Power SupplyHow to Build Your Own Power Supply
How to Build Your Own Power Supply
 
Basic-Electronic-Components .pdf
Basic-Electronic-Components         .pdfBasic-Electronic-Components         .pdf
Basic-Electronic-Components .pdf
 
a simple mobile battery charger with inverter (ups) &night switch
a simple mobile battery charger with inverter (ups) &night switcha simple mobile battery charger with inverter (ups) &night switch
a simple mobile battery charger with inverter (ups) &night switch
 
WIRE BREAK CIRCUIT ALARAM
WIRE BREAK CIRCUIT ALARAMWIRE BREAK CIRCUIT ALARAM
WIRE BREAK CIRCUIT ALARAM
 
EE375 Electronics 1: lab 1
EE375   Electronics 1: lab 1EE375   Electronics 1: lab 1
EE375 Electronics 1: lab 1
 
Electronics 01
Electronics 01Electronics 01
Electronics 01
 
Real Analog - Circuits 1Chapter 1 Lab WorksheetsReal Analog – .docx
Real Analog - Circuits 1Chapter 1 Lab WorksheetsReal Analog –  .docxReal Analog - Circuits 1Chapter 1 Lab WorksheetsReal Analog –  .docx
Real Analog - Circuits 1Chapter 1 Lab WorksheetsReal Analog – .docx
 
IRJET- Design and Development of a Programmable High Current Laser Diode ...
IRJET-  	  Design and Development of a Programmable High Current Laser Diode ...IRJET-  	  Design and Development of a Programmable High Current Laser Diode ...
IRJET- Design and Development of a Programmable High Current Laser Diode ...
 
Randeep.pptx
Randeep.pptxRandeep.pptx
Randeep.pptx
 
Diode and its Applications
Diode and its Applications Diode and its Applications
Diode and its Applications
 
Junior cycle science physics in action. By Theresa Lowry-Lehnen. Science Teac...
Junior cycle science physics in action. By Theresa Lowry-Lehnen. Science Teac...Junior cycle science physics in action. By Theresa Lowry-Lehnen. Science Teac...
Junior cycle science physics in action. By Theresa Lowry-Lehnen. Science Teac...
 
securedroomaccessproject-150718081732-lva1-app6892
securedroomaccessproject-150718081732-lva1-app6892securedroomaccessproject-150718081732-lva1-app6892
securedroomaccessproject-150718081732-lva1-app6892
 
Elec581 chapter 2 - fundamental elements of power eletronics
Elec581   chapter 2 - fundamental elements of power eletronicsElec581   chapter 2 - fundamental elements of power eletronics
Elec581 chapter 2 - fundamental elements of power eletronics
 
Review on Automatic Power Factor Improvement of Induction Motor
Review on Automatic Power Factor Improvement of Induction MotorReview on Automatic Power Factor Improvement of Induction Motor
Review on Automatic Power Factor Improvement of Induction Motor
 
Electrical and Electronics Engineering
Electrical and Electronics EngineeringElectrical and Electronics Engineering
Electrical and Electronics Engineering
 
Tanya makkar (5003)
Tanya makkar (5003)Tanya makkar (5003)
Tanya makkar (5003)
 
minorProject (1).pptx
minorProject (1).pptxminorProject (1).pptx
minorProject (1).pptx
 
Power Spikes Isolation to avoid corruption within sensitive ICs Solutions
Power Spikes Isolation to avoid corruption within sensitive ICs SolutionsPower Spikes Isolation to avoid corruption within sensitive ICs Solutions
Power Spikes Isolation to avoid corruption within sensitive ICs Solutions
 
Project Report
Project ReportProject Report
Project Report
 
LIGHT DETECTOR USING NAND GATE
LIGHT DETECTOR USING NAND GATELIGHT DETECTOR USING NAND GATE
LIGHT DETECTOR USING NAND GATE
 

Microelectronics final project report

  • 1. Sound-Level Meter System Design and Development MicroelectronicApplications Andrew Dilucia A10938
  • 2. 2 Contents Introduction........................................................................p3 Experiment 1&2 Investigation of Light Emitting Diodes (LEDs).....................p4 Investigation of a Comparator..............................................p7 Experiment 3 Investigation of a Peak Detector Circuit..............................p10 Experiment 4 Investigation of a Digital to Analogue Converter................p13 Experiment 5 Investigation of a Switched Capacitor Filter........................p19 Experiment 6 Investigation of a PIC Microcontroller.................................p24 System Integration...............................................................p30 Conclusion..........................................................................p31 References..............................................................................p32
  • 3. 3 Introduction For this laboratory programme I was tasked with creating a low cost, flexible sound level meter for use within the entertainment industry as well as the health and safety industry. The sound level meter should be designed around a PIC microcontroller (16F84 or 16F88) that uses a programmable low pass filter. During the course of my investigations I was to build a prototype and if I were successful, we could go ahead and mass produce the meter in order to bring down the cost even further. This report has been created to document the various stages of my investigations of building a prototype meter. Below is a block diagram of the proposed overall system. Overall system block diagram (Cowey 2014) As you we can see from the picture above, the overall system can be broken down into six separate sub-systems. For my investigations I started with sub-system F (the LED display) and continued backwards through sub-systems E to A. The prototype meter was created by designing, building and testing individual sub-systems on bread boards and all experiments were performed in the lab with the relevant Integrated Circuits (I.Cs). The information in this report has been put together over a semester (following guidelines set out in the student handout) and it includes information from both the lectures and practical sessions, plus information gathered through student self learning.
  • 4. 4 Investigation of Light Emitting Diodes (LEDs) The first subsystem I investigated was system F, a Light Emitting Diode (LED). LEDs are part of the diode family and are semiconductor devices that allows current to flow through it in one direction but not the other direction. “A diode is a semiconductor component that lets current flow through it in one direction but blocks current in the other direction depending on the polarity of the voltage applied to it” (Frenzel, Jr, 2010, p50). V-I Characteristics of a Diode (Storr, 2014a, Accessed 2014) From the V- I characteristics graph (as seen above), we can see that the diode switches on at about 0.6V. This means that when the voltage applied reaches 0.6V or greater a forward current begins to conduct through the diode. A light emitting diode is similar to a conventional diode, but it is constructed with different materials. It has been stated that LEDs are Gallium Phosphide(GaP) or Gallium-Arsenide- Phosphide(GaAsP) devices and when a forward bias voltage applied across the diode is greater than the voltage that turns it on, the LED gives out energy in the form of light (Green 1999).
  • 5. 5 LEDs are extremely common and are used throughout industry. They are perfect for the system I am developing because they have low power consumption and they instantaneously switch-on, which is vital for our new products, with regards to accuracy. They also are low in price, which helps keep overall costs to a minimum and they last a long time, which is good for reliability. The picture below shows LEDs I-V curve characteristics for the different colours and as we can see the curves are different for each colour; I – V Characteristics of an LED (Storr, W. (2014b) Accessed 2014) An LED must be connected in series with a resistor so the forward current is limited when it conducts current, otherwise it will overheat and stop working. An LED has some specifications and they should be followed when using otherwise there will be problems. "If more current passes through an LED than its maximum rating specifies, the LED burns up like a marshmallow in a campfire" (Ross et al, 2010, p121). So to begin with I needed to consult the Data sheet that came with the experiment instructions to find out its maximum values. The LED we were using was the colour Red so I found out that the LED I was using had a maximum operating current of 20mA, however it was typically operated at 15mA and the LED had a turn on voltage of 2.2V. With this information I could calculate the size of the resistor that would drop enough voltage to create the correct size of current that was needed for the LED to work correctly which is 15mA or 0.015A.
  • 6. 6 Using the formulas; Vr = Vcc – Vled & R = 𝐕 𝐈 So if Vcc = 5V and Vled = 2.2V Vr = Vcc – Vled = 5V – 2.2V = 2.8V Then when using Ohms law and wanting to drop 2.8V and to use a forward current of 0.015A R = 𝐕 𝐈 = 𝟐.𝟖 𝟎.𝟎𝟏𝟓 = 186.6 Ω So the resistor that I needed to use needed to be at least a value of 186.6Ω. However the nearest value we had in the stores was 220Ω and this is the resistor I used in this circuit. From this information I could design a circuit to test this theory. Below is my circuit diagram. LED test circuit diagram From this circuit diagram I built the circuit using the correct components from the store and began to test the subsystem. I did this by connecting a regulated 5V power supply to the circuit. When the switch to the power supply was turned on the LED illuminated which is the outcome I was looking for. To conclude this circuit was easy to construct. So as it worked correctly first time it was a success and it proved the circuit was designed and built correctly.
  • 7. 7 Investigation of a Comparator The comparator is an electronic device, which compares two voltages or currents on its inputs and switches to give an output according to which is larger. Basic Comparator Schematic (Wikipedia, 2014, Accessed 2014) For my test circuit the comparator will be comparing two voltages to give an output that will make the LED illuminate. For my overall system this will be the component that will switch the LED on by comparing the sound level input in the form of a sine wave with the reference level from the PIC microcontroller and the reference level would be set to the desired level for the application the meter was being used for. For my investigations I used an LM311 comparator IC and it is a monolithic, low input current voltage comparator and this device is also designed to operate from a dual or single supply voltage of 5V. It also has fast response times and strobe capabilities. For this part of my investigations I had to design a circuit that would be combined with my LED circuit from earlier to test the operation of a comparator. First I had to consult the data sheet that was given with the investigation instructions to be aware of the pin layout and the devices absolute maximum ratings to find out what`s the LM311s best operating conditions. Below is the pin layout diagram for the LM311. LM311 Pin Layout Diagram (Texas Instruments Incorporated, 2003, Accessed 2014)
  • 8. 8 The picture below is the LM311s absolute maximum ratings, LM311 Absolute Maximum Ratings (Texas Instruments Incorporated, 2003, Accessed 2014) The picture below is the recommended operating conditions of the device. LM311 Recommended Operating Conditions (Texas Instruments Incorporated, 2003, Accessed 2014) I then had to find the simplest circuit suggested in the data sheet and modify it to incorporate my LED circuit. On the next page is the picture of the simplest circuit.
  • 9. 9 Basic Comparator Circuit (Texas Instruments Incorporated, 2003, Accessed 2014) From all of the information in the data sheet I could design a circuit to test the comparator. Below is my circuit diagram. Comparator test circuit diagram From this circuit diagram I built the circuit using the correct components from the store and began to test the subsystem. An LED was connected to the output of the comparator (Pin 7), with a resister connected in series to a power supply of 5V to protect the LED. The emitter out was connected to ground (Pin1). Two power supplies were connected in parallel to give us a positive and negative Vcc (Pins 8&4). I then connected a 5V supply to Pins 5&6 and set the threshold voltage at Pin 2 to 5V. I then connected a variable power supply to the inverting input at Pin 3. Then starting at 0V the LED showed no change, so I increased the voltage on Pin 3 and still no change. Then when the voltage was increased to greater than the pre-set threshold of 5V the LED illuminated which is the outcome I was looking for. To conclude this circuit was easy to construct. So as it worked correctly first time it was a success and it proved the circuit was designed and built correctly.
  • 10. 10 Investigation of a Peak Detector A peak detector is a circuit that is a combination of an op-amp, with a diode, a capacitor and a resistor connected to the output. The diode is forward biased and this charges the capacitor. At the highest level of the signal, the capacitor charges and holds this charge while the diode is reverse biased. The circuit would be unresponsive to levels below 0.6V because the diode has a switch on voltage of 0.6V so to compensate a negative feedback loop is used. For my investigations I used a 741 op-amp. Below are pictures of the pin layout diagram and absolute maximum ratings from the data sheet. 741 Op-Amp Pin Layout Diagram (Texas Instruments Incorporated, 2000, Accessed 2014) 741 Op-Amp Absolute Maximum Ratings (Texas Instruments Incorporated, 2000, Accessed 2014)
  • 11. 11 As I mentioned earlier a diode, capacitor and resistor is connected at the output of the 741 op- amp. The diode was used to chop the negative half of the cycle to leave to positive side. A time constant was needed so that when the peak level was reached the LED would illuminate long enough so that it could be detected by the human eye. For this a capacitor and resistor were used to create this, so I had to choose values for these components. First I had to choose a time constant that I wanted to achieve, which was 0.2s. Then a capacitor value which was 1µF. From this information I could calculate the resistor needed to achieve a time constant of 0.2s. τ = 𝟏 𝐑𝐂 τ = RC τ = 0.2 C = 1µf CR = 0.2 R = 𝟎.𝟐 𝟎.𝟎𝟎𝟎𝟎𝟎𝟏 = 200kΩ So for a time constant of around 0.2s I needed a resistor of 200kΩ, however the nearest preferred value we had in the store was 220kΩ and this is the value I used in my circuit. From this information I could design a circuit to test the peak detector. Below is a picture of the circuit I used. Peak Detector test circuit diagram
  • 12. 12 From the picture on the previous page you can see I again used two power supplies in parallel to create +5V & -5V and this was connected to pins 7 & 4. As I mentioned earlier the diode is connected to the output at pin 6 but is also connected at the negative input at pin 2 providing a negative feedback loop. The capacitor and resistor are also connected at pin 6 (after the diode) and ground. Next I connected this peak detector circuit with the comparator and LED circuit from earlier between pin 2 on the 741 op-amp and pin 3 on the comparator. I then connected to pin 3 on the 741 op-amp a function generator to create a 5kHz sine-wave with a 5V peak to peak amplitude. I then observed that the output of the diode was chopping the negative half of the cycle, leaving just the positive half. We also observed the overall output and could use the oscilloscope to see the time delay that the time constant had created. This helped the sine- wave decay slower through the capacitor making the output visible to the eye. Also when I altered the DC reference voltage, the LED switched on when it reached and passed the threshold of 0.6V. At the oscilloscope display I observed that at every cycle the capacitor charges and discharges slightly to smooth the signal. Also the signal size is proportional to the size of the amplitude of the frequency and at higher frequencies the capacitors discharge is negligible. To conclude this circuit was quite easy to construct. The Led illuminated when it was suppose to and the readings on the oscilloscope was what I was trying to achieve. So as it worked correctly it was a success and it proved the circuit was designed and built correctly.
  • 13. 13 Investigation of a Digital to Analogue Converter (DAC) Within electronic systems information needs to be converted between analogue and digital states and to do this, Analogue to Digital Converters (ADC) and Digital to Analogue Converters (DAC) are used. “Circuitry is, therefore, required that is able to interface between the analogue world outside the system and the digital system itself. The two interface circuits that are necessary are the ADC and the DAC” (Green, 1999, p329). For my investigations I focused on a DAC and this operates by inputting a binary number and outputting an analogue current or voltage signal. Below is a block diagram that shows this; DAC Operation Block Diagram (All About Circuits, 2015, Accessed 2015) The DAC I used was an MC1408 IC. This DAC is based around an R-2R resistor ladder and the output is dependent on the binary input on each input switch.
  • 14. 14 First I checked the data sheet for the MC1408 to consult the absolute maximum ratings, so to be aware of them so I did not damage the device. The picture below shows the absolute maximum ratings. MC1408 Absolute Maximum Ratings (Philips Semiconductors Linear Products, 2003, Accessed 2015) Then I had to find the simplest DAC circuit suggested in the data sheet. The picture below shows this circuit. Simplest DAC Circuit (Philips Semiconductors Linear Products, 2003, Accessed 2015)
  • 15. 15 Next I had to consult the DC electrical characteristics on the data sheet to be able to choose a suitable power supply. The picture below shows the DC electrical characteristics. MC1408 DC Electrical Characteristics (Philips Semiconductors Linear Products, 2003, Accessed 2015) I then consulted the data sheet to identify the digital input pins and find which pins are the MSB and LSB. The MSB is pin 5 and LSB is pin12, and are highlighted in the pin layout diagram below. MC1408 Pin Layout Diagram (Philips Semiconductors Linear Products, 2003, Accessed 2015)
  • 16. 16 Next I had to choose adequate values for the resistors and capacitors in the circuit. The resistors I chose were all 1kOhm and the capacitor which provides noise suppression for the circuit was 15µf. I then had to choose an adequate reference voltage for the investigation. I chose around 2V and to achieve this I had to design a potential divider circuit that would be connected to between pin 14 and +5V. After some testing, the final design of the potential divider gave me a VREF of 2.1V. From this information I designed a circuit to test the DAC which is shown in the picture below. The potential divider circuit is highlighted in the red section. DAC test circuit diagram At the output of the DAC, an Op-amp is required because the output signal is current and I needed it converted to an output voltage. The Op-amp circuit (highlighted in blue) needed a negative feedback resistor to create the correct output voltage and as you can see I also chose a 1kOhm value for RO.
  • 17. 17 With the values of the VREF and resistors, I could calculate that the outputs should be what I was expecting them to be. VREF = 2.1 Ro = 1kOhm R14 = 1kOhm R15 = 1kOhm So to calculate the output of the DAC (Io); IREF = 𝐕𝐑𝐄𝐅 𝐑𝐑𝐄𝐅 0.0021A = 𝟐.𝟏𝐕 𝟏𝟎𝟎𝟎Ω 0.0021A = 2.1mA IREF = Io Io = 2.1mA As I mentioned earlier I need to now convert the DACs output from current to voltage and this is achieved with the use of a 741 Op-amp. So to calculate what voltage (Vo) is expected at the output of the 741 Op-amp; VOUT = Io x Ro 2.1V = 2.1mA x 1000Ω 2.1V = 0.0021A x 1000Ω Vo = 2.1V As I mentioned earlier the DAC I used was an MC1408 IC but as we were not using a PIC microcontroller for this part of my investigations, I had to simulate the binary inputs. I did this by connecting a DIL switch with an in-line resistor at pins 5 to 12 on the DAC to simulate either logic 0 or 1 (low/high) states. In the final overall design of the sound level meter, the PIC will send the signals to the DAC and then the DAC sends a reference level to the Analogue Comparator. Finally I connected a volt meter at the output of the 741 Op-amp and applied the power supplies that were required as shown in the DAC test circuit diagram. Next I needed to simulate the binary inputs and measure the output voltage preferably with results for 0, ¼, ½, ¾, and of course a full output. To achieve this, the binary inputs were 00000000, 01000000, 10000000, 11000000, 11111111. Using the individual switches on the DIL switch, I simulated these numbers and recorded the output voltage for each number in the table on the next page.
  • 18. 18 DAC Test Results Table VREF Fraction Binary Input Output Voltage 0 MSB 00000000 LSB 0V ¼ MSB 01000000 LSB 0.51V ½ MSB 10000000 LSB 1.05V ¾ MSB 11000000 LSB 1.56V Full MSB 11111111 LSB 2.1V As we can see from the results table, each time I inputted a binary number the output voltage increased by a quarter and this is the response I was expecting to achieve. From the results table I then plotted the graph that shows the relationship between the output voltage and the binary numbers (shown below). DAC Test Results Graph From this graph we can see that the relationship between the output voltage and the binary numbers is of a linear nature. To conclude this circuit was quite difficult to construct however, I was able to complete my investigations successfully. At each binary input, the output voltage altered by the correct percentage that was expected. So as it worked correctly it was a success and it proved the circuit was designed and built correctly.
  • 19. 19 Investigation of a Switched Capacitor Filter (LMF100) For the sound level meter, I needed to investigate possible low pass filters to block any unwanted frequencies on the input of the circuit. I needed to do this because I am only interested in audible frequencies that human ears can hear ranging between 20Hz & 20kHz. The filter I used was an LMF100 High Performance Dual Switched Capacitor Filter. Switched Capacitor Filters are ICs and, are used throughout microelectronic applications because they have a low cost compared to highly accurate conventional filters made to a microelectronic scale and this would be good for keeping the overall cost and size of the sound level meter to a minimum. Conventional filters rely on the ratio between resistors and capacitors, where switched capacitor filters only rely on the ratio between the capacitors values. Switched Capacitor Filter Circuit Schematic (Cheever, 2015, Accessed 2015) The LMF100 Switched Capacitor Filters are extremely accurate and they are very versatile. One output could be used to create either, all pass, high pass and notch functions, while the other two outputs are equipped to perform low-pass and band-pass functions. They operate up to 100kHz and can be used as a 2nd or 4th order filters.
  • 20. 20 First I checked the data sheet for the LMF100 to consult the pin layout diagram and the absolute maximum ratings, so I did not damage the device. The pictures shown below are of the pin layout diagram and the absolute maximum ratings. . LMF100 Pin Layout Diagram (National Semiconductor Corporation 1995, Accessed 2015) LMF100 Absolute Maximum Ratings (National Semiconductor Corporation 1995, Accessed 2015) I then had to consult the data sheet to find the simplest circuit to base my circuit design on. On the next page is the picture of the simplest circuit and its frequency response graph.
  • 21. 21 Simplest Switched Capacitor Filter Circuit (National Semiconductor Corporation 1995, Accessed 2015) The circuit in the picture above is a 4th order 100kHz Butterworth Low-pass Filter which means the cut off frequency (fc) is at 100kHz. For the system I am developing, this fc is way too high for the applications we were thinking of using it for so I needed to modify this circuit to make it applicable to my needs. In the final design of the product I would like to be able to alter the cut off frequency depending on the different applications needed for the product. For this investigation I wanted a cut off frequency of 1kHz instead of 100kHz and to achieve this, the clock input needed to be altered from 3.5MHz to an appropriate value because the input clock frequency is proportional to the cut off frequency. To calculate this I divided 3.5MHz by 100. 𝟑.𝟓𝐌𝐇𝐳 𝟏𝟎𝟎 = 𝟑𝟓𝟎𝟎𝟎𝟎𝟎 𝟏𝟎𝟎 = 35000 = 35kHz So to achieve a 1kHz cut off frequency the clock input must be set to 35kHz. Also four values for resistors were needed to be altered in the simplest circuit from the data sheet. With this information I could then design a circuit to test the filter. The circuit I designed is illustrated in the picture on the next page.
  • 22. 22 1kHz Switched Capacitor Filter Test Circuit Diagram I then constructed the circuit with the correct power supply and clock frequency set. The clock frequency was created on the ttl output on a function generator using a square wave output. The clock frequency was set to 35kHz and as the clock frequency basically sets the cut off frequency, this made the filter a 1kHz filter. I then entered a range of sine-waves with different frequencies ranging from 10Hz to 20kHz at pin 4 of the LMF100 via the 56kΩ resistor. I then was able to view the output from pin 16 and record the readings in the table below. Switched Capacitor Filter Test Results Table Freq / Hz Vin Pk Vout Pk Gain Av dB 10 1 1 1 0 20 1 1 1 0 50 1 1 1 0 100 1 1 1 0 200 1 1 1 0 500 1 1 1 0 1k 1 0.75 0.75 - 2.50 2k 1 0.075 0.075 - 22.5 5k 1 0.004 0.04 - 48.0 10k 1 Unreadable N/A N/A 20k 1 Unreadable N/A N/A 50k 1 Unreadable N/A N/A 100k 1 Unreadable N/A N/A
  • 23. 23 From the results in the table as seen on the previous page I could then plot a graph depicting the frequency response of the filter. Below is a picture of the graph. 1kHz Switched Capacitor Filter Frequency Response Test Results Graph From this graph I could see that the filter had about a 3dB drop off, 2.5dB to be precise at 1kHz, which proved I had altered it correctly to work as a 1kHz low-pass filter. Also we can see a drop of around 24dB per octave proving it was a forth order filter. To conclude this circuit was quite difficult to construct however, I was able to complete my investigations successfully. So as it worked correctly it was a success and it proved the circuit was designed and built correctly.
  • 24. 24 Investigation of a PIC Microcontroller Microcontrollers are a single integrated circuit which has a CPU, memory and input/output interfaces within it. It is like a microcomputer system in one small chip. It is suitable for various applications because of versatile input/output capabilities and with it being a single integrated circuit the power requirements are low for a system. A microcontroller is an excellent bit of kit as you can connect it to a PC via a development board to program it with C programming language and reprogram it with little effort other than altering some code. "The great thing about a microcontroller is that you can simply alter a few lines of code or reprogram it completely to change what it does; you don't need to swap out wires, resistors and other components in order to get this flexible IC to take on a new personality" (Ross et al, 2010, p161). The first microcontroller I researched was the PIC16F84 but soon realised that with the PIC16F84 it would be very difficult to produce a good solid square-wave signal. So then I researched the PIC16F88 and this has pulse width modulation as a feature, so this is perfect to produce the solid square-wave required. Below is a picture of the 16f88s pin layout diagram and the absolute maximum ratings are shown on the next page. PIC16F88 Pin Layout Diagram (Microchip Technology Incorporated 2005, Accessed 2015)
  • 25. 25 PIC16F88 Absolute Maximum Ratings (Microchip Technology Incorporated 2005, Accessed 2015) For the programming of the PIC I used some software called Flowcode. This is a graphical programming tool using flowcharts that simplifies programming and is especially useful for inexperienced programmers. For my investigation I wanted to be able to push a button to switch between states to alter the cut off frequency, level, period and duty cycle. The cut off frequencies I was hoping to achieve were 1kHz and 200Hz. So to calculate what PWM time period and duty cycle needed to create a cut off frequency of 1 kHz I used the formula below. [ (PR2) + 1 ] x 4 x Tosc x (TMR2) = PWM Period T = 𝟏 𝐟 f = 𝐟𝐨𝐬𝐜 𝟒 = 𝟒 𝐟𝐨𝐬𝐜 T = 𝟏 𝐟 Tosc = 𝟏 𝐟𝐨𝐬𝐜 fc = 35kHz (for fc = 1kHz)
  • 26. 26 TPWM = 𝟏 𝐟𝐜 = 𝟏 𝟑𝟓𝟎𝟎𝟎 = 28.57µsecs = 29µsecs 29µsecs = [ (PR2) + 1 ] x 4 x 0.25µsecs x 1 = PR2 + 1µsecs PR2 = 29 – 1 = 28 PWM Duty Cycle = (CCPR1L:CCP1CON<5:4>) x Tosc x (TMR2) 14 = (“10 bit binary number”) x 0.25 x 1 “10 bit” = 𝟏𝟒 𝟎.𝟐𝟓 = 56 CCPR1L = 𝟓𝟔 𝟒 = 14 So for a cut off frequency of 1kHz the PR2 = 28 and the CCPR1L = 14. As we can see the CCPR1L is around half the value of the PR2, so to simplify calculating these values for a cut off frequency of 200Hz it is done as shown on the next page.
  • 27. 27 fc = 35kHz (for fc = 1kHz) TPWM = 𝟏 𝐟𝐜 = 𝟏 𝟔𝟔𝟎𝟎 = 151µsecs PWM Duty Cycle = 𝟏𝟓𝟏 𝟐 = 75.5 = 76 So for the separate frequencies, the required values needed are shown below. State 1 Level 1 = 100 Period1 = 28 Duty1 = 14 PWM = 35kHz fc = 1kHz State 2 Level 2 = 200 Period2 = 151 Duty2 = 76 PWM = 6.6kHz fc = 200Hz When the PIC is in state one and level 1, the DAC receives 1 volt from the PIC and when the PIC is running the program in state 2 and level 2, the DAC receives 2 volt from the PIC. As I mentioned earlier in this chapter I used Flowcode to program the PIC16F88 and one of the benefits of this software is that you can simulate the circuit to check that the code works correctly. For my investigation I wanted to use two individual switches to switch between states. There will be one to switch between frequencies and the other switch to switch between levels 1& 2. I opened Flowcode and selected the PIC16F88 and clicked ok. I then changed the clock speed to 4000000Hz or 4MHz, the oscillator to XT and turned the watchdog timer off. I added two switches, an LED array and a PWM to the panel. Then I added some constants that were the values from the two states as seen above on this page to the sketch. Next I compiled the flowchart adding the relevant components like switches, inputs and outputs etc. On the next page is the flowchart I built in Flowcode that will be tested.
  • 28. 28 Flowchart Built in Flowcode When the flowchart as seen above was built, I could run the simulation to check to see if the code had been compiled correctly. When I activated the first switch the PWM changed and when I activated the other switch, the levels changed between levels 1 & 2.
  • 29. 29 As the simulation test was a success I was ready to program the PIC16F88 via a development board and test it while connected to the switched capacitor filter. So I clicked on compile to hex, which in turn created a hex file. I then created a PPP file and could now upload the program to the PIC via a USB and the PIC development board. I then connected the development board to the switched capacitor filter at pin 10 to alter the clock input when pushing a button on the development board. A function generator was connected to the filters input to create a sine-wave and an oscilloscope connected to the output. When running the program on the development board and pushing the button I could see on the oscilloscopes display that the cut off frequency changed between 203Hz & 1060Hz. To conclude, this investigation was quite difficult to complete, however it was made easier with the use of Flowcode rather than a generic C compiler program. Also the use of the development board made things easier when testing the code. So as the investigation gave the required results that were expected, it proves the PIC was programmed correctly.
  • 30. 30 System Integration Through my investigations I have designed and tested each sub-systems starting with an LED display. First I had to choose an appropriate resistor value to protect the LED and provide the correct operating current to switch the LED on. Then I investigated the LM311 comparator, which was connected to the LED circuit and would act as a switch, controlling when the LED illuminated. Next was the investigation of a peak detector circuit with a 741 Op-amp. A negative feedback loop was created, using a diode between the output and the negative input on the Op-amp. With the diode on the output, the output signal was chopped and this was what I was aiming for because I was only interested in the peak level. After the diode, a capacitor and resistor were connected in parallel to the circuit to create a time constant so that the LED illuminated long enough to be detected by the human eye. I then moved on to the MC1408 DAC and this would convert the output of the PIC so that it could be used as an analogue reference voltage for the comparator sub-system to compare with the sound level at the input of the overall circuit. Next was the LMF100 switched capacitor filter and this is needed to block any unwanted frequencies on the input because I was only interested in audible frequencies detectable by the human ear. Next was programming the PIC 16F88 microcontroller, using a development board and Flowcode. In the lab this is as far as I got but I would like to revisit this at a later date where I would remove the DIL switch from the DAC sub-system and connect the outputs of port b on the PIC in their place. Then the output of the DAC via a 741 Op-amp would be connected to the comparator. I would then connect the PIC development board to the switched capacitor filter, which in turn would be connected to the peak detector circuit, which is already connected to the comparator and LED circuit. After all this, the overall system would be available for some testing. At this stage I would set the PIC program going and observe if the correct output of the LEDs on the development board were the same binary inputs I would be expecting to see sent to the DAC. Then I would generate say a 1kHz, 1 volt peak to peak sine-wave at the input of the switched capacitor filter. So then if the level of the sine-wave was greater than that of the DAC output, the LED should illuminate.
  • 31. 31 Conclusion To conclude, every investigation was completed successfully, therefore the project to design and build a low cost sound level meter was a success. The PIC16F88 microcontroller used within the system is very efficient for controlling the reference voltage and is low in price. The other components within the meter are perfect for the project and also low in cost. This also proves that the sound level meter was designed and built to the specifications. Moving forward, after testing each sub-system and achieving the results I was hoping for, I can think about transferring my overall circuit design via some software to a printed circuit board. I also can start thinking about the design for the products casing and user interface. Maybe if costs can be kept to a minimum, replace the LED with a LCD screen to give an actual decibel reading. In the future there would be further design needed so that the consumer could easily switch between different reference voltages and to be able to control the clock input on the switched capacitor filter, so that the cut off frequency could be altered easily for the different levels required for various applications.
  • 32. 32 References All About Circuits (2015) Digital – analog Conversion [Online]. Available from: <http://www.allaboutcircuits.com/vol_4/chpt_13/1.html> [Accessed 3rd January 2015]. Cheever, E. (2015) Switched Capacitor Circuits [Online]. Swarthmore: Swarthmore College. Available from: <http://www.swarthmore.edu/NatSci/echeeve1/Ref/FilterBkgrnd/SwitchedCap.html> [Accessed 4th January 2015]. Cowey, J. (2014) Microelectronic Applications Assignment Specification. Leeds: Leeds Metropolitan University. [Online / Moodle]. Frenzel, Jr. L. E. (2010) Electronics Explained: The New Systems Approach to Learning Electronics. Oxford: ELSEVIER. Green, D. C. (ed.) (1999) Digital Electronics. 5th ed. London: Pitman Publishing Limited. Microchip Technology Incorporated. (2005) PIC16f88 Data Sheet. [Internet], Available from: <http://ww1.microchip.com/downloads/en/DeviceDoc/30487c.pdf> [Accessed 1st January 2015]. National Semiconductor Corporation (1995) LMF100 High Performance Dual Switched Capacitor Filter [Online]. Available from: <http://pdf.datasheetcatalog.com/datasheet/nationalsemiconductor/DS005645.PDF> [Accessed 1st January 2015]. Philips Semiconductors Linear Products (2003) MC1408-8 8-bit Multiplying D/A Converter [Online]. Available from: <http://pdf.datasheetcatalog.com/datasheet/philips/MC1408-8_3.pdf> [Accessed 1st January 2015]. Ross, D., Shamieh, C., McComb, G. (2010) Electronics for Dummies. Chichester: John Wiley & sons Ltd. Storr, W. (2014a) The Signal Diode [Online]. Available from: <www.electronics.ws/diode/diode_4.html> [Accessed 26th December 2014]. Storr, W. (2014b) The Light Emitting Diode [Online]. Available from:<http://www.electronics-tutorials.ws/diode/diode_8.html> [Accessed 26th December 2014].
  • 33. 33 Texas Instruments Incorporated (2000) µA741, µA741Y GENERAL-PURPOSE OPERATIONAL AMPLIFIERS Data Sheet [Online]. Available from: <http://pdf1.alldatasheet.com/datasheet-pdf/view/177405/TI/UA741.html> [Accessed 28th December 2014]. Texas Instruments Incorporated (2003) LM111 LM211 LM311 Data Sheet [Online]. Available from: <http://www.ti.com/lit/ds/symlink/lm311.pdf> [Accessed 27th December 2014]. Wikipedia (2014) Comparator [Online]. Available from: <http://en.wikipedia.org/wiki/Comparator> [Accessed 27th December 2014].