canolaokahumpkaElectronics - Devices

Nov 2, 2013 (3 years and 2 days ago)



Microcontroller Interfacing


‘Interfacing’ is a term used to describe the
hardware and software needed to connect
devices together efficiently. There are four
basic types of interface:

Digital input

Digital output

Analog input

Analog output

Digital inputs

Simple switches and push buttons can be
connected to the microcontroller parallel
I/O port configured as an input port. Each
switch connects to one input pin and is able
to change the logic state (low/high)

Digital sensors can be similarly connected
to indicate various physical states (e.g. door
open, temperature high etc.)

Digital Outputs

The output from the microcontroller I/O
port is a logic signal (0 or 5Volts normally).
This signal can be used to drive LEDs or
low power digital devices

For higher power applications the logic
signal must be ‘amplified’ to increase the
voltage/current available

Output Interfacing

Power transistor/FET

For low/medium power output


For high power applications (e.g. lamp, motor)

Power driver circuit (e.g. LM293 chip)

For driving DC or stepper motors


For mechanical position control

Other Digital Interfaces

Serial I/O

Many microcontrollers include serial
input/output hardware that is used to
send/receive data over a serial communications

Generally used over short distances (<100m) or
over any distance via an external modem

Other Digital Interfaces

Serial Peripheral Interface (SPI)

A ‘synchronous’ serial interface used to
connect external peripherals to the
microcontroller chip over short distances (<30

Saves on I/O pin usage and inter
connections when data transfer rate between
devices is relatively low

Analog Inputs

Many microcontrollers incorporate an
Analog to Digital Converter (ADC) to
convert analog voltages to a quantized
digital value

An external ADC may also be connected
via the SPI or using the external
data/address bus lines (if available)

Analog Sensors

An ADC allows the microcontroller to
interface to sensors such as:

Temperature sensors

Pressure sensors

Light intensity sensors

Sound sensors (microphone)

Any transducer with a voltage/current output

Input Signal Conditioning

ADCs generally have an input voltage range
of 0
10V (uni
polar) or +/

10V (bipolar)

The transducer output (which could be mV
or a small change in resistance etc.) must be
‘conditioned’ by an input signal
conditioning circuit before it can be used by
the microcontroller ADC

Analog Output

An output signal (analog voltage) can be
produced using a Digital to Analog
Converter (DAC)

The DAC takes a digital word (normally 8
16 bits) and converts it to a voltage

By converting a series of digital words in
sequence a signal can be produced

Few microcontrollers include a DAC on

Analog Output (cont.)

The output of a DAC is commonly 0
Volts or +/

10 Volts (5V range may also be
used), and is suitable for driving low

The DAC signal may be passed through an
external amplifier for driving higher power

Output Signal Conditioning

The DAC output signal may need to be
amplified/filtered/converted in order to
drive an external device e.g.


Hydraulic servo (position/load control)

RF modulator

Motor drive unit


Using the internet or other resources, find
transducers for the following purposes:

Convert temperature to voltage

Convert strain to voltage

Convert position to voltage

Convert strain to voltage

Convert voltage to sound

Exercise (cont.)

For each type of transducer research what
signals are produced/required and how each
one could be interfaced to a microcontroller.

Draw and label a block diagram of the
components required in each case.