Wednesday, May 19, 2010

Intensive Care Unit - informer System

ICU informer System


It’s a common scenario that the relatives of the patients in the ICU unit were very eager to get the updated results of the patient’s condition. But it’s not possible to enter in to this unit and ask about the condition. In this situation the ICU informer system works. This device has three sections,



1) The device called remote unit which will be placed outside the ICU
This unit contains a transceiver, a microcontroller unit, a 4 line LCD display (20 *4) and a keypad
2) The device which is present at the doctor’s side,
This unit has a transceiver, a TTL to RS232 convertor and a computer.
3) A management software present at the doctors computer.
This software is used to send the messages and also to display the received messages. Here I have given only simple software for interfacing purpose. The users can make the software according to their need.


Working
The nurses can enter the basic readings of patients such as patient ID, body temperature, blood pressure and heart rate. By pressing the SEND button these data’s will be transmitted. So the details of the new patient will be available in the doctor’s computer. This patient may be in the casualty unit. So the doctor can reply back the proper action to be taken. Note in picture a 2 line LCD is shown. Connect a 20*4 lcd display for its proper working. The baud rate is 2400bps for both directions.
The remote unit sends the data in the following format
Cpid*temp*bp*hertrate#
i.e. first it send the character ‘C’ followed by Patients ID, temperature and soon and ended by # symbol
Another thing is the software in the doctor’s side can frequently send the current status of the patients to this remote unit. The display will then displays the PID and on the next three lines the message.
The computer sends the data in the following format
RPIDno*message#
The size of PID is fixed and it is a 4 digit number.




Circuit Diagrams





The software at computer side




DOWNLOAD the project




Program
// hospital management system
// vipin.p.nair
// College of engneering kallooppara
// 19/2/10
// www.vipinprojects.blogspot.com


unsigned short i, mydata;
char msg[75];
char smsg[20];
char keyboardread()
{
if(!PORTD.F0) return '1';
if(!PORTD.F1) return '2';
if(!PORTD.F2) return '3';
if(!PORTD.F3) return '4';
if(!PORTD.F4) return '5';
if(!PORTD.F5) return '6';
if(!PORTD.F6) return '7';
if(!PORTD.F7) return '8';
if(!PORTC.F0) return '9';
if(!PORTC.F1) return '0';
if(!PORTC.F2) return '.'; // '.'
if(!PORTC.F3) return 11; // CLEAR
if(!PORTC.F4) return 12; // enter
return 13;
}

void displaymsg()
{
int i,j,flag = 1;
Lcd_Cmd(Lcd_CLEAR);
Lcd_Out(1,1,"PID:");
for (i=0; msg[i]!='*';i++)
{
Lcd_Chr(1, 5+i, msg[i]);
}
i++;
for(j=0; j<20 ;j++,i++)
{
if(msg[i] == '#')
{flag = 0;
break;}
Lcd_Chr(2, 1+j, msg[i]);
}
if(flag)
{
for(j=0; j<20 ;j++,i++)
{
if(msg[i] == '#')
{flag = 0;
break;}
Lcd_Chr(3, 1+j, msg[i]);
}
}
if(flag)
{
for(j=0; j<20 ;j++,i++)
{
if(msg[i] == '#')
{flag = 0;
break;}
Lcd_Chr(4,1+j,msg[i]);
}
}
}
void readdata()
{
char key;
Lcd_Cmd(Lcd_CLEAR);
Lcd_Out(1,1,"PID:");
smsg[0] = 'C';
Delay_ms(500);
while((key = keyboardread())== 13);
Lcd_Chr(1,5,key); Delay_ms(500);
smsg[1] = key;
while((key = keyboardread())== 13);
Lcd_Chr(1,6,key); Delay_ms(500);
smsg[2] = key;
while((key = keyboardread())== 13);
Lcd_Chr(1,7,key); Delay_ms(500);
smsg[3] = key;
while((key = keyboardread())== 13);
Lcd_Chr(1,8,key);
smsg[4] = key;
smsg[5] = '*';
Lcd_Out(2,1,"Temp:"); Delay_ms(500);
while((key = keyboardread())== 13);
Lcd_Chr(2,6,key); Delay_ms(500);
smsg[6] = key;
while((key = keyboardread())== 13);
Lcd_Chr(2,7,key); Delay_ms(500);
smsg[7] = key;
while((key = keyboardread())== 13);
Lcd_Chr(2,8,key); Delay_ms(500);
smsg[8] = key;
smsg[9] = '*';
Lcd_Out(3,1,"BP:"); Delay_ms(500);
while((key = keyboardread())== 13);
Lcd_Chr(3,4,key); Delay_ms(500);
smsg[10] = key;
while((key = keyboardread())== 13);
Lcd_Chr(3,5,key); Delay_ms(500);
smsg[11] = key;
while((key = keyboardread())== 13);
Lcd_Chr(3,6,key);
smsg[12] = key;
smsg[13] = '*';
Lcd_Out(4,1,"Heart Rate:"); Delay_ms(500);
while((key = keyboardread())== 13);
Lcd_Chr(4,12,key); Delay_ms(500);
smsg[14] = key;
while((key = keyboardread())== 13);
Lcd_Chr(4,13,key); Delay_ms(500);
smsg[15] = key;
while((key = keyboardread())== 13);
Lcd_Chr(4,14,key); Delay_ms(500);
smsg[16] = key;
smsg[17] = '#';
smsg[18] = 0;
while(keyboardread() != 12);
Lcd_Cmd(Lcd_CLEAR);
Lcd_Out(1,3,"Sending...");

for(i=0;i<19;i++)
{
Usart_Write(smsg[i]);
Delay_ms(100);
}
Lcd_Cmd(Lcd_CLEAR);
Lcd_Out(1,3,"Send.");
}
void main() {
char key;
char *temp;
PORTA = 0x00;
PORTB = 0x00;
PORTC = 0xFF;
PORTD = 0xFF;
TRISA = 0;
TRISB = 0;
TRISC = 0x1F;
TRISD = 0xFF;
Lcd_Init(&PORTB); // Initialize LCD connected to PORTB
Lcd_Cmd(Lcd_CLEAR); // Clear display
Lcd_Cmd(Lcd_CURSOR_OFF);
Lcd_Out(2,7,"Welcome");
Delay_ms(1000);
// Initialize USART module (8 bit, 2400 baud rate, no parity bit..)
Usart_Init(2400);
while(1)
{
if (!Usart_Data_Ready())
if(keyboardread() == 11)
{readdata();
continue;}
mydata = Usart_Read();
if (mydata == 'R')
{ i=0;
do
{
while(!Usart_Data_Ready());
msg[i] = Usart_Read();
Usart_Write(msg[i]);
i++;
}
while((msg[i-1]!= '#') && (i <75));
displaymsg();
}
else
continue;
}
}

_____________________________________________________