MPS Lab Project Report
RC Metering Using TIVA Microcontroller
Submitted To: Sir Umer Shahid
2018-EE-116(
[email protected])
2018-EE-135(
[email protected])
2018-EE-130(
[email protected])
Section : “C”
University of Engineering and Technology
Lahore
Introduction:
For this project a micro-controller based RC meter is designed and implemented
to be portable, accurate, simple to use and relatively cheap to fabricate. It is
simple to use. In this experiment, we used an RC circuit and attached the TIVA
board with it. We attached the board across the capacitor and measured the
capacitance by using the timer built in the TIVA board.
Principle:
We used a simple relation of RC circuit to measure the capacitance of the
capacitor:
RC =t
Where:
o R is the value of resistance in ohms
o C is the value of capacitance infarad
o t is the time constant in seconds
Time constant ‘t’ is defined as:
“The time taken by the capacitor to charge up to
63% of the voltage level”.
Arrangement:
We used the following components to do this project:
1. TIVA Microcontroller Board.
2. LCD Display.
3. Resistance
4. Capacitance
First of all, we attached the resistance and capacitance in series to make the
RC circuit than we attached the board’s VCC and Ground pin to the two
sides of the RC circuit to give supply to it. Then we configured the ADC pin
to measure the reference voltage across the capacitor and so also configured
the timer which is built within the microcontroller. We set its value to zero
and as soon as we configure our pin the timer starts and stops when the
voltage across the capacitor reaches to 63% of the voltage applied. We also
configured the LCD by using Pins PB0, PB1, PB4, PB5 on the
microcontroller. After configuring the pins, the LCD will work and display
the output which is this case the value of capacitance.
Hardware and Components:
We are gonna use the following components :
Microcontroller TM4C123GH6PM
The Cortex-M microcontroller selected for hardware-based programming
and interfacing illustrations is TM4C123 from Texas Instruments. This
microcontroller belongs to the high-performance ARM Cortex-M4F based
architecture and has a broad set of peripherals integrated.
LCD
The liquid crystal display (LCD) is replacing the seven-segment display
due to its cost reductions and being more versatile for displaying
alphanumeric characters. More advanced graphics displays are also
available now at nominal prices. We are gonna use 16x2 LCD.
Resistance
Resistance of 10k ohm is used in series with capacitor for measuring the
value of capacitor in such away that by dividing the charging and
discharging time of capacitor with the value of resistance.
Capacitor
Non polar Capacitors of random values can be used to measure their
values from the RC meter by connecting it in series with the resistance
Circuit Diagram for C Meter :
For C meter we only connect the resistance in series with the capacitor to
find out the value of capacitor as shown in figure below.
Complete circuit diagram of the project:
The complete circuit diagram of the project on hardware level includes the
RC circuit along TM4C123 and LCD
Code:
1. Configuration of Microcontroller Pins
We configured different pins of the board by the following
1. We enabled the system clock and ADC clock by using the
following commands.
2. We did the NVIC level configuration and set the Enable and
Priority Registers.
3. We configured the four GPIO pins.
4. We configured the timer of the microcontroller to measure the
time.
5. We also used the constant values to be given to the timer.
6. We added the function headers to be used in the program in header
file.
LCD Function
1. The following function moves the cursor in the XY-plane on the
LCD.
2. We configured the GPIO pins to the LCD.
3. The follo3.
3. This function writes user commands to the LCD module.
4. This fu
5.
6. This function clears the display and brings the cursor back to
the initial state.
7. This function writes character string to LCD Display.
8. This function shows welcome screen on the LCD Display.
Main Program
1. We added delays and configure the timers.
2.
2. We configured ADC for capacitor.
3. We wrote a program to display capacitance of the capacitor on
LCD display.
4. Ran the above functions in the main program.
Working:
There is a simple RC circuit. The input DC voltage of which is controlled by us
i.e. by using the pin PD3 of TIVA.On which we supply 3.3Volts to the circuit.
As soon as we make the pin PD3 output, we start the timer and also start
measuring the voltage across the capacitor using Analog to Digital Converter,
which is already present in TIVA.As soon as the voltage is 63 percent of input
(which in our case is 2.0856), we stop the timer and we stop giving supply to
our circuit. Then we measure the time using the counter value and frequency.
we are using R of known value i.e. 10k, so now we have time and R we can
simply and the value of capacitance using the above formula.
Results:
When we attach the board across the
unknown capacitor, the board sends the
signals to the capacitor and measure its
response and which is then converted to
digital form and then put into the given
programmed formula. It displays the value
of capacitance on the LCD display and so
we can easily get the unknown value of
capacitance from this.
Budgeting Information:
Components Amount
TIVA Microcontroller Rs.4850/=
Resistor Rs. 2/=
Capacitor Rs. 5/=
BreadBoard Rs. 100/=
Total Rs. 4957/=
Work done by Each member:
o 2018-EE-130: worked on hardware level and done all the
connections of the TIVA board with RC circuit.
o 2018-EE-116: worked in project on the LCD interface and
programmed it.
o 2018-EE-135: worked in project on the ADC’s level and
programmed it.
o 2018-EE-119: worked on the timers level and programmed
it.