senior design ii

52
Senior Design ii Breathalyzer Interlock system By: Xi Guo | Ashish Thomas | Brandon Gilzean | Clinton Thomas

Upload: cargan

Post on 11-Feb-2016

24 views

Category:

Documents


0 download

DESCRIPTION

Senior Design ii. Breathalyzer Interlock system By: Xi Guo | Ashish Thomas | Brandon Gilzean | Clinton Thomas. Project Description. A system to designed to deter individuals from operating a motor vehicle while under the influence of alcohol. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Senior Design ii

Senior Design iiBreathalyzer Interlock system

By: Xi Guo | Ashish Thomas | Brandon Gilzean | Clinton Thomas

Page 2: Senior Design ii

Project Description A system to designed to deter individuals from operating a

motor vehicle while under the influence of alcohol. Highly accurate and portable alcohol sensing unit allows the

operator to monitor their level of intoxication while away from the motor vehicle

Integrated automobile control unit prevents the vehicle from operating without a successful initial reading, then conducts rolling retests to verify driver sobriety during vehicle operation

Logs of activity maintained by automobile unit for retrieval during calibration by law enforcement.

Page 3: Senior Design ii

Motivation and Goals Original concept was personal alcohol measurement device

powered by a smartphone (iPhone, Android, etc.) Platform and Business considerations lead to the

determination to make a standalone device Evaluation of work quantity lead to the marriage of alcohol

detection device with automobile interlock unit Goal is to develop a system that can meet National Highway

Safety and Transportation Agency certification for alcohol detection interlock devices.

Page 4: Senior Design ii

Trade Study – Breathalyzers Personal breathalyzers utilize silicon

dioxide based ethanol sensors, reducing both cost and accuracy

Unique air channel design that folds into the case enclosure. This will be modeled or acquired for Voog

Simple means of communication using speaker and 2-Digit 7-Segment display

Small and lightweight, powered by non-rechargeable AA alkaline batteries

Page 5: Senior Design ii

Trade Study – Ignition Interlock Smart Start Model 20-20

evaluated as the most effective and complete solution currently available

Typical Interlocks utilize a “zero-tolerance” policy, meaning interlock engages between 0.02-0.04% BAC

No available model in the market can completely prevent spoofing, only deter and catch for later retrieval

Page 6: Senior Design ii

Project Overview Hand-Held Unit

Handles user interaction and processes sensory data

Powered by onboard Li-ion battery

Wireless Communication with automobile control unit

Control Box Requests validation from

handheld unit Establishes vehicle state,

logs input data

Page 7: Senior Design ii

Introduction System Logic

The system level design for both the handheld breathalyzer unit, as well as the automobile control unit, calls for the use of programmable logic.

This is necessary for the successful interpretation of output signals from the sensors, translating user input into device functionality, displaying information related to the current state of the device, as well as communication with other devices in the system.

Page 8: Senior Design ii

Microcontroller Small computer on a singleintegrated

circuit consisting internally of a relatively simple CPU, clock, timers, I/O ports, and memory.

Advantages Using languages such as C/C++ Assembly Low cost

Disadvantages Have to design a microcontroller into a

circuit and build it Paying for functionality that is not being

used

Page 9: Senior Design ii

Microcontroller (MSP430) Texas Instrument MSP430F2274

Low voltage power supply requirements (1.8 VDC – 3.6 VDC)

Universal Serial Interface, configurable as either I2C, SPI, or UART for RS232 serial communications

Available Analog-to-Digital converters with 10/12/16 bits of resolution

Assembly or C/C++ Memory 32Kbytes Flash, 1Kbytes

RAM

Page 10: Senior Design ii

Microcontroller (MSP430)

Page 11: Senior Design ii

Display – Human Interface

Seven-Segment Display Arabic numerals 0 to 9 General use

Dot-Matrix Display Simple display limited resolution

Liquid Crystal Display Great for character resolution Refresh Rate

