Digital DiaMeter - Western Washington University

advertisement
Spring 2014
Digital DiaMeter
Hardware Description
Oneil Kwangwanh
WESTERN WASHINGTON UNIVERSITY
INTRODUCTION
Digital DiaMeter is an electronic device that will be able to digitally measure the diameter of
large, industrial pipes. The idea was first realized by Todd Bishop, when he noticed his
employers dangerously atop tall ladders trying to wrap a piece of measuring tape around large
pipes.
MICROCONROLLER
The microcontroller used in the Digital DiaMeter is the cheap ATmega328. This 28-pin part
features an 8-bit processor, 23 GPIO pins, 32K bytes of in-system self-programmable flash
memory, 2K bytes of SRAM, 1K bytes EEPROM. 3 GPIO pins are used to monitor the three
outputs of the rotary encoder, 6 pins for the LCD display, 1 pin will use to digitally power on/off
the rotary encoder, and lastly 1 pin will be used to digitally turn the entire system off if it has
been running for a certain amount of time.
POWER SUPPLY
9V Battery
Power is supplied using a lithium 9V battery. Off the shelf 9V batteries have an amphour rating between 400 – 600 maH. Duracell’s PROCELL MN1604 9V battery has a
typical discharge rate of 350 hours if the battery is constantly sourcing 2 mA. Because
the system powers down the rotary encoder when not in use, the bulk of the current
draw comes from the microcontroller. In active mode, the microcontroller draw 0.2 mA.
At this rate, the device would be powered for the entire life of the rated battery.
Latching Switch Circuit
FIGURE 1: Latching Switch
Shown above is a latching switch circuit. This is used to handle the case in which a user
accidentally leaves the power button on. SHDN will be connected to the SHDN (Shut
Down) pin of the LM2841 (DC-DC Voltage regulator). When Q3 is on, the latching switch
circuit powers the voltage regulator, and when it is off, the latching switch shuts down
the voltage regulator in turn powering down the system.
Voltage Regulation
FIGURE 2: Voltage Regulation Circuit
Voltage is regulated by the LM2841 and the voltage regulation circuit. The input voltage
can range from 4.5V – 42V. The components selected match the recommended setup
for the 5V output provided by the datasheet.
ROTARY ENCODER
The E6C2-CWZ6C (rotary encoder) has a power supply of 5 volts provided by the voltage
regulation circuit. It has three outputs which are connected to PB1-PB3 of PORTB. The E6C2CSZ6C’s three outputs are open collector, meaning they need to be pulled high. I opted to use
the ATmega328’s internal pull-up resistors to reduce the amount of components and cost. The
power supply to the encoder is being driven by a p-channel MOSFET. When PB0 is pulled low,
the power supply to the encoder is cut off by J1.
USER INTERFACE
LCD
The LCD used is the NHD-0216BZ-FL-YBW, the same LCD using in ETEC454. 6 lines are
used and are connected to PD0-PD5. There are 4 data lines, 1 register select, and 1
operation enable signal.
Push Buttons
There will be two push buttons to aid in user interface. One (SW1) will be used to
power the device on and off, while the other (SW2) will be used to take actual
measurements.
PARTS LIST:
ITEM
1
2
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SCHEMATIC:
QTY
1
1
1
1
2
1
2
1
1
1
4
1
1
2
1
3
4
1
1
1
PART DESCRIPTION
MCU, ATmega328
Rotary Encoder, E6C2-CWZ6C
LCD, NHD-0216BZ-FL-YBW
DC-DC Regulator, LM2841
NPN Transistor, 2N3904
PNP Transistor, 2N3906
Push Button Switch,
Capacitor, 2.2 uF
Capacitor, 0.15 uF
Capacitor, 47 uF
Capacitor, 0.1 uF
Resistor, 5.62K Ohms
Resistor, 1.02K Ohms
Resistor, 100K Ohms
Resistor, 10 Ohms
Resistor, 470K Ohms
Resistor, 10K Ohms
Resistor, 1K Ohms
Resistor, 1M Ohms
Xener Diode, MA2YD26
DESIGNATORS
U2
U1
U3
U4
Q1, Q3
Q2
SW1, SW2
C1
C2
C3
C4, C5, C6, C7
R1
R2
R3, R12
R4
R5, R6, R9
R7, R8
R10
R11
D1
Download