Appendices - Harding - Home dispensing device... · Appendices . Appendix A: Rack Specification...

Preview:

Citation preview

Appendices

Appendix A: Rack Specification Sheet

A-1

Appendix B: Pinion Specification Sheet

B-1

Appendix C: Specification Sheets for Motors One

and Two

Motor One Specification Sheet

C-1

C-2

Motor Two Specification Sheet

Item Specifications

Step Angle 0.9°

Step Angle Accuracy ±5% (full step, no load)

Resistance Accuracy ±10%

Inductance Accuracy ±20%

Temperature Rise 80°C Max.(rated current,2 phase on)

Ambient Temperature -20°C~+50°C

Insulation Resistance 100M Ω Min. ,500VDC

Dielectric Strength 500VAC for one minute

Shaft Radial Play 0.02Max. (450 g-load)

Shaft Axial Play 0.08Max. (450 g-load)

Max. radial force 28N ( 20mm from the Flange )

Max. axial force 10N

Rotation CW( See from Front Flange )

C-3

Model No. Rated

Voltage Current

/Phase Resistance

/Phase Inductance

/Phase Holding

Torque # of

Leads Rotor

Inertia Weight Detent

Torque Operating

Curve Length

Single Shaft Double Shaft V A Ω mH Kg-cm g-cm2 kg g-cm mm

SY42STH33-0956MA SY42STH33-0956MB 4 0.95 4.2 4

1.58 6

35 0.22 200

a

33

SY42STH33-0606MA SY42STH33-0606MB 6 0.6 10 9.5 b

SY42STH33-0316MA SY42STH33-0316MB 12 0.31 38.5 33 c

SY42STH33-1334MA SY42STH33-1334MB 2.8 1.33 2.1 4.2 2.2 4 d

SY42STH38-1206MA SY42STH38-1206MB 4 1.2 3.3 3.4

2.59 6

54 0.28 220

e

38

SY42STH38-0806MA SY42STH38-0806MB 6 0.8 7.5 6.7 f

SY42STH38-0406MA SY42STH38-0406MB 12 0.4 30 30 g

SY42STH38-1684MA SY42STH38-1684MB 2.8 1.68 1.65 3.2 3.3 4 h

SY42STH47-1206MA SY42STH47-1206MB 4 1.2 3.3 4

3.17 6

68 0.35 250

i

47

SY42STH47-0806MA SY42STH47-0806MB 6 0.8 7.5 10 j

SY42STH47-0406MA SY42STH47-0406MB 12 0.4 30 38 k

SY42STH47-1684MA SY42STH47-1684MB 2.8 1.68 1.65 4.1 4.4 4 l

C-4

Appendix D: Microchip dsPIC30F6015

D-1

D-2

D-3

D-4

Appendix E: Real Time Clock DS1307

E-1

E-2

E-3

Appendix F: 4x4 Grayhill Matrix Keypad

F-1

F-2

Appendix G: Keypad Encoder EDE1144

G-1

G-2

G-3

Appendix H: Liquid Crystal Display GDM2004M

H-1

H-2

Appendix I: PM3 to ICSP™ Converter AC164111

I-1

Appendix J: Magnetic Switches

J-1

Appendix K: Electrical System Schematics

K-1

Appendix L: Working C30 C Code