Page 12: Senior Design ii

LCD Display – New Haven Display

Interface: I2C

Communication speeds, up to 57.6 kbps for RS-232 and 400 kbps for I2C

extreme environments of -20C to 70C

Functional Features(Label)

Description

NHD New HavenC0216 COG , 2 lines x 16 charCiZ ModelF TransflectiveSW‐ Side White LED

BacklightF FSTN(+)B 6:00 View AngleW Wide View3v3 3Vdd, 3V backlight

Page 13: Senior Design ii

Sensors

Alcohol Gas Sensor Semi-Conductor (MQ-3) vs.

Fuel Cell (002-MS3)

Differential Pressure Sensor Silicon Microstructures (SM-

5852)

MQ-3

MS3

Page 14: Senior Design ii

Alcohol SensorOperating Condition and Requirements Maximum Operating

Temperature: 90C Recommend Operation

Temperature: <70C Shunt Resistor value:

220-300ohm

Page 15: Senior Design ii

Alcohol Sensor Output

0.01

0.020

00000

00000

001

0.030

00000

00000

001

0.040

00000

00000

001

0.050

00000

00000

001

0.060

00000

00000

002 0.07

0.080

00000

00000

002

0.090

00000

00000

001 0.1 0.11

0.12

0.13

0.14

0.15

0.16

0100200300400500600700800900

Test 1Test 2Test 3

Testing Condition• Room Temperature• 0.5ml gas sample• 0.160 BAC

Region of Interest<0.04 BAC (User will not be able to start the vehicle)

Page 16: Senior Design ii

Alcohol Sensor Calibration Sensor Output will be calibrated

against known values using Lifeloc Dry Gas Calibration Kit

Typically, dry gas alcohol calibration requires a 5-6% compensation value to approximate breath alcohol

Values will be measured using a laboratory-formulated alcohol standard of particular concentration, representing BAC values of 0.02 to 0.10

Page 17: Senior Design ii

Differential Pressure Sensor Object: To detect sufficient breath sample has

been provided. Option A: Tungsten Hot wire Anemometer

Electrical Resistance varies with the change in temperature due to breath sample

Cons: Can’t detect the quantity of breath sample obtained. Expensive. Not available as discrete solution

