The new circuit works pretty well now, with both power and ground planes:

During the soldering of this PCB board, there are several points I would like to mention for future reference. This was the first time I ever designed a double sided PCB board with power and ground plane, there are some points I missed out:

1. It is difficult to solder upper layers pins that is for IC connectors.

2. The antenna of the bluetooth module is better to face outside to minimize interference

3. Some spacings of components to the PIC is too close

I test my circuit with the following program:

#include <16F77.h>

#fuses HS,NOWDT,NOPROTECT,NOBROWNOUT

#use delay(clock=20000000)

#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

long t1, t2;

//bluetooth parani

void promi_init()

{

// Promi Initializing Started

putc (0x41); // AT(cr) Check the presence of Promi

putc (0x54);

putc (0x0D);

delay_ms(500);

putc (0x41); // AT+BTMODE,3(cr) Set Operation Mode

putc (0x54); // For Mode 3, the device will connect automatically

putc (0x2B);

putc (0x42);

putc (0x54);

putc (0x4D);

putc (0x4F);

putc (0x44);

putc (0x45);

putc (0x2C);

putc (0x33);

putc (0x0D);

delay_ms(500);

}

void promi_scanmode()

{

putc (0x41); // AT+BTSCAN(cr) Inquiry scan & page scan alternately

putc (0x54); // This is to make the SD discoverable from other BT devices

putc (0x2B);

putc (0x42);

putc (0x54);

putc (0x53);

putc (0x43);

putc (0x41);

putc (0x4E);

putc (0x0D);

delay_ms(500);

}

float calTemp(long t1, long t2){

float temp;

temp = 235 - 400*(float)t1/((float)t2); //77.18 = 75 + 2.18

return temp;

}

void getCycle(){

float temp;

while(input(pin_D1));

while(!input(pin_D1));

set_timer1(0);

while(input(pin_D1));

t1 = get_timer1();

set_timer1(0);

while(!input(pin_D1));

t2 = get_timer1();

printf("t1 and t2 are %lu and %lu", t1, t2);

temp = calTemp(t1, t2);

if (temp < 32.0){

printf(" (1). temp < 32 and temp is %f\n\r", temp);

output_bit(pin_d3, 1);

}

else if(temp > 33.0){

printf(" (2). temp > 33 and temp is %f\n\r", temp);

output_bit(pin_d3, 0);

}

else {

printf(" (3). 32 < temp < 33, and temp is %f\n\r", temp);

}

}

void main()

{

set_tris_d(0x03); //input pins D0 and D1

set_tris_b(0x00); //output pins

output_d(0b00000000);

output_b(0b00000000);

delay_ms(2000);

promi_init();

promi_scanmode();

setup_timer_1(T1_INTERNAL | T1_DIV_BY_2);

while(true){

delay_ms(5000);

getCycle();

}

}

And the output of the program I got from the hyperterminal is like this:

t1 and t2 are 21735 and 42777 (1). temp < 32 and temp is 31.759933

t1 and t2 are 21732 and 42732 (1). temp < 32 and temp is 31.573989

t1 and t2 are 21732 and 42735 (1). temp < 32 and temp is 31.588271

t1 and t2 are 21732 and 42768 (1). temp < 32 and temp is 31.745223

t1 and t2 are 21735 and 42798 (1). temp < 32 and temp is 31.859664

t1 and t2 are 21735 and 42840 (3). 32 < temp < 33, and temp is 32.058822

t1 and t2 are 21735 and 42873 (3). 32 < temp < 33, and temp is 32.215026

t1 and t2 are 21738 and 42906 (3). 32 < temp < 33, and temp is 32.343032

t1 and t2 are 21738 and 42942 (3). 32 < temp < 33, and temp is 32.512923

t1 and t2 are 21741 and 42963 (3). 32 < temp < 33, and temp is 32.583968

t1 and t2 are 21741 and 42996 (3). 32 < temp < 33, and temp is 32.739318

t1 and t2 are 21741 and 43017 (3). 32 < temp < 33, and temp is 32.838058

t1 and t2 are 21744 and 43047 (3). 32 < temp < 33, and temp is 32.951080

t1 and t2 are 21741 and 43077 (2). temp > 33 and temp is 33.119643

t1 and t2 are 21744 and 43080 (2). temp > 33 and temp is 33.105849

t1 and t2 are 21741 and 43029 (3). 32 < temp < 33, and temp is 32.894439

t1 and t2 are 21741 and 42957 (3). 32 < temp < 33, and temp is 32.555694

t1 and t2 are 21735 and 42888 (3). 32 < temp < 33, and temp is 32.285949

t1 and t2 are 21735 and 42810 (1). temp < 32 and temp is 31.916610

t1 and t2 are 21735 and 42759 (1). temp < 32 and temp is 31.674377

t1 and t2 are 21732 and 42774 (1). temp < 32 and temp is 31.773742

t1 and t2 are 21732 and 42801 (1). temp < 32 and temp is 31.901946

t1 and t2 are 21735 and 42840 (3). 32 < temp < 33, and temp is 32.058822

t1 and t2 are 21738 and 42870 (3). 32 < temp < 33, and temp is 32.172851

t1 and t2 are 21738 and 42918 (3). 32 < temp < 33, and temp is 32.399688

t1 and t2 are 21738 and 42957 (3). 32 < temp < 33, and temp is 32.583633

t1 and t2 are 21741 and 42990 (3). 32 < temp < 33, and temp is 32.711089

t1 and t2 are 21744 and 43026 (3). 32 < temp < 33, and temp is 32.852462

t1 and t2 are 21741 and 43071 (2). temp > 33 and temp is 33.091521

t1 and t2 are 21741 and 43065 (2). temp > 33 and temp is 33.063384

t1 and t2 are 21744 and 43014 (3). 32 < temp < 33, and temp is 32.796066

t1 and t2 are 21741 and 42957 (3). 32 < temp < 33, and temp is 32.555694

t1 and t2 are 21738 and 42888 (3). 32 < temp < 33, and temp is 32.257980

As you can see circuit is working well, as the temperature is staying between the range of 32 to 33 degree.