Homework 5: Theory of Operation and Hardware Design Narrative s1

Total Page:16

File Type:pdf, Size:1020Kb

Homework 5: Theory of Operation and Hardware Design Narrative s1

ECE 477 Digital Systems Senior Design Project Rev 8/09

Homework 5: Theory of Operation and Hardware Design Narrative

Team Code Name: __The Inebriation Station______Group No. __1___ Team Member Completing This Homework: __Jonathan Schwarz______E-mail Address of Team Member: ___jmschwar___ @ purdue.edu

Evaluation:

SCORE DESCRIPTION Excellent – among the best papers submitted for this assignment. Very few 10 corrections needed for version submitted in Final Report. Very good – all requirements aptly met. Minor additions/corrections needed for 9 version submitted in Final Report. Good – all requirements considered and addressed. Several noteworthy 8 additions/corrections needed for version submitted in Final Report. Average – all requirements basically met, but some revisions in content should 7 be made for the version submitted in the Final Report. Marginal – all requirements met at a nominal level. Significant revisions in 6 content should be made for the version submitted in the Final Report. Below the passing threshold – major revisions required to meet report * requirements at a nominal level. Revise and resubmit. * Resubmissions are due within one week of the date of return, and will be awarded a score of “6” provided all report requirements have been met at a nominal level.

Comments: ECE 477 Digital Systems Senior Design Project 8/09

1.0 Introduction The Inebriation Station is a microcontroller-driven, standalone beverage dispenser that interfaces with a customer without continuous human vendor support. A customer places his cup in an indentation under the beverage spout and breaks an infrared beam which communicates with the microcontroller using a standard I/O pin. The beam break triggers the microcontroller to initiate a read from the RFID reader with a standard I/O pin, and the RFID tag on the bottom of the customer’s cup is read. The RFID reader returns the RFID tag number to the microcontroller through UART. Upon receiving the tag number, the microcontroller sends the RFID tag number to a wireless card through SPI, and that wireless card sends the data to a computer on the standard 802.11 protocol. The wireless card then receives user and beverage information from the computer and sends that data to the microcontroller through SPI. The microcontroller displays information to the customer on an LCD through a UART interface. At the same time, the microcontroller accepts user input on a keypad which communicates through an encoder in parallel. After the customer makes a selection, the microcontroller opens a solenoid with a standard I/O pin to allow the correct beverage to pour the correct amount.

2.0 Theory of Operation The Inebriation Station has four discrete power nets. Two discrete wall-warts are used to produce two different +12VDC @ 1A supplies on board. Since the solenoids draw 575mA of current when on and negligible current when off [1], a voltage spike will likely be seen on the +12V line when switching which could negatively impact logic circuits. For that reason, one +12V wall-wart is used solely to power the solenoids and the fridge switch, and the other wall- wart is used to supply the logic voltages. The wall-wart supplying the solenoids is not regulated on the board as the solenoids can operate from 10.6-12.6V and still allow fluid to flow at its full rate [2]. The other +12V wall-wart feeds into two switching regulators, an LT1767-3.3 and an LT1767-5, to supply the logic voltages for the rest of the circuit components [3]. A 12V wall- wart is utilized to meet the current demands of all of the logic circuitry, including the IR LEDs, relay, LCD backlight, microcontroller, and Wi-Fi module.

If a customer is not interacting with the Inebriation Station, the only peripheral components being used are the four temperature sensors, which are all TI TMP175. The microcontroller polls the four temperature sensors every minute and averages the temperature for a more accurate

-2- ECE 477 Digital Systems Senior Design Project 8/09 reading. Each temperature sensor is given a unique 7-bit I2C address by pulling certain pins high or low. The I2C interface is used so that many (up to 27 for the TMP175) temperature sensors can all be connected on the same I2C bus [5]. Since the TMP175 can operate from 2.7-5.5V while the PIC24FJ128GB108 only operates at 3.3V logic, all of the temperature sensors are operated at 3.3V [5],[6]. This prevents the need for level translation of the signal between the microcontroller and the temperature sensors, allowing the microcontroller to communicate with the sensors directly. The I2C bus is run at 100kHz since that is the lowest frequency explicitly stated in the PIC datasheet, and the TMP175 can operate up to 3.4MHz[5],[6]. Since 100kHz will transmit the 9-bit temperature reading in a negligible amount of time, reliable data from each temperature sensor is more important than speed. Finally, the temperature sensors are run at 9- bit resolution to minimize the internal A/D conversion time (27.5ms) [5]. A 9-bit resolution achieves a .5°C temperature resolution, which is sufficient for monitoring a refrigerator’s temperature [5].

