INSTRUMENTATION AND ELECTRONIC SYSTEMS IN SMART CITIES Chapter 1: Microcontrollers and embedded systems: EX2

agerasiaetherealAI and Robotics

Nov 24, 2013 (3 years and 7 months ago)

105 views

EX2
:
Signal acquisition using microcontrollers






1





INSTRUMENTATION AND ELECTRONIC SYSTEMS

IN SMART CITIES


Chapter
1:

Microcontrollers and embedded systems: EX
2



Signal acquisition using
microcontrollers


1.1

Cooperative group

TEAM NUMBER: ___________

DUE DATE: ________________


1
st

review due date: ________________

STUDY TIME:

Study time

(in hours)

Group work

Classroom and
laboratory sessions


Sessions out of
classroom


Individual

Student 1

Student 2

Student 3





STATEMENT:

My signature below indicates that I have (1) made equitable contribution to
EX1

as a member of the group, (2)
read and fully agree with the contents (i.e., results, conclusions, analyses, simulations) of this document, and (3)
acknowledged by name anyone outside this group who assisted this learning team or any individual member in
t
he completion of this document.


Today’s date: __________________


Active members













Roles: (reporter, simulator, etc.)

(1)

________________________________________


_______________

(2)

_________________________________________


_______________

(3)

_________________________________________


_______________





Acknowledgement of individual(s) who assisted this group in completing this document:

(1)

_______________________

(2)

_______________________



1.2

Abstract

Explain here the most significant developments, results or conclusions about the exercise. Use the remaining
space in this sheet (200 words maximum).


(
This section is mandatory. You must complete it in order to get a mark.)






EETAC


ISECI: Instrumentation and Electronic Systems in Smarts Cities




2

CONTENT

Signal acquisition using microcontrollers

................................
................................
................................
..

1

1.1

Cooperative group

................................
................................
................................
................................
...

1

1.2

Abstract

................................
................................
................................
................................
...................

1

1.3

Description

................................
................................
................................
................................
..............

3

1.4

Topics

................................
................................
................................
................................
......................

3

1.5

Sensors and signal conditioning

................................
................................
................................
..............

4

1.5.1

Temperature measurement

................................
................................
................................
..............

5

1.6

Analogue to digital conversion

................................
................................
................................
...............

5

1.6.1

The theory of successive approximation analogue to digi
tal conversion

................................
........

5

1.6.2

The PIC18F4520 A/D converter peripheral

................................
................................
....................

5

1.7

Design a data acquisition system to measure temperature

................................
................................
......

6

1.8

Problem solution

................................
................................
................................
................................
.....

7

1.8.1

Part A
(heading 3)

................................
................................
................................
..........................

7

1.8.2

Part B

................................
................................
................................
................................
..............

7

1.8.3

Part C

................................
................................
................................
................................
..............

7

1.9

References

................................
................................
................................
................................
...............

7

1.10

Study plan to solve the exercise

................................
................................
................................
..............

8

1.11

Grading grid

................................
................................
................................
................................
............

8

1.12

Questions

................................
................................
................................
................................
.................

8




EX2
:
Signal acquisition using microcontrollers






3


1.3

Description

This exercise will present the basics of analogue signal acquisition using microcontrollers. Let’s continue and
enhance our previous applications learning about analogue to digital conversion and
integrating sensors to the
microcontroller system.

The applications will be based again on our FSM
-
programming style accommodating
A/D converters and signal processing.


We will proceed in
three
steps:

(1)

Study
some
sensors and their signal conditioning circuits.

Physical qualities and measurement units, signal
dynamic
range, output voltage range, signal
bandwidth, power supply
, etc
.

Examine sensor models and amplifiers in the
Proteus
-
VSM simulator.

Simulate analogue

signals using potentiometers and voltage generators.


(2)

Study PIC18F4520 A/D peripherals.

Voltage range, ground
-
referenced or differential signals, number of analogue channels, number of
bits of
resolution, A/D conversion strategy (integrating
, SAR
, flas
h, etc
.
), sampling frequency, etc.



(3)

Design an application which will consist on attaching a sensor and its signal conditioning circuit to the
microcontroller A/D converter, acquire signals at a given sampling frequency, and process the digital
data to ob
tain measurements of
the
quantity in its associated unit.


1.4

Topics

The following topics have been listed from the course’s specific and cross
-
curricular learning objectives
1
:




Dissenyar s
istemes

incrustats senzills basats en microcontroladors usant eines EDA professionals com
ara MPLAB de Microchip, programant les aplicacions en llenguatge C.



Usar plataformes de simulació i targetes d’entrenament per programar els microcontroladors i verificar
el

funcionament definitiu de l’aplicació.


After studying

Chapter
2

and successfully completing all the assignments in this task, you will be able to:


1.

Explain the main characteristics of a sensor for a common physical quantity: temperature, pressure,
etc.


2.

Design a signal conditioning circuit for a given sensor.


3.

Plan and develop a microcontroller
-
based application to acquire analogue signals using FSM
programming style, polling and interrupts to handle peripherals.


4.

Process data to obtain meaningful meas
urements.


5.

Run Proteus
-
VSM simulations of microcontroller circuits.


6.

Download the configuration code (*.hex) to the training board, using for example the In
-
Circuit
Debugger/programmer ICD2 or ICD3, and measure and characterise the project using laborator
y
instrumentation.





1

https://eetac.upc.edu/ca/fitxers/Juny.2012_Opta_EEL_V2.pdf