Option B: SI-Micro Pressure Sensor Pressure detection range: 0.15-3 Psi (Human

breath sample (1.5 to 2.5 Psi) Cons: Difficult to obtain from chosen

manufacturer,difficult to mount.

Page 18: Senior Design ii

Differential Pressure Sensor

Page 19: Senior Design ii

Power Supply

How to power Ability to hardwire into vehicle’s electrical system (in-car

unit) Recharge on-board battery with same circuit board

(portable unit) Utilize external “wall wart” to recharge battery, or

cigarette lighter connection (portable unit). So 12V primary input.

Various power needs of components in both units will require a power supply with multiple capabilities

Page 20: Senior Design ii

Power RequirementsComponent

Max Current Draw (mA)

Recommended Voltage (VDC)

Power Consumption (W)

Display 70 3 0.525Microcontroller (wireless on)

95 3.3 0.3135

Sensor 50 5 3.25Charging IC 600 9 5.4

LEDs, etc 100 9 0.9Total 1610 -- 10.69

Page 21: Senior Design ii

Power Requirements (contd)

While maximum draw possible is ~1.6A, it is at various voltages and not all will be drawing at the same time for a significant period of time

Multiple voltages are needed for multiple components. Therefore, will utilize voltage regulation to generate multiple output voltages from singular +12VDC input

Page 22: Senior Design ii

Power Distribution Scheme+12V In

+9V Out

Charging Circuit

Battery (+7.4V)

+5V Out

Display Sensor Speaker LEDs

+3.3V Out

Microcontroller &Wireless Radio

Portable Unit

Control Unit

Page 23: Senior Design ii

Implementing Power Scheme For our application, voltage dividers do not offer voltage

stabilization, and are fairly inefficient. They also lack any sort of basic power protection (short circuit, overcurrent, overvoltage, thermal overload, etc.).

Zener diodes allow a stable output voltage; but again, lack more robust power event protection.

Use LDO voltage regulator ICs. Switching regulators were considered, but due to their buggy reputations, were not used. They also take up slightly more space on the PCB land configuration due to a need for a larger (compared to LDO) supporting circuit. Heatsinking will be used as needed. +9VDC, +5VDC, and +3.3VDC are needed.

Page 24: Senior Design ii

Battery Portable unit needed to be portable,

but also not impractical to use by having to replace disposable batteries. Since highest regulator to be served by battery is 5V, a 7.4V battery should suffice.

Load and current draw expectations made conventional alkalines impractical.

Due to size, energy density, as well as flexibility in recharging, lithium ion rechargeable batteries were chosen.

7.4V 850 mAh Li-Ion Battery with Integral Protection PCB. >1C safe discharge rate.

6.160*850.0

)(60*)(

ADrawAhacityBatteryCap

= 31.875 minutes

Expected Battery Runtime?

Page 25: Senior Design ii

Charging the Battery However, a charging

circuit is now required. Lithium ion batteries require more care in charging, as improper charging can result in a fire or explosion – not desirable for any user, especially an inebriated user

Circuit to right. Will be a two cell battery (3.7V*2 = 7.4V) Reprinted with Permission of

shdesigns.org

Page 26: Senior Design ii

Charging the Battery (contd) However, the area required

on the PCB for this configuration is too great; it also is not intelligent. It cannot automatically detect a severely discharged or overchargedbattery and cannot switch charging modes to compensate.

Use Texas Instruments BQ24005. A complete, integrated charging IC for use with two cell LiIon and LiPoly batteries

Heat issues are addressed by soldering a thermal pad on the bottom of IC to a copper pad in the PCB – the PCB becomes a heatsink.

Page 27: Senior Design ii

Jumper

Portable Unit Config

Base Unit Config

J1 Closed OpenJ2 Open ClosedJ3 Closed Open

To allow usage of same board for both fixed and portable power application, a set of three jumpers can be adjusted to allow for either configuration.

Page 28: Senior Design ii

Physical Implementation Since small size, reliability, and quality are all primary

concerns of our overall project, we decided to use a PCB.

PCB Requirements: Compact: 2 in. x 3 in. (6 in.2 total area). This is slightly

smaller than an average credit card. Must accommodate microcontroller board within PCB

area Design so a single board can be used for both portable

and base/control units Design for optimal power flow, and minimize capacitive,

inductive, and other crosstalk effects from traces, especially between analog and digital I/O lines.

Page 29: Senior Design ii

Physical Implementation (contd) Design considerations:

32 mil for width of power traces 15 mil for width of signal traces 25 mil minimum for signal trace spacing Mostly dedicated ground plane for robust ground Two layer to save on cost. All outputs should have standard 0.1 in. spacing (2.54

mm) to accommodate standard pin headers. This will mostly avoid the need to solder components directly to the board, easing debugging and future changes.

Wide traces to small pads on the charging IC should be necked near pad interface

Page 30: Senior Design ii
Page 31: Senior Design ii

PCB Manufacturer Choice Used PCB123.com (Sunstone

Circuits) Used PCB123 PCB layout and

schematic editor software With silkscreen on top only, 1 oz

copper thickness, soldermask, and our 6 sq. in., the per board price is $32.48 for 8 boards. ($32.48 * 8 = $259.80)

Lead time of three business days when order is submitted before 12 PM PST

Page 32: Senior Design ii

Enclosure: Hand-held & Control box

Requirements (Hand-held unit) Dimensions: 4.5x2.5x1.5in Physically Appealing

Resources, Materials and Skill sets Photoshop Software SolidWorks and/or AutoCAD

Software Industrial Engineering Rapid

Prototyping lab Fabrication material

Page 33: Senior Design ii

Enclosure:Pactec EnclosuresPPT 3468

Page 34: Senior Design ii

Signal Acquisition Alcohol Concentration will be determined using a “Peak

Measurement” method Output measured over small load resistor (220 – 390 ohms) Voltage is converted into discrete 10-bit integer

representation by ADC with internal 1.5V reference Output represents the maximum alcohol concentration

detected by the sensor in micrograms. Airflow pressure will be queried from the differential sensor

utilizing I2C, returned from the sensor’s onboard DSP.

Page 35: Senior Design ii

BAC Measurement Micrograms of alcohol is converted to BAC using the Blood/Breath

Partition Ratio, 2300:1 US, 2100:1 UK

Assumption is made that test is post-absorbitive, meaning the alcohol is fully absorbed and in bodily equilibrium

Approximate values are as follows1.0% BAC = 1cg ETOH/mL blood = 9.43 mg ETOH/g blood1ppm = 1 ug ETOH/g blood = 1.06 ug ETOH/mL blood1.06g blood ~ 1mL blood188.6 ug/mL – 377.2 ug/mL is blood concentration for 0.02-0.04%82 ng/mL – 164 ng/mL will be range of BrAC

Assumptions of flow rate will be evaluated during assembly and calibration to determine breath sample quantity

Page 36: Senior Design ii

Software Development Software will be written

using IAR Embedded Workbench

Kickstart version for MSP430 provided by TI limits program size to 4K. Full version does not have this limit, but costs lots of $$$

Software will be written in C, with inline assembly for MSP430 where needed

Page 37: Senior Design ii

Software > Hardware… always What happens when you find out after purchasing your

hardware that it cannot achieve all the functionality you believed it could?

MSP430F2274 provides a universal serial UART for I2C, SPI, RS232, etc., which just so happens to be used by the CC2500 transceiver

Communications with peripheral devices and sensors will be accomplished through an I2C serial bus

Luckily for us, the right combination of configurable GPIO pins and software can save our project, utilizing a technique called “Bit-Banging”

Page 38: Senior Design ii

What is Bit-Banging? A technique used for serial communications utilizing

software instead of dedicated hardware Software sets and samples the state of pins on the

microcontroller, responsible for timing, signal levels, synchronization, etc.

Can reduce costs in a design by implementing features that are not designed directly into the hardware (or make up for a lack of foresight)

Considered a hack, takes more CPU time and resource, signal is usually much uglier than dedicated hardware would provide

Page 39: Senior Design ii

Inter-Integrated Circuit (I2C) Daisy-chained serial peripheral bus designed for simple

slave-to-master device communications Only requires two lines, SCL (clock) and SDA (data) Each device is given an address on the bus, configured by

software Communications initiated with START and STOP messages First byte is the address of the device the master will

communicate with, then the desired direction of communication (write/read), followed by an ACK from the slave device

Page 40: Senior Design ii

Inter-Integrated Circuit (I2C) Each byte is followed by

a START message until desired end of transmission, which is indicated with a STOP message

Page 41: Senior Design ii

MSP430

LEDs

Motor Relay

CC2500

CC2500

Vcc – 3.3V

Page 42: Senior Design ii

Software – State Transition

Hand Held Unit (Passive Device) Wait State – Processing input from user Processing State – Receiving and processing sensor data Display State/Transfer – Display to LCD,

Control Box Unit (Active Device) Wait State – Receive wireless transmission/ Check Enabled State – Set Pin high for car/ lights/Random

Decrement. Rolling State – Receive wireless transmission/Check

within 4 mins. Alert State – Alert mode.

Page 43: Senior Design ii

Flow Diagram of States for CBU

Wait State(Iterate Until Receive

Reading)

Enabled State(Enable

Relay/Lights/Green LED bits. Random Request)

Rolling State(Enable Red LED/ Disable

Green LED bits. Iterate until for 4 mins, Receive Reading)

Alert State(Toggle LEDs/Light

bits )

Valid Reading

Valid Reading State Transition

Invalid Reading

Page 44: Senior Design ii

CBU – Variables/ Functions Variables:

static uint8_t sCB(linkID_t); static void

SMPL_LinkListen(&sLID[sNumCurrentPeers]; static void processMessage(linkID_t, uint8_t *,

uint8_t); static void checkChangeChannel(void); static void changeChannel(void); static volatile uint8_t sPeerFrameSem = 0; static volatile uint8_t sJoinSem = 0; static volatile uint8_t sStateTransition = 0; volatile unsigned int timeEnd = 0; unsigned int stateIntGlobal = 0; unsigned int g_seconds=0; unsigned int g_ESeconds = 0; unsigned int randBit = 0; unsigned int randNum;

Functions: void Main(void); void WaitState(void) - Initialize void EnabledState(void); void RandomRollingState(void); void AlertState(void); void incrementSeconds(); void decrementSecondsEnabled(); int rand(void);

Page 45: Senior Design ii

CBU – Pin Out TablePin Functio

nDescription

1 Ground Ground Reference.2 VCC Supply Voltage 3.3V3 P2.0 Timer_A0 Clock Signal Interrupt ~ 1

sec8 P4.3 GPIO/ Enable or disable Green LED.9 P4.4 GPIO/ Motor Relay Enable.10 P4.5 GPIO/Enable or disable Red LED.11 P4.6 GPIO/ Enable or disable Headlight

LEDs.12 Ground Ground Reference.

Setting Register:Set to Output/low:

P4DIR |= BIT4; P4OUT &= ~BIT4;

Set to Input/High:P4DIR &= ~BIT4;

P4OUT |= BIT4;

Page 46: Senior Design ii

Flow Char for Wireless Radio

Join to End Point Listen linkId State Transition/Switch

Statement.

Received frame from End Point?

Change state variable.

No

Yes

Page 47: Senior Design ii

Interlock and Demo Setup The interlock will prevent the vehicle from starting if

the user’s BAC is deemed to be too high. Will do this by routing the fuel pump’s power through a

relay; this will prevent starting whether the starter or clutch (bump start) is used to start the car

Signal from microcontroller will control the relay, which will switch the higher amperage fuel pump power. Protection diode will be used across relay.

For our demonstration, will use an RC car, as no actual vehicle is available for demo purposes

Page 48: Senior Design ii

Interlock and Demo Setup (contd)

µController Relay Fuel Pump (or RC car motor)

Fuse (15 A)

+12V Constant (Car or RC Battery)

Page 49: Senior Design ii

Work Distribution

X. Guo A. Thomas B. Gilzean C. ThomasCase Enclosure

Power Delivery Control Software

Utiliity Software

Sensor Selection

Charging Circuit

Communications (wireless)

Communications (peripheral)

Layout and Design

PCB Layout and Design

Regression Testing

PCB Layout and Design

Page 50: Senior Design ii

Project Status

Page 51: Senior Design ii

Project to date

JANUARY FEBRUARY MARCH APRIL MAY

April 28th, 2010Final Presentation

Hardware Design

Part Acquisition

Received FundingCEI

Testing and Calibration

Assembly

Software Design

PCB Design

HardwareInterface

Final Documentation

Page 52: Senior Design ii

Project Budget: $1000Item Cost Spent

PCB $32.48 (8) $260

Differential Pressure Sensor $0.00

RC Car $40 $40

Battery & Charger $45 $45

Enclosures $15 $15

12V Relay $3 (2) $6

Alcohol Sensor $24.15(2) $25

Voltage Regulator $1.50 (10) $15

Speakers and Buzzers $10 (2) $20

Dry Alcohol Standard Test $325 $0.00

Total $750.84 $425.84