Program 1: /*! \file LCDv2.h \brief Subroutines for LCD. This header file contains all subroutines needed to initialize, to enter into command mode, and enter data mode of the LCD. List of commands: 1. Function Set: 8-bit, 1 Line, 5x7 Dots ------------- 0x0030 2. Function Set: 8-bit, 2 Line, 5x7 Dots ------------- 0x0038 3. Entry Mode --------------------------------------- 0x0006 4. Display off Cursor off ---------------------------- 0x0008 (clearing display without clearing DDRAM content) 5. Display on Cursor on ------------------------------ 0x000E 6. Display on Cursor off ----------------------------- 0x000C 7. Display on Cursor blinking ------------------------ 0x000F 8. Shift entire display left ------------------------- 0x0018 9. Shift entire display right ------------------------ 0x001C 10. Move cursor left by one character ----------------- 0x0010 11. Move cursor right by one character ---------------- 0x0014 12. Clear Display (also clear DDRAM content) ---------- 0x0001 13. Set DDRAM address or courser position on display -- 0x0080+add* 14. Set CGRAM address or set pointer to CGRAM location 0x0040+add** */ #ifndef __LCDv2_H #define __LCDv2_H void LCD_init(); void LCD_busy(); void LCD_command(unsigned char command); void LCD_senddata(unsigned char data); void LCD_sendstring(unsigned char *stringToPrint); void LCD_build(); void LCD_build1(unsigned char location, unsigned char *ptr); #include "p30F6015.h" #define LCD_data PORTB #define LCD_data_dir TRISB #define LCD_D7 PORTBbits.RB7 #define LCD_rs PORTGbits.RG7 #define LCD_en PORTGbits.RG8 /** * LCD has to be initialized either by the internal reset circuit or sending a * sequence of commands to initialize the LCD. It is the programmer who has to * decide whether to initialize the LCD by instructions or by the internal reset * circuit. * * This subroutine utilizes sending the sequence of commands method. * * @return Void */ void LCD_init() { LCD_data = 0; //Clear data bus (PortB) LCD_data_dir = 0X0000; //Make PortB Output port PORTG = 0; //Clear PortG TRISG = 0X0000; //Made PortG output port (to use with rs,rw,en) Delay(1); LCD_data = 0x000C; //Display on, Cursor off LCD_rs = 0; //Zero= command mode LCD_en = 1; //Enable H->L Delay(1); LCD_en = 0;

L-1

Delay(1); LCD_data = 0x0038; //2nd line on ,5x7, 8-bit LCD_rs = 0; //Zero= command mode LCD_en = 1; //Enable H->L Delay(1); LCD_en = 0; Delay(1); LCD_data = 0x0001; //Clear LCD LCD_rs = 0; //Zero= command mode LCD_en = 1; //Enable H->L Delay(1); LCD_en = 0; Delay(1); LCD_data = 0x0080; //Entry mode, auto increment with no shift LCD_rs = 0; //Zero= command mode Delay(1); LCD_en = 1; //Enable H->L Delay(1); } /** * * There must be some delay for LCD to successfully process the command or data. * So this delay can be made either with a delay loop of specified time more than * that of LCD process time or we can read the busy flag, which is recommended. * The reason we want to use the busy flag, is the delay produced is almost exactly * amount of time the LCD needs to finish it's processing. * * @return Void */ void LCD_busy() { TRISB = 0x0080; //Make port D7 (B7 on processor) input LCD_en = 1; //Make port pin G8 high LCD_rs = 0; //Zero= command mode while(LCD_D7) //Read busy flag again and again till it goes low (0) { LCD_en = 0; //Enable H->L LCD_en = 1; } TRISB = 0x0000; //Make port D7 (B7 on processor) output } /** * This subroutine can be called when you want to send commands to the LCD. A * list of some useful commands are listed in the description of this file. * * @param command Command to send to LCD * @return Void */ void LCD_command(unsigned char command) { LCD_data = command; //Function set: 2 Line, 8-bit, 5x7 dots LCD_rs = 0; //Zero= command mode LCD_en = 1; //Enable H->L Delay(1); LCD_en = 0; Delay(1); }

L-2

/** * We can pass a character (char) to display as a parameter to function. * example function call: LCD_senddata('A'); * * @param data * @return Void */

