Vous êtes sur la page 1sur 21

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011

CONTENT
S.NO. I II III IV V VI VII VIII IX Introduction Controlling software Programming Interfacing Software between c lang. & port Operating Circuit Used parts Steps for finding port address Result Reference NAME PAGE NO.

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 Introduction: Parallel port is a simple and inexpensive tool for building computer controlled devices and projects. The simplicity and ease of programming makes parallel port popular in electronics hobbyist world. The parallel port is often used in Computer controlled robots, Atmel/PIC programmers, home automation etc .In other parallel port is a type of interface found on computers (personal and otherwise) for connecting various peripherals. In computing, a parallel port is a parallel communication physical interface. It is also known as a printer port or Centronics port. PC parallel port can be very useful I/O channel for connecting our own circuits to PC. The PC's parallel port can be used to perform some very amusing hardware interfacing experiments. The port is very easy to use when we first understand two important points . 1. Before connecting hardware isolate our hardware and parallel port by isolator example optocoupler. 2. Install any software for input and output interfacing because the orating window is secured by industries we are not able to pass any value to hardware without installing this software so we are using port95exe . This software is use to connect the hardware and turbo c for working. The Parallel Port is the most commonly used port for interfacing homemade projects. This Port will allow the input of up to 9 bits or the output of 12 bits at any one given time, thus requiring minimal external circuitry to implement many simpler tasks. The port is composed of 4 control lines, 5 status lines and 8 data lines. It's found commonly on the back of your PC as a D-Type 25 Pin female connector. There may also be a D-Type 25 pin male connector. This will be a serial RS-232 port and thus, is a totally incompatible port.

Fig no.1 pin dia. Of parallel port

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 Parallel ports are personal computer interfaces that transfer data (generally) a byte at a time. This contrasts with serial ports, that transfer data one bit at a time.

Fig no. 2 Comparison between serial & parallel port

Fig no. 3 Block diagram of working

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 Controlling software:For controlling the equipment we are use software in this project we are disusing about c language. We are using function in c language for controlling.

Outportb (port add, value)


This function of c language it is use for control equipment and this function is present in dos.h header file. In this function we pass two parameters first is port address and second value. Value is the any integer value. Port address is finding we discos later.

Fig no.4 Flowchart of program

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 Programming :-