The IR beam-break sensor is a simple transmitting IR LED that is always on, and a receiving IR photo-transistor that has a 10kΩ connecting its collector to power. When the beam exists, the receiver will drive current across the 47kΩ resistor and produce a logic 1. When the beam is broken, it produces a logic 0. The circuit is driven by 5V to ensure that the input high threshold on the microcontroller is met since the output for a logic 1 can be ~1.3V lower than the driving voltage. The sensor is interfaced with a general purpose I/O pin that can handle 5V input logic to ensure a pin will not be burnt out.

Once a cup is detected by the IR sensor, the microcontroller use a general purpose I/O pin to drive the enable pin on the Parallax RFID reader low, turning the RFID antenna on [8]. Two successive 12-byte tag readings are taken by the RFID reader and sent to the microcontroller through UART at 2400 baud [8]. While 2400 baud is not a chosen value, it is sufficient to appear seamless to the user since the data from the two successive reads can be transmitted through UART to the microcontroller in 0.1s. The data sheet does not specify the time taken to actually transmit power to the tag, read the tag, and decode it, but it is likely much longer than the time it takes to transmit that data through UART, further demonstrating that 2400 baud is sufficient. Since the RFID reader operates at 5V, and the microcontroller operates at 3.3V, a bi-

-3- ECE 477 Digital Systems Senior Design Project 8/09 directional level translator (MAX3001E) sits between these two components. The level translator can operate at 4Mbps, so 2400 baud is an acceptable data rate [7].

At this point, the microcontroller sends the RFID tag number to the wireless card (ZG2101M) which communicates with an off-product database through 802.11b protocol. That database sends back beverage and user data to the wireless card. The wireless card can operate at 1Mbps or 2Mbps [9]. Since 1024 bits is the most data ever sent or received at one time (80 bytes for 4 beverages, 16 bytes for 4 fill levels, and 32 bytes for user information), the wireless card is configured to operate at 1Mbps, and will be stepped up to 2Mbps after it is proven to work at 1Mbps. At this rate, the largest data packet will transfer in 1ms. The microcontroller and Wi-Fi card communicate through SPI. While the wireless card SPI can operate at a baud rate up to 25MHz and the PIC24F can operate its SPI up to 8MHz, the SPI interface between the microcontroller and the wireless chip is operated at 100KHz to ensure enough time (640 microcontroller cycles) for the data to be read out of the SPI receive data registers to ensure data is not lost[6],[9]. Again, the largest amount of information transferred (1KB) will still be able to be transferred in 10ms. Because it takes 50ms to wake the wireless card out of hibernation, a general purpose I/O pin goes low to wake the wireless card as soon as the IR beam-break sensor is activated. The wireless card is put back into hibernation by pushing that pin high only after the entire user transaction is complete, and the Inebriation station is waiting for a new customer. Moreover, the wireless card has access to an interrupt pin on the microcontroller so it can tell the microcontroller to start reading in data through the SPI.

To display the retrieved data to the user, the microcontroller uses UART to communicate to a Crystalfontz LCD. The LCD is capable of receiving data with RS-232 or “inverted RS-232” [10]. Inverted RS-232 is the standard 0-5V UART logic output by most microcontrollers, and is how the Inebriation Station’s microcontroller is configured to communicate with the LCD. Like the RFID reader, a level translator is used to translate the 3.3V logic to 5V logic. The fastest baud rate of the LCD (19200 baud) is selected since, at that rate, it already takes 40ms to refresh the 80 character screen. Any slower of a refresh rate may be detectable by the customer.

The user communicates with the microcontroller through a 20-key keypad interfaced with an MM74C923 key encoder. The MM74C923 is configurable through modification of decoupling

-4- ECE 477 Digital Systems Senior Design Project 8/09 capacitor values [11]. To correctly de-bounce the input, capacitors were selected that would scan the keypad every 1ms and would require a key to be pressed for 10ms to be registered as a key press [11]. The encoder interfaces through parallel to the microcontroller with 5 general purpose I/O pins and 1 interrupt pin [11]. The interrupt is used to tell the microcontroller that data is available, and ensure that the data is read before it is cleared. Attempting to give the user more options, two general purpose I/O pins are controlled by pushbuttons for “Beer Me!” and “manual pour.”

The solenoids can operate at a variety of different supply voltages, from 12V-240VDC or 120VAC-480VAC [1]. The solenoids in the Inebriation Station operate at 12VDC because 12V is a readily available wall-wart. Furthermore, relative to 240V, 12V minimizes the total potential seen on the PCB, and is easier to switch with a simple n-MOS device. The AC powered solenoids were avoided because they are more difficult to switch on and off with solid state devices, and the AC signal tends to create noise. Each solenoid is switched on by a power n- MOS device (IRF510) which has its gate tied to a general purpose I/O pin on the microcontroller. The n-MOS device allows the low-current, low-voltage I/O pin to turn the 575mA, 12V solenoid on and off [4]. The solenoids are normally closed, and open for a specified amount of time to allow a specified amount of beverage to flow into the customer’s cup.

