Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
PERTANDINGAN MySkills
2013 (ELECTRONICS)
14 JAM
PERINGKAT AKHIR
Project Description:
The incubator regulates temperature and humidity based on three (3) preset modes detailed in Table 1. The system monitors present temperature and humidity via the SHT 25 (I2C based Humidity and Temperature Sensor). Based on the selectable preset Mode, the incubator regulates system temperature and humidity. The block diagram of the incubator is shown in Fig. 1. Temperature is regulated by regularly switching ON and OFF the heater (bulb) which driven by the system through solid state relay (SSR). While humidity is controlled by switching ON or OFF the EXHAUST fan or MIX fan. The purposes of the EXHAUST and MIX fan to decrease and increase the system humidity respectively. On top of it, Start/Stop and MODE buttons were provided to start or stop the system and for incremental selecting of MODE. Each pressing of MODE button changes the MODE by a step of one (1). In the case of the present MODE is at a maximum (2) level, another pressing of MODE button resulting in the MODE resetting to 0. The complete schematic diagram is provided in Fig. 2.
LCD1
LM016L +5v Vo VEE
PICKIT3
J1
66226-006 PWM0 1 2
+12v
J4
RV1
VSS VDD VEE 10K RS RW E D0 D1 D2 D3 D4 D5 D6 D7
Output For AC 240V bulb 200w control via Solid State Relay
J2 D2
1N4001 1 2
R5
1 2 3 4 5 6 33R
SIL-156-02
U5:A
4066 MCLR +5V PGD PGC Pin15 (lcd) PWM1 +5v Vo C IO 12 1 X Y 2
Q3 R8
120R IRF540N
1 2 3
4 5 6 IO2 IO 1 IO 0
VEE
IO 4 IO 5 IO 6 IO 7
7 8 9 10 11 12 13 14
R9
10k
R7
10k +5v Vo +5v Vo
13
+5v Vo
+12v
R6
1k
J3 Q1
BC547
R3
10k
R4
10k +5v Vo IO 10 IO 11 +5v Vo
D3
1N4001
1 2
U5:B
4066 11 X C Y 10
SIL-100-02
Q2 R10
120R IRF540N
R12
10k
R13
10k
+5v Vo
100n
100n
SCL SDA
1 2 3 4
OSC1
OSC2
U1
2 3 4 5 6 7 14 13 33 34 35 36 37 38 39 40 RA0/AN0 RC0/T1OSO/T1CKI RA1/AN1 RC1/T1OSI/CCP2/UOE RA2/AN2/VREF-/CVREF RC2/CCP1/P1A RA3/AN3/VREF+ RC4/D-/VM RA4/T0CKI/C1OUT/RCV RC5/D+/VP RA5/AN4/SS/LVDIN/C2OUT RC6/TX/CK RA6/OSC2/CLKO RC7/RX/DT/SDO OSC1/CLKI RB0/AN12/INT0/FLT0/SDI/SDA RB1/AN10/INT1/SCK/SCL RB2/AN8/INT2/VMO RB3/AN9/CCP2/VPO RB4/AN11/KBI0/CSSPP RB5/KBI1/PGM RB6/KBI2/PGC RB7/KBI3/PGD RD0/SPP0 RD1/SPP1 RD2/SPP2 RD3/SPP3 RD4/SPP4 RD5/SPP5/P1B RD6/SPP6/P1C RD7/SPP7/P1D RE0/AN5/CK1SPP RE1/AN6/CK2SPP RE2/AN7/OESPP RE3/MCLR/VPP 15 16 17 23 24 25 26 19 20 21 22 27 28 29 30 8 9 10 1 T1CKI PWM1 PWM0 +12v TX/RC6 RX/RC7 SDO IO0 IO1 IO2 IO3 IO4 IO5 IO6 IO7 IO16 IO17 IO18 MCLR 1N4001
+12v
D1
1
12VDC 2A Adaptor
0v
C6
25v/22uF
C7
25V/22uF
C8
25V/22uF
+5v
+5v
MCLR
U2
+5V
12
C12
MODE
C13
START/STOP
J5
R11
10k
X1 C3 C2
27p 100n
R2
680
IO10 IO11 IO12 IO13 IO14 IO15 PGM PGC PGD VUSB
+12v
U3
7805 1 VI GND VO 3
16MHz +5v Vo
C4
100n
R1
10k
C1
27p
C5
220n MCLR
18
VUSB PIC18F4550
C10
25v/22uF
C11
25V/22uF
Task 1 Design a single-sided Printed Circuit Board (PCB) based on the GIVEN schematic diagram in Fig 2. Task 2 Assemble components on the designed PCB. Task 3 Build and fix the prototype with all the accessories Task 4 Write an embedded C code as follows. Use the provided drivers. 4.1. Upon Power Up / Reset; heater, EXHAUST and MIX fan should be OFF. The preset power (P) and Mode (M) should be OFF and 0 respectively. These are displayed on the LCD following the format shown below.
Note: XX is the preset temperature YY is the preset humidity 4.2. Upon pressing of the Start/Stop Button (PB1) for the first time; P must indicates ON. System regulates heat and humidity based on in the preset Mode in task 4.1. The display must be update as shown below.
Note: XX is the preset temperature YY is the preset humidity 4.3. Continuously pressing the Start/Stop Button (PB1), P toggling. System turns ON if previous P is OFF or vice versa. Each changing in P should be accompanied by changing of the string ON to OFF or vice versa.
4.4.
If the MODE button (PB2) is pressed, M advances by one (1). It rolls off to 0 when it reaches 3. The display must be updated for each changing in M.
Task 5
Score
Parts List (Table 2) Item 1 Parts name and value RESISTORS CORBON TYPE 1/4W 5%
Qty
Reference number
33R 120R 680R 1K 10K Trim Pot Preset PCB Type 10K
1 2 1 1 8 1
CAPACITORS
6 4 1 2
SEMICONDUCTOR COMPONENTS PIC 18F4550 c/w socket Voltage Regulator 7805 c/w Heatsink IC 4066 Transistor BC547 MOSFET IRF540N C/W Heatsink Diod IN4001 1 2 1 1 2 3 1
OTHERS Copper board 25cm x 11cm LPKF single sided PCB FR4 229x305x1.5mm with reference hole fiber glass type LCD LM016L Crystal 16Mhz 6 pin PCB Header 45 degree bend Random turn ON Solid State Relay CSW2410FPGSH-10 12V DC Auxiliary Fan Saiz 80mm X 80mm X 25mm Normaly Open PCB Miniture Push Button Switch 16 Pin Female Header 16 Pin Male Header 6
1 1 1 1 2 3 1 1
AC Bulb C/W Screw type Lamp Holder - 240VAC 200Watt Connector - Header 2 PIN Connector - Header 5 PIN Ribbon cable - 16 way 10 meter Aqua Star Aquarium Tank completed with top cover material is Acrylic ,Saiz 30 x 18 x 25.5cm DC Adapter C/W female conector 12VDC 2A SHT25 HUMIDITY & TEMPERATURE SENSOR - I2C
1 3 1 1 1 1 1
The competitor needs to prepare the following equipments, machinery, installations and materials. Item
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Qty
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Material
Soldering Iron and equipment Soldering Iron Stand Solder wick or Solder Remover Brush Pincer Nipper Wire Stripper Scissors Tweezers IC pick PCB stand Parts box Precise screwdriver Screw driver Screw driver Spanner Safety Glasses
Description
Notes
// Digital I/O // off comparator pg 234 // Must be called prior to usage of LCD
unsigned char check_busy(void){ LCD_RS = 0; LCD_RW = 1; LCD_DATA_TRIS |= 0x0f0; DelayFor18TCY(); LCD_E = 1; DelayFor18TCY(); if (LCD_DATA&0x80){ LCD_E = DelayFor18TCY(); LCD_E = DelayFor18TCY(); LCD_E = DelayFor18TCY(); return 1; } else{ LCD_E = DelayFor18TCY(); LCD_E = DelayFor18TCY(); LCD_E = DelayFor18TCY(); return 0; } } void send_control(char CMD){ while(check_busy()); LCD_DATA_TRIS &= 0x0f; LCD_DATA &= 0x0f; LCD_DATA |= (CMD&0xf0); LCD_RS = 0; LCD_RW = 0; DelayFor18TCY(); LCD_E = 1; DelayFor18TCY(); LCD_E = 0; DelayFor18TCY(); LCD_DATA &= 0x0f; LCD_DATA |= ((CMD<<4) & 0xf0); DelayFor18TCY(); LCD_E = 1; DelayFor18TCY(); LCD_E = 0; DelayFor18TCY(); } 0; 1; 0;
// Logic 0 // Logic 1 // Set data line as input // pull high clock // if b7 high // pull down clock // complete for another nibble // pull high clock // pull down clock
0; 1; 0;
// if b7 low // pull down clock // complete for another nibble // pull high clock // pull down clock
// Set data line as output // clear previous higher nibble on data line // put higher nibble // Logic 0 // Logic 0 // pull high clock // pull down clock // clear previous higher nibble on data line // put lower nibble // pull high clock // pull down clock
//continue
// Set data line as output // clear previous higher nibble on data line // put higher nibble // Logic 0 // Logic 0 // pull high clock // pull down clock
void send_data(char x){ while(check_busy()); LCD_DATA_TRIS &= 0x0f; // Set data line as output LCD_DATA &= 0x0f; // clear previous higher nibble on data line LCD_DATA |= x & 0xf0; // put higher nibble LCD_RS = 1; LCD_RW = 0; DelayFor18TCY(); LCD_E = 1; DelayFor18TCY(); LCD_E = 0; DelayFor18TCY(); LCD_DATA &= 0x0f; LCD_DATA |= ((x<<4) & 0xf0); DelayFor18TCY(); LCD_E = 1; DelayFor18TCY(); LCD_E = 0; DelayFor18TCY(); } char read_data(void){ char x; while(check_busy()); LCD_DATA_TRIS |= 0xf0; LCD_RS = 1; LCD_RW = 1; DelayFor18TCY(); LCD_E = 1; DelayFor18TCY(); x = LCD_DATA&0xf0; LCD_E = 0; DelayFor18TCY(); LCD_E = 1; DelayFor18TCY(); x |= (LCD_DATA>>4) &0x0f; LCD_E = 0; return x; } // Logic 1 // Logic 0 // pull high clock // pull down clock // clear previous higher nibble on data line // put lower nibble // pull high clock // pull down clock
//Continue
10
void putr_lcd(const rom char *pointer){ while(*pointer){ // WHILE NOT NULL CHARACTER send_data(*pointer); pointer++; } } void Initialize_LCD(void){ LCD_DATA_TRIS = 0b00000000; LCD_E = 0; LCD_RS = 0; LCD_RW = 0; Delay1KTCYx(250); Four_bit_only(0b00100000); send_control(0b00101000); send_control(0b00001110 ); send_control(0b00000110); }
// Set all // // // // // // // //
lines as output Logic 0 Logic 0 Logic 0 15ms (1)1st Function Set (2)2nd Function Set (3)Display & cursor (4)Entry mode - inc
- 4-bit (entry 1 T12) - 4-bit, 2 lines, 5X7 (entry 6 T6) on/off (entry 4 T6) addr, no shift (entry 3 T6)
//continue
11
12
0b11100011 0b11100101
CHK_SUM = ReadI2C(); // get the Checksum IdleI2C(); NotAckI2C(); // Send back Acknowledge IdleI2C(); StopI2C(); // stop all I2C communications return (TempHI<<8)+ TempLO } //continue
13
//continuation
unsigned int read_humidity(void){ char HumHI,HumLO,CHK_SUM; StartI2C(); IdleI2C(); WriteI2C(add2write); IdleI2C(); WriteI2C(Trig_H_HM); IdleI2C(); WriteI2C(add2read); IdleI2C(); HumHI = ReadI2C(); IdleI2C(); AckI2C(); IdleI2C(); HumLO = ReadI2C(); IdleI2C(); AckI2C(); IdleI2C(); //
// begin I2C communication // wait till bus idle // wait till bus idle // trigger Humidity // wait till bus idle // // wait till bus idle // get the MSB // Send back Acknowledge // get the LSB // Send back Acknowledge
CHK_SUM = ReadI2C(); // get the Checksum IdleI2C(); NotAckI2C(); // Send back Acknowledge IdleI2C(); StopI2C(); // stop all I2C communications return (HumHI<<8)+ HumLO } /* ---------------------End of File --------------------------*/
14