void LCD_senddata(unsigned char data) { LCD_data = data; //Function set: 2 Line, 8-bit, 5x7 dots Delay(1); LCD_rs = 1; //One= Data Mode Delay(1); LCD_en = 1; //Enable H->L Delay(1); LCD_en = 0; Delay(1); } /** * We can pass the string directly to the function for printing to the LCD. * example function call: LCD_sendstring("LCD Is Alive!"); * * @param *stringToPrint * @return Void */ void LCD_sendstring(unsigned char *stringToPrint) { while(*stringToPrint) //till string ends LCD_senddata(*stringToPrint++); //send characters one by one } /** * Still working on this. * * Go to position (X,Y),and write a string beginning at that position. * X=0 X=20 * __________________________________________________ * Y=0 |1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20| * |1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20| * |1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20| * Y=3 |1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20| * **************************************************** * * example function call: LCD_sendstringXY(0,1,"<**************>"); * * @param X column of the LCD * @param Y row of the LCD void LCD_sendstringXY(unsigned int x, unsigned int y,unsigned char *stringtoprint) { } */ /** * LCD test function to build a Bell at location 2 */

L-3

void LCD_build() { LCD_command(0x0048); //Load the location where we want to store LCD_senddata(0x0004); //Load row 1 data LCD_senddata(0x000E); //Load row 2 data LCD_senddata(0x000E); //Load row 3 data LCD_senddata(0x000E); //Load row 4 data LCD_senddata(0x001F); //Load row 5 data LCD_senddata(0x0000); //Load row 6 data LCD_senddata(0x0004); //Load row 7 data LCD_senddata(0x0000); //Load row 8 data } /** * Still working on this. * * This subroutine displays the custom character at the location specified given * a pointer to the pattern data. * * * Usage: * pattern[8]={0x04,0x0E,0x0E,0x0E,0x1F,0x00,0x04,0x00}; * LCD_build(1,pattern); * * @param location: location where you want to store: 0,1,2,....7 * @param ptr: Pointer to pattern data * */ void LCD_build1(unsigned char location, unsigned char *ptr) { unsigned char i; if(location<8){ LCD_command(0x40+(location*8)); for(i=0;i<8;i++) LCD_senddata(ptr[ i ]); } #endif // __LCDv2_H

L-4

Program 2: /** * @mainpage LED Test Code * @author - Jason Terhune * * Documentation is formatted so that Doxygen will be able to produce a HTML * quick reference to documentation. Information about Doxygen can be found at * http://en.wikipedia.org/wiki/Doxygen * * This code cycles, scrolls through 8 LED's in a back and forth fashion, FOREVER. * void (main) calls the subroutine Rock1 inside an intentional infinite while loop. * The purpose of this code is to test the ability to configure a dsPIC6015 Port for * output. Also, I am trying to successfully flash the program to memory! */ #include<stdlib.h> #include<p30f6015.h> _FWDT(WDT_OFF); // Watchdog Timer Enabled/disabled by user software #define CrystalFreq 7378200 // Crystal Oscillation frequency #define Millisec CrystalFreq/7378 // 1 millisecond delay #define PINS 8 // Total number of E pins void Rock1(); // Function declaration /** * Subrotine will send a high signal to desired pin. * @param PinNumber * @return Void */ void EPinOn(int PinNumber) { switch(PinNumber) { case 0: PORTEbits.RE0 = 1; break; case 1: PORTEbits.RE1 = 1; break; case 2: PORTEbits.RE2 = 1; break; case 3: PORTEbits.RE3 = 1; break; case 4: PORTEbits.RE4 = 1; break; case 5: PORTEbits.RE5 = 1; break; case 6: PORTEbits.RE6 = 1; break; case 7: PORTEbits.RE7 = 1; break; default: break; } } /** * Subroutine will send a low signal to desired pin. * @param PinNumber * @return Void */ void EPinOff(int PinNumber) { switch(PinNumber) { case 0: PORTEbits.RE0 = 0; break; case 1: PORTEbits.RE1 = 0; break; case 2: PORTEbits.RE2 = 0; break; case 3: PORTEbits.RE3 = 0; break; case 4: PORTEbits.RE4 = 0; break; case 5: PORTEbits.RE5 = 0; break; case 6: PORTEbits.RE6 = 0; break; case 7: PORTEbits.RE7 = 0; break; default: break; } }

L-5

/** * Subroutine will create a delay in milliseconds. * @param numMilli - Number of milliseconds needed. * @return Void */ void Delay (int numMilli) { int z; while (numMilli--) { for(z=0 ; z < Millisec ; z++){} } } int main(void) { PORTE = 0; // Clear port E TRISE = 0x0000; // Set port E as output only while(1) { Rock1(125); } } /** * Subroutine will cycle blinking LEDs in a back and forth sequence. * @param delay - How long lights will stay on/off during blinking. * @return Void */ void Rock1(int delay) { int pin; for(pin = 0; pin < PINS; pin++) { EPinOn(pin); Delay(delay); EPinOff(pin); } for(pin = PINS; pin > 0; pin--) { EPinOn(pin); Delay(delay); EPinOff(pin); } }

L-6

Appendix M: Flow Charts

Software development

M-1

Description of flow chart:

ConfigPorts is a subroutine to set up

ports for either input or output.

ConfirmationBeep will send a short

audible beep to the user through the

alarm circuitry to ensure power is

achieved.

During the startup procedures the

user is notified via the LCD screen.

The nozzle assembly and pill tray are

rotated and placed in such a manner

the microprocessor has a frame of

reference for dispensing subroutines.

The initialization process will lead into

a user configuration.

Appendix N: Power Supply

Data sheet (paragraphed):

N-1

N-2

N-3

N-4

Schematic:

N-5

N-6

Appendix O: LM741 OpAmp

O-1

O-2

O-3

O-4

O-5

O-6

O-7

Appendix P: L293D Quadruple Half-H Drive

P-1

P-2

Appendix Q: UF4001 Diode

Q-1

Q-2

Q-3

Appendix R: LT1637 OpAmp

R-1

R-2

Appendix S: Battery PS-12120

S-1

S-2

Appendix T: All possible LCD content

.....Wait While.....

.PEZ Pill Dispenser.

.....Starts Up......

....................

No User Data Present Enter First Name _...................

Enter First Name _...................

Enter Last Name _................... Press # when finish

Enter User PIN _... Press # when finish

Are you ready to enter medication data? 1 = yes 2 = no

Enter medication name. _................... Press # when finish

Enter total pills adding to bin. _. Press # when finish

Doses of medication needed per day? _. Press # when finish

Enter amount of pills in dose x _. Press # when finish

Time alarm should sound for dose x? _. Press # when finish

Empty pills into bin x Press # when finish

Would you like to enter another med? 1 = yes 2 = no

Set date/time below 12.12.2010 12:00am Press # when finish

12.12.2010 12:00am PEZ Pill Dispenser Press # for Menu

12.12.2010 12:00am PEZ Pill Dispenser Enter PIN _ _ _ _

1 = Change User Data 2 = Change Med Data 3 = Set Date/Clock 4 = Back

1 = Change First 2 = Change Last 3 = Change PIN 4 = Back

Are you still there? 1 = yes 2 = no

1 = Add Med 2 = Remove Med 3 = Alter Med 4 = Back

Which Med? 1.aaa 4.ddd 7.More 2.bbb 5.eee 8.Back 3.ccc 6.fff

Which Med? 1.ggg 4.jjj 2.hhh 5.Back 3.iii

Alter? 1.Name 4.Back 2.Total 3.Dose

Enter new total _. Press # when finish

1.Delete dose 2.Add dose 3.Back

Which dose? 1.x:xx 4.x:xx 7.Back 2.x:xx 5.x:xx 3.x:xx 6.x:xx

A dose is ready. Enter PIN _ _ _ _

A dose is ready. Only three days left Enter PIN _ _ _ _

T-1

Appendix U: Speaker GC0251K-CUI

U-1

U-2

Appendix V: LM555 Timer

V-1

V-2

V-3

V-4

V-5

V-6

V-7