As a final note, all logic signals sent off-board are sent via shielded wire grounded near the microcontroller to prevent interference and to prevent ground loops.

3.0 Hardware Design Narrative For the Inebriation Station, input and output is the most important function of the microcontroller. The internal oscillator of 8MHz was selected as the clock for the microcontroller [6]. To determine the clock rate of the microcontroller, the most cycle intensive interrupt needs to be determined. Though all of the software has not yet been written, it is reasonable to assume the longest interrupt should last less than 500 cycles. The fastest data being sent/received by the microcontroller is the SPI interface to the wireless card at 100kbps or 12.5kB/s. Therefore, if a clock rate of 8MHz is chosen, any interrupt should be fully serviced at 16k-interupts/s, leaving plenty of time to read/send more bytes to the wireless card through the

-5- ECE 477 Digital Systems Senior Design Project 8/09

SPI between interrupts. Furthermore, the internal oscillator of the PIC24FJ128GB108 natively runs at 8MHz, making 8MHz an even more “natural” choice [6].

Microcontroller pins are selected to try to use only two sides of the microcontroller so all of the headers can be located on one or two sides of the PCB. From there, pins going to the same peripherals are located as closely to each-other as possible in the order they are presented on the header so that traces on the PCB can be run in parallel, minimizing vias. A final consideration was that any input pin that received 5V logic needed to be routed to a pin capable of receiving 5V. A list of pins used can be found in Appendix A.

4.0 Summary This report summarizes all of the operating considerations for each of the major components in the Inebriation Station. The major peripherals as well as their supply voltages, their operating frequencies, and their interfaces are thoroughly covered in Section 2.0. The microcontroller frequency, pin selection, and interface choices are covered in Section 3.0. As seen in this report, each component operates at the slowest, most reliable frequency acceptable to appear instantaneous to the customer, and operates as close to the microcontroller supply voltage as possible.

-6- ECE 477 Digital Systems Senior Design Project 8/09

List of References

[1] ASCO, “Subminiature Solenoid Valves,” 8256_NSFR1 Data Sheet, (n.d.). [Online]. Available: http://www.ascovalve.com/Common/PDFFiles/Product/8256_NSFR1.pdf. [Accessed: February 17, 2010].

[2] ASCO, “Engineering Information,” (n.d). [Online]. Available: http://www.thevalveshop.com/menu/auto/asco/engineering.pdf. [Accessed: February 17, 2010].

[3] Linear Technology, “Monolithic 1.5A, 1.25MHz Step-Down Switching Regulators,” LT1767/LT1767-1.8/LT1767-2.5/LT1767-3.3/LT1767-5 Data Sheet, 1999. [Online]. Available: http://www.linear.com/pc/downloadDocument.do? navId=H0,C1,C1003,C1042,C1032,C1064,P1915,D1885. [Accessed: February 17, 2010].

[4] Vishay, “Power Mosfet,” IRF510, SiHF510 Data Sheet, 2008. [Online]. Available: http://www.vishay.com/docs/91015/91015.pdf. [Accessed: February 17, 2010].

[5] Texas Instruments, “Digital Temperature Sensor with Two-Wire Interface,” TMP175, TMP75 Data Sheet, 2007. [Online]. Available: http://focus.ti.com/lit/ds/symlink/tmp175.pdf. [Accessed: February 17, 2010].

[6] Microchip, “PIC24FJ256GB110 Family Data Sheet,” 2009. [Online]. Available: http://ww1.microchip.com/downloads/en/DeviceDoc/39897c.pdf. [Accessed: February 17, 2010].

[7] Maxim, “+1.2V to +5.5, 15kV ESD-Protected, 0.1uA, 35Mbps, 8-Channel Level Translators,” MAX3000E/MAX3001E/MAX3002–MAX3012 Data Sheet, 2008. [Online]. Available: http://datasheets.maxim-ic.com/en/ds/MAX3000E-MAX3012.pdf. [Accessed: February 17, 2010].

[8] Parallax Inc, “RFID Card Reader, Serial/USB,” 28140/28340 Data Sheet, 2008. [Online]. Available: http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/28140- 28340-RFID%20Reader-v2.1.pdf. [Accessed: February 17, 2010].