1. #include<stdio.h> 2. #include<conio.h> 3. #include<dos.h> 4. #include<graphics.h> 5. #include<stdlib.h> 6. void disp(); 7. void main() 8. { 9. int gd=DETECT,gm; 10. clrscr(); 11. outportb(0x378,0x00); 12. delay(50); 13. initgraph(&gd,&gm,"c:\\tc\\bgi"); 14. setcolor(8); 15. rectangle(30,40,600,450); 16. setcolor(10); 17. settextstyle(1,0,7); 18. outtextxy(150,50,"B. K. BIET"); 19. setcolor(5); 20. settextstyle(1,0,5); 21. outtextxy(40,150,"HOME APPLANSIS CONTROL"); 22. setcolor(1); 23. settextstyle(1,0,1); 24. outtextxy(40,300,"GUID NAME:-"); 25. outtextxy(40,350,"DINESH SONI"); 26. outtextxy(350,300,"SUBMIT BY:-"); 27. outtextxy(350,350,"1.LOKESH KUMAR PANWAR"); 28. outtextxy(350,400,"2.RAJESH MALI"); 29. delay(5000); 30. a: 31. clrscr();

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 32. cleardevice(); 33. int i=0; 34. setcolor(11); 35. settextstyle(1,0,1); 36. outtextxy(200,100,"ENTER PASWARD"); 37. printf("\n\n\n\n\n\n\n\n\t\t\t "); 38. scanf("%d",&i); 39. if(i==007) 40. { 41. disp(); 42. } 43. else 44. { 45. goto a; 46. } 47. } 48. void disp() 49. { 50. int l=0,k=0,j=0,h=0,g=0,f=0,d=0,s=0; 51. char u,t; 52. b: 53. clrscr(); 54. cleardevice(); 55. setcolor(6); 56. settextstyle(1,0,1); 57. outtextxy(200,100,"x.ON/OFF EQUPMENT"); 58. outtextxy(200,200,"y.HELP"); 59. outtextxy(200,300,"z.EXIT"); 60. t=getch(); 61. switch(t) 62. { 63. case 'x': 64. p:

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 65. int inp=0; 66. clrscr(); 67. cleardevice(); 68. inp=inportb(0x378); 69. setcolor(YELLOW); 70. if(1==l%2) 71. { 72. outtextxy(150,50,"ON"); 73. } 74. else 75. { 76. outtextxy(150,50,"OFF"); 77. } 78. if(1==k%2) 79. { 80. outtextxy(150,100,"ON"); 81. } 82. else 83. { 84. outtextxy(150,100,"OFF"); 85. } 86. if(1==j%2) 87. { 88. outtextxy(150,150,"ON"); 89. } 90. else 91. { 92. outtextxy(150,150,"OFF"); 93. } 94. if(1==h%2) 95. { 96. outtextxy(150,200,"ON"); 97. }

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 98. else 99. { 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. outtextxy(150,200,"OFF"); } if(1==g%2) { outtextxy(150,250,"ON"); } else { outtextxy(150,250,"OFF"); } if(1==f%2) { outtextxy(150,300,"ON"); } else { outtextxy(150,300,"OFF"); } if(1==d%2) { outtextxy(150,350,"ON"); } else { outtextxy(150,350,"OFF"); } if(1==s%2) { outtextxy(150,400,"ON"); } else

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. { outtextxy(150,400,"OFF"); } setcolor(9); outtextxy(50,450,"ENTER 'b' FOR BACK WINDOW"); outtextxy(50,50,"PRES q"); outtextxy(50,100,"PRES w"); outtextxy(50,150,"PRES e"); outtextxy(50,200,"PRES r"); outtextxy(50,250,"PRES t"); outtextxy(50,300,"PRES y"); outtextxy(50,350,"PRES u"); outtextxy(50,400,"PRES i"); u=getche(); switch(u) { case 'q': if(0==l%2) { int o1=0; o1=inp+1; outportb(0x378,o1); } else { int o1=0; o1=inp-1; outportb(0x378,o1); } l++; break; case 'w': if(0==k%2)

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. { int o1=0; o1=inp+2; outportb(0x378,o1); } else { int o1=0; o1=inp-2; outportb(0x378,o1); } k++; break; case 'e': if(0==j%2) { int o1=0; o1=inp+4; outportb(0x378,o1); } else { int o1=0; o1=inp-4; outportb(0x378,o1); } j++; break; case 'r': if(0==h%2) { int o1=0; o1=inp+8;

10

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. outportb(0x378,o1); } else { int o1=0; o1=inp-8; outportb(0x378,o1); } h++; break; case 't': if(0==g%2) { int o1=0; o1=inp+16; outportb(0x378,o1); } else { int o1=0; o1=inp-16; outportb(0x378,o1); } g++; break; case 'y': if(0==f%2) { int o1=0; o1=inp+32; outportb(0x378,o1); } else

11

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. { int o1=0; o1=inp-32; outportb(0x378,o1); } f++; break; case 'u': if(0==d%2) { int o1=0; o1=inp+64; outportb(0x378,o1); } else { int o1=0; o1=inp-64; outportb(0x378,o1); } d++; break; case 'i': if(0==s%2) { int o1=0; o1=inp+128; outportb(0x378,o1); } else { int o1=0; o1=inp-128;

12

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. outportb(0x378,o1); } s++; break; case 'b': goto b; break; } goto p; break; case 'y': m: cleardevice(); outtextxy(50,250,"ENTER 'b' FOR BACK WINDOW"); u=getche(); if(u=='b') { goto b; } else { goto m; } break; case 'z': cleardevice(); setcolor(1); settextstyle(7,0,5); outportb(0x378,0x00); outtextxy(200,200,"THANK YOU"); delay(1000); closegraph(); exit(0);

13

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 296. 297. 298. 299. 300. break; default: goto b; } }

