Oneil Kwangwanh ETEC471 – Project Description 12.11.2012 DDM – Digital Diameter Meter 0 TABLE OF CONTENTS FUNCTIONAL DESCRIPTION……………………………………………………………………………………………………………………..2 Introduction………………………………………………………………………………………………………………………………..2 Description and Sketch...…………………………………………………………………………………………………………….2 Features…….……………………………………………………………………………………………………………………………….3 Detailed Functional Description…………………..……………………………………………………………………………..3 Software……………………………………………………………………………………………………………………………………..4 User Interface……………………………………………………………………………………………………………………………..4 STANDARDS…………………………………………………………………………………………………………………..………………………..6 DEVELOPMENT PLAN……………………………………………………………………………………………………………….……………..6 Weekly Schedule………………………………………………………………………………………………………………….……..6 Description of Hardware/Software…………………………………………………………………………..………….……..7 Description of Demonstration……………………………………………………………………………………….….………..7 ELECTRICAL SPECIFICATIONS……………………………………………………………………………………………………………………7 Project Specifications………………………………………………………………………………………………………..………..7 Power Requirements.………………………………………………………………………………………………………………….7 Special Environmental Requirements………………………………………………………………………………………….7 PRELIMINARY PARTS LIST…………………………………………………………………………………………………………………………8 1 FUNCTIONAL DESCRIPTION a. Introduction: The Digital Diameter Meter (DDM) is a device that will digitize the process of measuring the diameter of pipes. The user will be able to quickly measure pipe diameters ranging from 6 inches all the way up to 96 inches in diameter. b. Description & Sketch: The purpose of the DDM is to digitize the process of measuring the diameter of pipes. The idea was first realized by Todd Bishop, president and owner of BRER Technical, INC., when his employees found themselves atop tall ladders trying to wrap measuring tapes around large pipes. Referring to Figure 1, the DDM will have a fixed “W” and will use a rotary encoder to measure “H” of a given pipe. I will need to convert the value returned by the encoder to an “H” value in inches. Using these two values, the microcontroller will then calculate radius and diameter, and output calculated diameter and the closest standard size to an LCD display. FIGURE 1 FIGURE 2: Side view sketch of DDM 2 c. Features: 1. Accurately calculate the diameter of a given pipe ranging from 6” to 96” in diameter. d. Detailed Functional Description: FIGURE 3: Block diagram Microcontroller The ideal and actual microcontroller used for the DDM is an ATMega328P. This 28-pin chip features 32KB of flash memory, 1KB of EEPROM, and 2KB of internal SRAM. The resources used will be the MCU’s SPI and GPIO. The SPI for the LCD display and the GPIO in order to read data from the encoder. One external switch will have to be used in order to run the interrupt service routine that will sample data from the encoder. Rotary Encoder The ideal encoder used for measurements would be one with a digital output such as the E6B2-CWZ6C. This specific encoder has five wires: power supply, output phase A, output phase B, output phase Z, and ground. Connecting the output phases to 3 GPIO pins on the ATMega328P, the DDM will be able to monitor the amount of pulses the encoder has revolved. LCD Display If we look at FIGURE 5, we see an example of an output to the LCD display. This example is 29 pixels tall and 38 pixels wide and shows the largest message that needs to be 3 displayed. The smallest standard LCD display is 48x84 and ideally would communicate with the ATMega328P over SPI. Power Supply Both the encoder and the MCU will need a 5V power supply, while the LCD Display has a maximum power supply voltage of 3.3V. Because two different power supplies are required for the system, one dual output buck converter will be used sourced from one 9V battery. e. Software: The program used to read and handle data from the encoder and to output to the LCD display will all be written in the C programming language. I will be using Atmel studio and an STK500 to program the ATMega328P. The main bulk of the code will be converting the value returned by the encoder and interfacing with the LCD display. The kernel will contain two different modules: one that samples and the other that calculates data and outputs to the LCD display. The calculation/output module will run so long as the sample button is not depressed. This module will average all of the samples taken from the sample module, calculate the diameter, and display the calculated and actual diameter to the LCD display. If the kernel has no samples (i.e. upon start up), then the module will output zeros to the display. (“Calculated Diameter: 0.000 inches.”) The sample module, which will be triggered by an external interrupt (sample button), will sample data from the encoder at a given sample rate. It will sample data as long as the switch is depressed. f. User Interface: FIGURE 4: User interface layout 4 O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O FIGURE 5: Example output FIGURE 6: State diagram for user interface The user interface will consist of an LCD display, an ON/OFF switch, a reset button, and a sample button. The device will have two states: SAMPLE and OUTPUT. The device boots up into the OUTPUT state. When the sample button is depressed, the device will enter the SAMPLE state where the DDM will take readings from the encoder at a given sample rate. Once the sample button is released, the DDM returns to the OUTPUT state. In this state, the device will average all of the samples received while in the SAMPLE state. I will then have to convert this value into the equivalent “H” value in inches and, using this “H”, calculate the diameter of the pipe. The DDM will then output both the actual calculated diameter and the standard industrial pipe size closest to that of the calculated to the LCD display. An example of the output is provided in FIGURE 5 where the “O’s” are pixels that are filled in. This information will remain on the LCD display until the reset button is depressed or the sample button is depressed (returning it to the sample state.) 5 Because the device boots into the output state, the device will output zeros to the display. For example, it would be identical to that of FIGURE 5 except instead of “11.11” it would display “00.00.” It would be the same if the user were to press the reset button. g. Sustainability: The DDM will operate off of one 9 volt battery which requires no proper disposal methods. In order to save power consumption, the DDM will have a sleep mode. If the device is on for a certain amount of time (x amount of clock cycles), then it will put the MCU into low power mode. The user will have to depress and release the sample or reset button once, or turn the device off then on in order to “wake” the DDM up. STANDARDS NPS – Nominal Pipe Size A North American set of standard sizes for pipes used for high or low pressures and temperatures. DEVELOPMENT PLAN a. Weekly Schedule: WEEK # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 DATES 1/7 - 1/11 1/13 - 1/18 1/21 - 1/25 1/27 - 1/31 2/3 - 2/7 2/10 - 2/14 2/18 - 2/21 2/24 - 2/28 3/3 - 3/7 3/10 - 3/14 3/17 - 3/21 3/24 - 3/28 4/2 - 4/4 4/7 - 4/11 4/14 - 4/18 4/21 - 4/25 4/28 - 5/2 5/5 - 5/9 5/12 - 5/16 5/19 - 5/23 5/26 - 5/30 6/2 - 6/6 6 PLAN Finish mechanical design Finish mechanical design Finish mechanical design Rotary encoder interface Rotary encoder interface Rotary encoder interface Rotary encoder interface LCD interface LCD interface LCD interface Dead Week Spring Break Buck converter interface Buck converter interface Buck converter interface Hardware design review Debug/Clean up code Debug/Clean up code Software presentation Code review Demonstration preparation Final demonstration b. Description of hardware/software: The testing and the design will take place mostly in the Ross Engineering Technology Lab in ET340 and ET333 on Western Washington University’s campus. The required tools and software required to complete this project will be Atmel Studio, MATLAB, a digital oscilloscope, and a soldering kit. Because the computers in the ET340 and ET333 labs do not contain Atmel Studio, I will run the software off of an external hard drive. c. Description of demonstration: To demonstrate the final product, I will have a cardboard presentation board to present the design, dimensions, and implementations. Also I will have a few (three to five) pipe cutouts of varying diameter lengths that people will be able to test the DDM on. ELECTRICAL SPECIFICATIONS a. Project specifications (as required): SPECIFICATION Pipe Diamter Range Resolution Accuracty DESCRIPTION 6" - 96" hundreths place .01 of an inch b. Power requirements: SPECIFICATION Rotary Encoder ATMega328P active ATMega328P power-save Nokia 5110 DESCRIPTION 80 mA .2 mA .75 micro amps 10mA The standard 9V battery is typically rated around 400 – 600 mAh. The Duracell PC1604 for example is rated at 500 mAh. The DDM will consume 90.2 mA whilst in active mode and 10.00075 mA in power-save mode. If the DDM were operating with this PC1604 it would last 5.54 hours in active mode and 50.00 hours in power-save mode. The entire process of measuring the pipes is estimated to take two hours and is done roughly once a week. I estimate the DDM to be in active mode for 50% of the time. So by these figures the battery would last around five weeks. c. Special environmental requirements: SPECIFICATION Operating Temperature Range (Celcius) 7 DESCRIPTION -10 to 60 PRELIMINARY PARTS LIST PART Atmel Microcontroller OMRON Rotary Encoder 2000 P/R 84x48 Nokia 5110 LCD Module Display Linear Technology Dual DC/DC Controller Resistors Capictors MANUFACTURER PART # ATMega328P E6B2-CWZ6C PCD8544 LTC3890-1 8 QUANTITY 1 1 1 1 10 10 TOTAL POWER 45 mW 400 mW 300 mW 250 mW X X 995 mW COST $3.16 $32.40 $3.99 $6.80 $0.05 $0.05 $47.35