Tubing Using some old left around PVC pipes we made the basis for the project. It consists of places for gas sensor, the pressure sensor, and a one way valve from a snorkel so that the air can be left in the balloon with enough time for the sensors reading to settle. There is a bent piece that is used as a spit trap; this was one of the things that the previous breathalyzer project group had problems with, so we added this piece to avoid a buildup of saliva near our sensors.
Pressure Sensor We used a MPX2050 differential pressure sensor from FreeScale Semiconductors. It has a range from 0 50 kPa. This is nearly impossible for anyone to generate with their lungs but it worked well for our case as a binary device. Since the output was only at most 3-5 mV, we used a LMC7111 as a differential amplifier with a gain of 100. This signal is sent to the ADC on the MCU and the threshold is set by the software.
Gas Sensor The TGS2620 from Figaro sensors worked well for us. It is extremely sensitive to ethanol which makes it especially suited to our purposes. The device contains a heater that run on only a few milliamps, and a variable resistor that changes based on the gases in the air around it. The output is fed into the ADC and averaged over a few second span after the pressure sensor triggers the program. For our device, we did not require a precise measurement of the BAC, only a binary output on whether or not to open the door.
Solenoid Our Solenoid is a very small push-pull device that provides a large amount of force for a short distance. This is perfect for our application so that it can be installed inside of a door frame, and is still strong enough to push back the tab and unlock the door. It runs on 5Vdc which made things much easier. In order to drive the solenoid, we had to use a small transistor in order to remove load and noise from the MCU.
Keypad The keypad is a typical 12 button touch-tone type pad. With seven output pins, it required little change from our previous programs, to debounce and read the key presses.
LCD We used a simple 1 line 16 character for our door lock. This is mainly for entering codes, and to make sure the device is operating properly. This was not an absolute requirement for the device, but it made debugging easier and the device more user friendly.
Administrative Mode This mode allows a person to perform various tasks. To enter this state, a certain 4 digit code must be entered. From this point, a person can lock the system down, return it to normal mode, add valid codes, delete valid codes, and enter a debug state that we use to calibrate the sensors.
Pressing these keys in the mode perform the following actions
v 1: Locks the system down, no pressure readings are taken and you can not unlock the door until normal mode is restored
v 2: Returns the system to normal access mode. A low BAC or a valid code will allow entry
v 3: Adds a code. Pressing 3 and then the 4 digit code will put it in the code table
v 4: Deletes a code. Invalidates the next 4 digit code given if it is in the table.
v 5: Debug mode. Continuously Prints the values from the gas or pressure sensor
v 9: Changes the Administration Code. Replaces the current 4-digit administration code with another
v 0: Returns to the Initial State
While in administrative mode it is still possible to open the door using the pressure sensor and gas sensor
Overall The code was relatively simple. The only tricky part was to get the system to continually update the pressure and BAC levels over a long period of time. The gas sensor is extremely slow and it needs a few seconds to level out. The code can easily be built upon especially the administrative functions. There are many different things that we could have done with regards to access rules.