Parallel port and c language interfacing software:According to this name we are think that it is use to interface. Today we are using so many operating systems in our computer like window 95, 98, 2000, Xp etc. they did not allow to read and write on parallel port. So we install driver for read and write on parallel port in this project we are using port95.exe. In other word we can say that it is a software which is use to interfacing the parallel port and c language. It is necessary to install in our pc for working on parallel port.

Fig no.5 Port 95 .exe window

14

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 Operating circuit:The idea of the interface shown above can be expanded to control some external electronics by simply adding a buffer circuit to the parallel port. For operatingany equipment we are using relay because operating equipment is work on high voltage it is necessary isolate to our circuit. By programming we produce signal at the parallel port this signal is not sufficient for relay operating. So for operating relay we are using relay drying circuit. Which drying circuit is operating by separate voltage source.

Operating circuit

Fig no. 6 Circuit diagram

15

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 Isolated relay driving circuit:If you want to have a very good protection and of the parallel port and more drive capacity you might consider optoisolation using the following type of circuit: The opto-isolator is there to protect the port. Note that there are no connections between the port's electrical contacts. The circuit is powered from external power supply which is not connected to PC if there is no need for that. This arrangement prevents any currents on the external circuits from damaging the parallel port. USED COMPONENT 1.NPN switching transistors 2N2222; 2N2222A FEATURES High current (max. 800 mA) Low voltage (max. 40 V). APPLICATIONS Linear amplification and switching. DESCRIPTION NPN switching transistor in a TO-18 metal package. PNP complement: 2N2907A.

16

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 2. OPTOCOUPLER [EL817 Series] Description The EL817 series contains a infrared emitting diode optically coupled to a phototransistor. It is packaged in a 4-pin DIP package and available in wide-lead spacing and SMD option. Features: Current transfer ratio (CTR:MIN.50% at IF =5mA ,VCE =5V) High isolation voltage between input and output (Viso=5000 V rms )

Fig no. 7 optocoupler IC EL817 Series Applications Computer terminals System appliances, measuring instruments Registers, copiers, automatic vending machines Cassette type recorder Electric home appliances, such as fan heaters, etc.

17

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 Signal transmission between circuits of different potentials and impedances

Fig no. 8 Internal diagram of optocoupler IC EL817 3. Parallel port:A parallel interface for connecting an external device such as a printer. Most personal computers have both a parallel port and at least one serial port. On PCs, the parallel port uses a 25-pin connector (type DB-25) and is used to connect printers, computers and other devices that need relatively high bandwidth. It is often called a Centronics interface after the company that designed the original standard for parallel communication between a computer and printer. (The modern parallel interface is based on a design by Epson.) A newer type of parallel port, which supports the same connectors as the Centronics interface, is the EPP (Enhanced Parallel Port) or ECP (Extended Capabilities Port). Both of these parallel ports support bi-directional communication and transfer rates ten times as fast as the Centronics port.

18

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 4. RESISTANCES SNO I II VALUE 470 ohm ,0.25 w 4.7 kilo ohm ,0.25 w QUANTITY 2 1

Finding port adders:STEP 1: Right click on my computer and go to properties.

STEP 2: And go to Hardware and click on Device manager

19

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011 STEP 3: After select ports (COM & LPT) and go to Printer ports

STEP4: Now click on Resources and given below window will appear and choose port address (like 0378)

20

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT 2011

Result:We have successfully implemented this software and hardware. It is working as per our requirement. This software had been made using C language programming. For making this software easy and interactive we have used graphics in C language. Hardware operate by 9 volt dc battery supply and for isolating purpose we have used optocoupler which isolate parallel port and external supply.

Reference: www.google.com  www.codeproject.com  www.hardwaresecrets.com  www.electrofriends.com  www.wikipedia.com  Parallel port complete: programming, interfacing & using the PC's by Jan Axelson  Programming the parallel port: interfacing the PC for data ... by Dhananjay V. Gadre

21

Vous aimerez peut-être aussi