TKT-3500 Microcontroller systems Lec 8 – External Modules and Sensors for MCU applications Teemu Laukkarinen Department of Computer Systems Tampere University of Technology Fall 2011 Copyright Tampere University of Technology Department of Computer Systems
48
Embed
TKT-3500 Microcontroller systems 8 – External Modules and Sensors for MCU applications ... 1 2 3 #17/67 More.. ... on this course
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
TKT-3500
Microcontroller
systems
Lec 8 – External Modules and Sensors
for MCU applications
Teemu Laukkarinen
Department of Computer Systems
Tampere University of Technology
Fall 2011
Copyright Tampere University of Technology Department of Computer Systems
#2/67
Contents
What sort of components exist and can be
used with a MCU
Through serial interfaces, buses, or GPIO
Sensors, flash-memories, ethernet/usb
connectivity, displays, user interfaces
Copyright Tampere University of Technology Department of Computer Systems
#3/67
Introduction
MCU itself is useless in any embedded system
In many applications MCUs use sensors to
inspect physical world
MCUs interact with physical world through
actuators
Many embedded systems have user interfaces
Displays, buttons, detectors etc.
In modern world, many applications require
communication from the MCU: so called M2M
Ethernet, wireless, USB, BT
Copyright Tampere University of Technology Department of Computer Systems
#4/67
Basic paradigm for (MCU) applications
Copyright Tampere University of Technology Department of Computer Systems
INPUT OUTPUT TEMPUT
”BACKPUT” (Feedback)
Disclaimer: Vuoden 2011 paras
luentokalvo –
palkintokandidaatti
Sensors
User inputs
Other machines
Actuators: motors,
relays, switches
Displays
Other machines
MCU with macig software
#5/67
EXAMPLE SENSORS
Copyright Tampere University of Technology Department of Computer Systems
#6/67
Temperature Sensor Maxim DS620
Operating voltage: 1.7 – 3.5 V
Communication: I2C
Selectable resolution:
LSB 0.5°C, 0.25°C, 0.125°C or 0.0625°C
Conversion time depends on accuracy
10 bit 25 ms, 13 bit 200 ms
Continuos conversion and one shot modes
Image: www.maxim-ic.com
Copyright Tampere University of Technology Department of Computer Systems
#7/67
Humidity: Sensirion SHT1x
Humidity AND temperature sensor
Operating voltage: 2.4 – 5.5 V
Communication: ”almost I2C” Not compatible with standard I2C interface
Conversion times: 11 ms (8 bit)
210 ms (14 bit)
Accuracy: Humidity 2 %, temperature 0.3 °K
Current consumption: Sleep 0,3 uA, measuring 550 uA
Copyright Tampere University of Technology Department of Computer Systems
#8/67
Accelerometer: VTI SCA3000
3D accelerometer
Operating voltage: 2.35 – 3.6 V
Communication: SPI
Modes:
Free fall detection
Motion detection
Normal mode
Current consumption 120 uA in active mode
Image: www.vti.fi
Copyright Tampere University of Technology Department of Computer Systems
#9/67
Compass: Hitachi HM55B
Operating voltage: 4.8 – 5.2 V
Communication: SPI
Transmission length 4 bits (normal SPI 8 bits)
Current consumption: Sleep 1 uA, Measuring
9 mA
Measuring time 30 ms
Resolution: 11 bits
Measures magnetic field strength
Min. value -180 uT max. 180 uT
Image: www.parallax.com
Copyright Tampere University of Technology Department of Computer Systems
#10/67
Luminance: Agilent APDS-9002
Photosensor: Luminance is relative to current
Operating voltage: 2.4 – 5.5 V
Connected to uC’s analog-to-digital converter
Resolution equals AD-converter’s resolution
10 bit in PIC18LF8722
Sample rate = ADC’s sample rate
In PIC user selectable, but depends on clock
frequency. About 1 Mhz is theoretical maximum
PIC’s AD-converter operates also in idle
mode
Completion of conversion can cause an interrupt
Image: www.farnell.com
Copyright Tampere University of Technology Department of Computer Systems
#11/67
PIR MS300
PIR = Passive Infra Red
Connected to uC’s I/O, but needs an operating
voltage
Used as motion detector
Operating voltage: 2.6 V – 5.5 V
Current consumption: ~35 uA
Copyright Tampere University of Technology Department of Computer Systems
#12/67
VGA C328
Max. 640x480 pixels, 16 bit
Frames/s depends on image quality
JPEG still picture with best quality 0.75 fps
Camera + compression module + EEPROM
No extra components needed
Connection: RS-232
JPEG picture format
Operating voltage: 3.0 – 3.6 V
Operation current: 60 mA
Suspend current: 100 uA
Image: www.electronics123.net
Copyright Tampere University of Technology Department of Computer Systems
#13/67
GPS: iTrax03-s+GeoHelix–S
Fasttrax iTrax03-s
Includes lots of functionality: only few
extra components needed
Communication: USART with NMEA
(National Marine Electronics Association)
messages
Operating voltage: 2.7 – 3.3 V
Max power dissipation 500 mW
Sarantel GeoHelix-S
Active GPS antenna
Operating voltage: 2-3.5 V
Typical current 15 mA Copyright Tampere University of Technology Department of Computer Systems
#14/67
Microphone AOM-6746P-R
Capacitor microphone
Omnidirectional
Picks up sound evenly from all directions
Connection: ADC
PIC18LF8722 has 16 ADC channels, but one converter
Nyqvist frequency: to record 20kHz frequency, sampling
must be done at 40kHz rate
Image: www.farnell.com
Image: www.farnell.com Copyright Tampere University of Technology Department of Computer Systems
#15/67
Capacitive sensor
Measures capacitance between two inputs
Outputs raw values through a serial interface
(typically I2C)
or interrupts via output pins
Can be used for user interfaces, detect changes in
near by environment (e.g. something is removed or
brought near by)
In my experience, both conductors and insulators can be
detected (but cannot be necessarily classified)
Copyright Tampere University of Technology Department of Computer Systems
#16/67
Capacitive sensor - Application
Everyone knows the iPod click wheel?
Wheel is an X input capacitive sensor
The user input direction can be figured out by following
the interrupts associated with the X inputs of the sensor
Example: 2 pieces of Analog Devices AD7156
Copyright Tampere University of Technology Department of Computer Systems
MCU
Sensor
Interrupts
1
2 3
#17/67
More..
1-wire sensors
Acoustic proximity sensors
Gases
HALL –sensor
Pressure
More?
Copyright Tampere University of Technology Department of Computer Systems
#18/67
ACTUATORS
Copyright Tampere University of Technology Department of Computer Systems
#19/67
Motors (1)
MCUs control motors in many applications
Robotics, CNC machinery, air conditioning, cars…
Two types: ”fixed” position motors and speed
controlled motors
Fixed position motors can be instructed to stay standstill
in one position
Step motors, servo motors, linear actuators
Speed controlled continue rotating at some speed
Copyright Tampere University of Technology Department of Computer Systems
#20/67
Motors (2) - Common problems/challenges
Motors require more current than MCU can provide -> an
external motor controller is needed, which can drive high
current to the motor according to the MCU’s commands
Motors have limited torque
If load is constant, some motors require more power to get
moving from standstill than when running
This requires actions in certain applications (more info on coming
slides)
Variable load can cause trouble, thus limit switches are
needed
calibration must be done, if limit is not reached when supposed to,
or if limit is reached unexpectedly
Copyright Tampere University of Technology Department of Computer Systems
#21/67
Step motors (1)
Constant power, torque decreases when speed increases
are moved in steps, eg. 360 steps per round
A controller is needed
when step motor is kept standstill, it basically is a short circuit and
draws all the current it can (holding torque)
MCU can command motor to go one step (or half-step) through the
controller
A phase is associated to running/rotating motor (self-study more)
Calibrate motor to a position with a switch or a potentiometer,
then calculate steps and motor position is known relatively to
the calibration point
E.g. CNC machines use this method (Google DIY CNC machine)
Beware of skipping steps, thus always use limit switches or
potentiometers
Copyright Tampere University of Technology Department of Computer Systems
#22/67
Step motors (2)
Can skip steps, if the load is too high (or resonance)
More torque is needed to move one step from standstill
than many steps on a running motor
There are maximum start and stop frequencies
Step motors have resonance frequency, where the
motor will loose its torque and might stall
You must know this resonance frequency and avoid it!
Google for more information, it is important to
acknowledge these hazards, thus, they are mentioned