EETAC


ISECI: Instrumentation and Electronic Systems in Smarts Cities




4


Fig.
1

Example of a signal acquisition system.

1.5

Sensors and signal conditioning


a)

Read the datasheets of some of these sensors represented in
Fig.
2
. Find an image or a photograph of each
one. Deduce the equation of their calibration curve. Search and draw the schematic of a suitable
conditioning system for each sensor.



Fig.
2

Sensors to measure physical quantities modelled in Proteus
.

EX2
:
Signal acquisition using microcontrollers






5

1.5.1

Temperature measurement

In
Fig.
3

we can see a
National Semiconductor

LM 35. It has a Celsius output. The
LM34/TMP34
is the similar
one with a
Fahrenheit output.






Fig.
3

a)
A temperature sensor and
an example of a
n

OP
-
AMP based
signal conditioner
.



b)

Design a
-
1
5

to +
45

ºC temperature range thermometer able to produce a voltage span from 0V to +5V.

The system has to have a single 5V power supply.


c)

Simulate your circuit in Proteus VSM and test it in all its temperature range.
Find the absolute maximum
measurement error in ºC and indicate to how many bits it is equivalent.


1.6

Analogue to digital conversion

1.6.1

The theory of successive approximation analog
ue to digital conversion

d)

Explain the way the A/D
architecture in
Fig.
4

works using some 8
-
bit example.

How many clock pulses
are required to perform a data conversi
on? Which is the maximum signal bandwidth if a 10 bits conversion
is required and the CLK signal comes from a 4 MHz quartz oscillator?





Fig.
4

A/D successive approximation technique (source:
Wikipedia
)

1.6.2

The PIC18F4520 A/D converter peripheral

Let’s study the block diagram of the
PIC18F4520

A/D converter represented below in
Fig.
5
, its configuration
bits and a sample C program

based on a FSM in order to use it
.

EETAC


ISECI: Instrumentation and Electronic Systems in Smarts Cities




6


Fig.
5

Block diagram of the PIC18
F4520

multichannel
1
0
-
bit A/D converter.

e)

Modify and enhance the EX1 timer application to acquire
an analogue voltage from 0V to 5V.


1.7

Design a data acquisition system to measure temperature

f)

Design a
-
15

ºC to +
45
ºC thermometer with an LCD display using a PIC18F4520 microcontroller
.
The
device has to represent the actual temperature and the mean temperature value over a period of 10 s.
Sampling rate is
2

Hz
.






Do not modify the text from page 3 to page
6




EX2
:
Signal acquisition using microcontrollers






7

1.8

Problem solution

1.8.1

Part A
(heading 3)

Installing the software
(heading 4)

Your first picture is
Fig.
6
.
(normal text)



Fig.
6

Example of caption
(caption style)


This
cross
-
reference

[2]

is a reference to a book on microcontrollers and C.


1.8.2

Part B

Your text.


1.8.3

Part C

Your text.





1.9

References

Modify or add new references to this section. Follow the same format.


[1]

http://digsys.upc.es
. Here, in Chapter 4 units you will find information on microcontrollers and
programming examples. [retrieved 09/2012]

[2]

Reese, R. B., Microprocessors, from Assembly language to C Using the PIC18Fxx2, Da Vinci
Engineering
Press, 2005.

[3]

www.microchip.com
. Comment: manufacturer web site. Here you can browse for everything on PIC’s. For
example, here you are the
MPLAB IDE User’s guide
. [retrieved 09/2012]

[4]


[5]



-


Before delivering the exercis
e


Remember to add your own sources and references





EETAC


ISECI: Instrumentation and Electronic Systems in Smarts Cities




8


1.10

Study plan to solve the exercise

Establish a study plan, a task distribution scheme and other requirements to succeed in producing a good solution
when working cooperatively: flux diagrams, concept maps, schematics, tables, pictures, etc.



(This section is mandatory. It must be filled i
n order to get a mark.)



Gxx

Project

Analogue sensor & signal
conditioner

Analogue to digital
signal acquisition

Thermometer


Sections

a)
,
b)
,
c)

d)
,
e)

f)

Folders

<dropbox>/EX2/Sensor_and_
conditioner/

<dropbox>
/
EX2/A_D_c
onversion/

<dropbox>
/
EX2/Digital_th
ermometer/

Number and name of
the source files

Sensor_and_conditioner.DSN

A_D_conversion.DSN


A_D_conversion.c

Digital_thermometer.DSN

Digital_thermometer.c

LCD.c, LCD.h

Delay.c, Delay.h

Engineer in charge

Alberto

Helena

Pere

1. Specifications

2. Plan

3. Development

4. Simulation

5. Board prototyping

v

v

x

x

x

v

v

Marks







1.11

Grading grid

Here you are the way the exercise could be grades.


Sensors and signal
conditioning


A/D converter

Design of a complex
application



Total

a)
,
b)
,
c)

d)
,

e)

f)


Scores

3

p

2 p

5
p


Self
-
assessment





Instructor’s
gr慤敳







Do not forget to annotate your own self
-
assessment before uploading

the exercise at your site
.



1.12

Questions

Write here your questions, comments, doubts, opinions, etc. Add more sheets if necessary to report your progress
or comments though the exercise.


[Add something here. It’s impossible to deeply understand everythi
ng in this complex subject!] Use this space
to reflect and conclude about the course/exercise or whatever related to the content…








EX2
:
Signal acquisition using microcontrollers






9