[9] ZeroG, “DS101: ZG2100M/ZG2101M Wi-Fi Module Datasheet,” (n.d.). [Online]. Available: http://support.zerogwireless.com/FileManagement/Download/1d4f0f784fef4374ac2b53 4b3cba95b9. [Accessed: February 17, 2010].

[10] Crystalfontz, “Serial LCD Module Specifications,” CFA634-TMC-KS Data Sheet, 2005. [Online]. Available: http://www.crystalfontz.com/products/634/datasheets/342/CFA- 634_v2.0.pdf. [Accessed: February 17, 2010].

[11] Fairchild Semiconductor, “16/20-Key Encoder,” MM74C922/3 Data Sheet, 1987. [Online]. Available: http://www.fairchildsemi.com/ds/MM/MM74C923.pdf . [Accessed: February 17, 2010].

-7- ECE 477 Digital Systems Senior Design Project 8/09

-8- ECE 477 Digital Systems Senior Design Project 8/09

Appendix A: List of Ports Used

-9- ECE 477 Digital Systems Senior Design Project Rev 8/09 NOTES Appendix 1. General purposeSpecial I/O are connectedB: System directly to Pin # Pin Name Input/Output Use in Design red Microcontroller block and unlabeled Block Notes Diagram 80 PMD4/CN62/RE4 Input Keypad Data Line E 2. Rx, Tx, SPO,5V SPI input are all from microcontroller perspective. 79 PMD3/CN61/RE3 Input Keypad Data Line D 3. Italics denote5V Active input -Low +3.3V 78 PMD2/CN60/RE2 ZG2101MInput 2.4 GHz Keypad Data Line C 5V input 77 PMD1/CN59/RE1 ZG2101M802.11bInput WI-FI 2.4 GHz Keypad Data Line B 5V input 76 PMD0/CN58/RE0 802.11bInput WI-FI Keypad Data Line A 5V input +5V H1 +5V H2 4 Potentially used as an 75 CN77/RG0 Input Keypad Data Available Line interrupt WIFI INT +5V 74 CN78/RG1 Input WIFI CE IR Sensor 5V input CFA634-TMC-KS +3.3V 69 C3INA/CN16/RD7Tx Input Beer Me Button CFA634-TMC-KSLCD Display LCD Display 68 C3INB/CN15/RD6 Input Manual Pour Button 40 RP17/PMA8/CN18/RF5 Input RFID UART RX 5V input 39 RP10/PMA9/CN17/RF4 Input RFID Data Ready Rx5V input IR Break Beam Serial RFID IR Break Beam 65 CN19/RD13 UART OutputSPI FridgeUART Power Out to n-MOS Serial RFID Sensor UART OE Reader Sensor 64 RPI42/CN57/RD12 UART OutputSPI Solenoid 4 Power Out to n-MOS Reader 03 SDL3/PMD7/CN65/RE7 Output Solenoid 3 Power Out to n-MOS Beer-Me Button & 62 DPH/RP23/CN51/RD22 Output Solenoid 2 Power Out to n-MOS Beer-MeFill Button Button & 02 SCL3/PMD6/CN64/RE6 PIC24FJ128GB108Output Solenoid 1 Power Out to n-MOSPull-up +3.3V Fill Button PIC24FJ128GB108Microcontroller Resistor +5V Microcontroller Potentially an 60 SOSCO/T1CK/C3INC/RPI37/CN0/RC14 Input Wi-Fi Data Ready SCL interrupt Keypad 6 I2C Keypad 9 2 4 x TITMP75 Keypad58 DMH/RP11/INT0/CN49/RD0 Output Wi-Fi SPII C SDO 4 x TITMP75 Keypad Controller SDA Temp Sensor Controller57 RP12/PMCS1/CN56/RD11 Output Wi-Fi SPI SCLK Temp Sensor 56 SCL1/RP3/PMCS2/CN55/RD10 Input Wi-Fi SPI SDI 55 SDA1/DPLN/RP4/CN54/RD9 Output Wi-Fi SPI SEL 54 DMLN/RTCC/RP2/CN53/RD8 Output Wi-Fi Chip Enable 53 SDA2/RPI35/CN44/RA15 Input/Output555 Temperature Sensor I2C SDA A0 A1 A2 52 SCL2/RPI36/CN43/RA14+12V Output Temperature Sensor I2C SCL 43 RP15/CN74/RF8 5 x IRL530 PowerInput N-MOSFETUART RX to header for Wireless 42 RP30/CN70/RF2 5 x IRL530Output Power N-MOSFETUART TX to header for Wireless 555 41 RP16/USBID/CN71/RF3 Output UART Tx for LCD +12V 4 x U8256A108E Solenoid Valves 4 x U8256A108E1 x Freezer Solenoid Chest Valves 1 x Freezer Chest

Recommended publications