Anda di halaman 1dari 10

Project 1 (24 points)

Smart sensor implementation with the Arduino platform


Overview

 Implementation of a smart sensor


In this project, a smart sensor based on the Arduino platform has to be
realized. It integrates the actual sensor elements with a digital processing and
networking unit in a single device, and communicates the sensor readings to
a computer system via a standardized communication protocol.

digital  out

analog  in RS232

analog  in

smart sensor USB

sensor network

C. Holzmann
Project Requirements
"  The sensor data (see next slide) should be shown on an LCD display.
"  connected to the Arduino board via the RS232 interface (Pin 0/1)
"  use a rotary encoder to switch between different displayed sensor values
"  some of the currently displayed values can be reset with a push button

"  The smart sensor should also be accessible from a PC via the USB interface.
"  define and implement a simple protocol for accessing the sensors
– request selected sensor data (see next slide)
– request and change defined alarm thresholds (they have default
values)
– request and reset minimum and maximum values
– start and stop automatic sensor data transmission Bonus!
– …
"  use either the smart sensor application available at the e-learning platform,
"  a terminal program (e.g. HTerm) or implement your own simple client :-)

C. Holzmann
Project Requirements
" Accelerometer (ADXL335)
" the following sensor data should be provided via the LCD display and the PC
– (1) current acceleration for all three axes in [g]
– (2) maximum absolute (+/-) accelerations for all three axes in [g],
– resettable with push button
– (3) tilt (roll and pitch) in [°] (see slide 203 pp.) Bonus!
– (4) distance in [m] (see slide 207 pp.), resettable with push button
" trigger alarm if defined max. total acceleration is exceeded (yellow LED 1)
total  accelera6on  =  sum  of  
all  three  accelera6on  vectors
" Temperature sensor (NTC thermistor)
" the following sensor data should be provided via the LCD display and the PC
– (5) current temperature T in [°C]
– (6) minimum and maximum temperature in [°C], resettable with push
button
" trigger alarm if defined max. temperature or dT/dt is exceeded (yellow LED
2)

C. Holzmann
Project Requirements
"  General requirements:
" linearize the temperature sensor (e.g. table-based)
" provide means for calibration with known temperature or acceleration
" implement plausibility checks and trigger alarm if a sensor fails (one red
"  LED for each sensor)
"  Search the Arduino playground (http://arduino.cc/playground/) for code
" Examples (linearization, calibration, sensor and display interfacing) and the
Sparkfun website (http://www.sparkfun.com/) for data sheets and further
information about the used electronic components.

" Solve the project in groups of two until May 6, 2014 (11:55 pm).
" submit implementations (PDE files) and a documentation (PDF file with
" user guide, protocol, electronic circuit, how linearization and calibration of
" the sensors works, results and pictures of tests, …) as a single ZIP file
" use the open-source tool Fritzing (http://fritzing.org/) for documentation of
" the electronic Arduino circuit

C. Holzmann
NTC Thermistor Linearization
and Calibration (example)
"  Linearization:
"  calculate voltage drop over sensor for some points
– steps of 5° in the range of -10° to +50°C
"  calculate the resulting ADC values
"  create a table with temperature <=> ADC value
"  calculate actual value from nearest table value and a linear equation
"  for the segment

"  Calibration:
"  send current temperature to the smart sensor
"  determine ADC values and set offset accordingly
"  offset = ADC value (measured) – ADC value (calculated)
"  subtract offset before searching the table

C. Holzmann
Communication Protocol
(example, to be adapted if used)

 Message Format
START LEN ADR COMMAND DATA_FORMAT DATA  … STOP

Name Descrip<on Length  


[Byte]
START start  byte  (0x55) 1
LEN length  of  the  message  in  byte  (including  start-­‐  and  stopbyte) 1
ADR address  of  the  receiver  (group  1-­‐6) 1
COMMAND command  to  execute  (see  next  table) 1
DATA_FORM format  of  the  following  user  data  (0=no  data,  1=signed  16bit  low   1
AT first)
DATA user  data 0-­‐99
STOP stop  byte  (0xAA) 1

C. Holzmann
Communication Protocol
(example, to be adapted if used)
START LEN ADR COMMAND DATA_FORMAT REQ/RESP  
DATA  … to  bSTOP
e  extended  with  
<lt  (and  op6onally  distance)
 Commands
Command Direc<on Descrip<on Value

REQ_TEMP -­‐>  sensor request  of  current  temperature  value 10


RESP_TEMP -­‐>  bus response  with  curren  temperature  value 11
REQ_X  (_Y,  _Z) -­‐>  sensor request  of  current  accelera6on  value  (per  axis) 20-­‐22
RESP_X  (_Y,  _Z) -­‐>  bus response  with  accelera6on  value  (per  axis) 30-­‐32

REQ_PARA -­‐>  sensor request  of  certain  parameter  (see  next  table) 40
RESP_PARA -­‐>  bus response  with  parameter 41
SET_PARA -­‐>  sensor change  parameter  (see  next  table) 42
ALARM_TEMP -­‐>  bus defined  temperature  threshold  exceeded 50
ALARM_X  (_Y,  _Z) -­‐>  bus defined  total  accelera6on  threshold  exceeded 60

RESET_MINMAX -­‐>  sensor reset  all  minimum/maximum  storages 70

ACK -­‐>  bus success  confirma6on 100


NACK -­‐>  bus error  (if  necessary  with  error  code  in  data) 101
C. Holzmann
Communication Protocol
(example, to be adapted if used)
START LEN ADR COMMAND parameter  
DATA_FORMAT is  selected   DATA  … STOP
 Parameters via  first  data  byte  for  
REQ_PARA,  
Numb Descrip<on SET_PARA Allowed  Range  (Default)
er
1 alarm  if  upper  temperature  threshold  exceeded -­‐10°C  to  +50°C  (30°C)
2 alarm  if  fallen  below  lower  temperature  threshold -­‐10°C  to  +50°C  (10°C)
3 alarm  if  certain  dT/dt  exceeded 5°C  to  50°C/10s  (5°C/10s)

11 alarm  if  maximum  total  accelera6on  exceeded 0g  to  3g  (3g)


20 maximum  temperature  since  last  RESET_MINMAX (20°C)
21 minimum  temperature  since  last  RESET_MINMAX (20°C)
30-­‐32 maximum  accelera6on  in  direc6on  X  (Y,  Z)  since  last  RESET_MINMAX (0g)

50 automa6c  temperature  transmission  every  x  seconds   0s  to  100s  (60s)


(0  means  deac6vated)
51 automa6c  temperature  transmission  if  change  of  x  degrees  since  last   0°C  to  20°C  (3°C)
sending  (0  means  deac6vated)
to  be  extended  
60 current  temperature  for  calibra6on with  accelera<on -­‐20°C  to  +20°C  (0°C)
C. Holzmann
61-­‐66 +1g/-­‐1g  accelera6on  in  X  (Y,  Z)  for  calibra6on -­‐1g  to  +1g  (1g)
Communication Protocol
(example, to be adapted if used)

 Client Application (see e-learning platform)

C. Holzmann

Anda mungkin juga menyukai