Microcontroller To Sensor Interfacing Techniques
Microcontroller To Sensor Interfacing Techniques
Interfacing Techniques
Document Revision: 1.01
Date: 3rd February, 2006
Microcontroller to Sensor Interfacing Techniques. No part of this work may be reproduced in any manner without
written permission of BiPOM Electronics.
All trademarked names in this manual are the property of respective owners.
Overview
Micro-controllers are useful to the extent that they communicate with other devices, such as sensors,
motors, switches, keypads, displays, memory and even other micro-controllers.
Many interface methods have been developed over the years to solve the complex problem of balancing
circuit design criteria such as features, cost, size, weight, power consumption, reliability, availability,
manufacturability.
Many microcontroller designs typically mix multiple interfacing methods. In a very simplistic form, a micro-
controller system can be viewed as a system that reads from (monitors) inputs, performs processing and
writes to ( controls ) outputs.
Microcontroller Interfaces
Digital Analog
Asynchronous Synchronous
1-wire 2-wire (I2C)
RS232/RS485 4-wire (SPI, Microwire)
Ethernet
Page 2
Analog Inputs/Outputs
• 0 to 2.5V
• 0 to 4V
• 0 to 5V
• +/- 2.5V
• +/- 4V
• +/- 5V
• 0-20mA
• 4-20mA
Analog Interface
Vcc
Amplifier
Potentiometer
4-20mA
Strain-gage
Output
Page 3
Sensor Types
• Temperature
• Humidity
• Light
• Acceleration
• Force
• Frequency
• Flow
• Pressure
• Torque
• Proximity
• Displacement
Temperature Sensors
• RTD
• Thermistor
• Thermocouple
• Semiconductor Temperature Sensors
Page 4
RTD’s
Also called Platinum RTD because it is typically made of platinum. A change in temperature causes a
change in resistance of platinum. This change can be measured with an ohmmeter.
Within a limited range, the resistance of metals increases in proportion to the temperature as defined by
the formula:
where:
= resistance at temperature
In theory, any metal could be used to measure temperature. The metal selected should have a high
melting point and an ability to withstand the effects of corrosion. Platinum has therefore become the metal
of choice for RTD's. Its desirable characteristics include chemical stability, availability in a pure form, and
electrical properties that are highly reproducible.
Typical readings for platinum are 100 ohms at 0 Celsius and 139 ohms at 100.
Page 5
I FE R V0NIA = R T RD I FE R
AIN0
Platinum RTD
(R TRD )
Ground
RTD’s require a constant current source, such as 1mA. Such a low current keeps
the self heating to a minimum.
5V
- A na log/D ig ital
C o nverte r M icrocontro ller
(A D C )
R TD
VREF
Page 6
Thermistors
Thermistors are thermally sensitive resistors and have, according to type, a negative (NTC), or positive
(PTC) resistance/temperature coefficient.
Manufactured from the oxides of the transition metals - manganese, cobalt, copper and nickel, NTC
thermistors are temperature dependant semiconductor resistors. Operating over a range of -200°C to +
1000°C, they are supplied in glass bead, disc, chips and probe formats.
Page 7
V FE R
Thermistor R
(R th )
V0NIA = VFER
R + R th
AIN0
Known
resistor
(R)
Ground
Page 8
Thermocouples
Page 9
Semiconductor Temperature Sensors
Analog
Voltage Output
Page 10
Analog Digital Conversion
• Voltage to Frequency
• Flash ADC
• Successive Approximation
• Dual-Slope Integration
• Delta-Sigma
Page 11
Voltage
DAC
Output
Input
Voltage
Time
Analog/
Analog/Digital
AT89C51ED2 Digital PIC16F818
Converter
Microcontroller Converter Microcontroller
(ADC)
(ADC)
Page 12
Noise considerations
Many sensors, such as thermocouples, generate a relatively small voltage so noise is always an issue.
The most common source of noise is the utility power lines (50 Hz or 60 Hz).
Typically, the bandwidth for temperature sensors is much lower than 50 or 60 Hz so a simple low-pass
filter will work well in many cases.
• Use 4-20mA loop or even better, a digital signal for long cable runs.
Analog/Digital
Sensor Converter Microcontroller
(ADC)
Page 13