Some Importantant links below
with reports.just view the link below. if u want any project report just
search any project on our search box
Arduino interesting projects:
Arduino 30 simple and good projects
Atmega projects lists
Android Electronics projects lists
Rf based Projects with report
engineering study notes
GSM GPS based projects with report
Bluetooth based projects with reports
9.3 CODE
#include <16F876A.h>
#include <string.h>
#include <math.h>
#include <lcd.c>
#include <stdlib.h>
#fuses HS,NOWDT,PROTECT,brownout,put
#use delay (clock=20000000)
#use RS - 232 (baud = 4800, xmit=PIN_A1,rcv=PIN_A0,stream=GPS)
int count = 0;
byte data[92];
char lat[12];
char lngtd[12];
char tdata[12];
char valid_data[] = { ",A," };
char invalid_data[] = { ",V," };
char gprmc[] = { "GPRMC" };
double f_lat;
double f_lng;
double f_lat_ref;
double f_lng_ref;
double result;
double get_gps_distance(double lat1,double lng1,double lat2,double lng2)
{
double dist;
dist = 1.2609 * (sqrt(((lat2-lat1)*(lat2-lat1)) + ((lng2-lng1)*(lng2-lng1))));
return(dist);
}
void get_GPS_data()
{
while(1)
{
fgets(data,GPS);
if(strstr(data,gprmc))
{
break;
}
}
}
void get_gps_field(byte buf[],int field)
{
int i = 0;
int j = 0;
int count = 0;
while(buf[i])
{
if(buf[i] == ',')
count++;
if(count == field) //1
break;
i++;
}
i++;
while(buf[i] != ',')
{
tdata[j] = buf[i];
i++;
j++;
}
tdata[j] = 0;
}
void main()
{
unsigned long radius = 30;
int system_on = 0;
lcd_init();
lcd_putc('\f'); //Clear LCD
lcd_gotoxy(1,1); // row-1, column-1
printf(lcd_putc,"Virtual Fencing");
lcd_gotoxy(1,2);
printf(lcd_putc," S Y S T E M");
//Microcontroller Health Check Start
output_high(PIN_C0);
output_high(PIN_C2);
output_high(PIN_C3);
delay_ms(500);
output_low(PIN_C0);
output_low(PIN_C2);
output_low(PIN_C3);
delay_ms(500);
output_high(PIN_C0);
output_high(PIN_C2);
output_high(PIN_C3);
delay_ms(500);
output_low(PIN_C0);
output_low(PIN_C2);
output_low(PIN_C3);
//Microcontroller Health Check END
while(1)
{
get_GPS_data();
if(strstr(data,valid_data)) //Check for valid data. If the gps data contains ",A," then it's a valid data
{
output_low(PIN_C3); //RED LED OFF
output_high(PIN_C2); //Green LED ON indicating valid data
delay_ms(500);
}
if(strstr(data,invalid_data)) //If the gps data contains ",V," then its invalid data
{
output_high(PIN_C3); //RED LED On indicating invalid data
output_low(PIN_C2); //Green LED OFF
delay_ms(500);
continue;
}
get_gps_field(data,3); //get lat
strcpy(lat,tdata);
get_gps_field(data,5); //get lngtd
strcpy(lngtd,tdata);
f_lat = atof(lat); //convert to float
f_lng = atof(lngtd);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(LCD_PUTC,"lat=%5.6f",f_lat);
lcd_gotoxy(1,2);
printf(LCD_PUTC,"lng=%5.6f",f_lng);
delay_ms(1000);
if(!input(PIN_C4)) //Select the radius on pressing pubsh button
{
radius = radius + 10;
lcd_putc('\f');
lcd_gotoxy(1,2);
printf(LCD_PUTC,"Radius = %Lu ",radius);
delay_ms(1000);
}
if(!input(PIN_C5)) //Select the center point (push button)
{
f_lat_ref = f_lat;
f_lng_ref = f_lng;
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(LCD_PUTC," V-FENCING MODE");
system_on = 1; //set the flag
delay_ms(1000);
}
if(system_on)
{
result = get_gps_distance(f_lat_ref,f_lng_ref,f_lat,f_lng);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(LCD_PUTC,"Distance: %.0f mtrs",result);
lcd_gotoxy(1,2);
printf(LCD_PUTC,"Radius = %Lu",radius);
delay_ms(2000);
if(result > radius)
{
output_high(PIN_C0); //LED Indicator ON
output_high(PIN_C7); // Shock Generator ON
delay_ms(50);
output_low(PIN_C7); //Shock Generator OFF
output_high(PIN_B0); //Buzzer ON
}
else
{
output_low(PIN_C0); //Indicator OFF
output_low(PIN_C7); //Shock Generator OFF
output_low(PIN_B0); //Buzzer OFF
}
}
}
}
Some Importantant links below with reports.just view the link below. if u want any project report just search any project on our search box
Arduino interesting projects:
Arduino 30 simple and good projects
Atmega projects lists
Android Electronics projects lists
Rf based Projects with report
engineering study notes
GSM GPS based projects with report
Bluetooth based projects with reports
Arduino interesting projects:
Arduino 30 simple and good projects
Atmega projects lists
Android Electronics projects lists
Rf based Projects with report
engineering study notes
GSM GPS based projects with report
Bluetooth based projects with reports
9.3 CODE
#include <16F876A.h>
#include <string.h>
#include <math.h>
#include <lcd.c>
#include <stdlib.h>
#fuses HS,NOWDT,PROTECT,brownout,put
#use delay (clock=20000000)
#use RS - 232 (baud = 4800, xmit=PIN_A1,rcv=PIN_A0,stream=GPS)
int count = 0;
byte data[92];
char lat[12];
char lngtd[12];
char tdata[12];
char valid_data[] = { ",A," };
char invalid_data[] = { ",V," };
char gprmc[] = { "GPRMC" };
double f_lat;
double f_lng;
double f_lat_ref;
double f_lng_ref;
double result;
double get_gps_distance(double lat1,double lng1,double lat2,double lng2)
{
double dist;
dist = 1.2609 * (sqrt(((lat2-lat1)*(lat2-lat1)) + ((lng2-lng1)*(lng2-lng1))));
return(dist);
}
void get_GPS_data()
{
while(1)
{
fgets(data,GPS);
if(strstr(data,gprmc))
{
break;
}
}
}
void get_gps_field(byte buf[],int field)
{
int i = 0;
int j = 0;
int count = 0;
while(buf[i])
{
if(buf[i] == ',')
count++;
if(count == field) //1
break;
i++;
}
i++;
while(buf[i] != ',')
{
tdata[j] = buf[i];
i++;
j++;
}
tdata[j] = 0;
}
void main()
{
unsigned long radius = 30;
int system_on = 0;
lcd_init();
lcd_putc('\f'); //Clear LCD
lcd_gotoxy(1,1); // row-1, column-1
printf(lcd_putc,"Virtual Fencing");
lcd_gotoxy(1,2);
printf(lcd_putc," S Y S T E M");
//Microcontroller Health Check Start
output_high(PIN_C0);
output_high(PIN_C2);
output_high(PIN_C3);
delay_ms(500);
output_low(PIN_C0);
output_low(PIN_C2);
output_low(PIN_C3);
delay_ms(500);
output_high(PIN_C0);
output_high(PIN_C2);
output_high(PIN_C3);
delay_ms(500);
output_low(PIN_C0);
output_low(PIN_C2);
output_low(PIN_C3);
//Microcontroller Health Check END
while(1)
{
get_GPS_data();
if(strstr(data,valid_data)) //Check for valid data. If the gps data contains ",A," then it's a valid data
{
output_low(PIN_C3); //RED LED OFF
output_high(PIN_C2); //Green LED ON indicating valid data
delay_ms(500);
}
if(strstr(data,invalid_data)) //If the gps data contains ",V," then its invalid data
{
output_high(PIN_C3); //RED LED On indicating invalid data
output_low(PIN_C2); //Green LED OFF
delay_ms(500);
continue;
}
get_gps_field(data,3); //get lat
strcpy(lat,tdata);
get_gps_field(data,5); //get lngtd
strcpy(lngtd,tdata);
f_lat = atof(lat); //convert to float
f_lng = atof(lngtd);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(LCD_PUTC,"lat=%5.6f",f_lat);
lcd_gotoxy(1,2);
printf(LCD_PUTC,"lng=%5.6f",f_lng);
delay_ms(1000);
if(!input(PIN_C4)) //Select the radius on pressing pubsh button
{
radius = radius + 10;
lcd_putc('\f');
lcd_gotoxy(1,2);
printf(LCD_PUTC,"Radius = %Lu ",radius);
delay_ms(1000);
}
if(!input(PIN_C5)) //Select the center point (push button)
{
f_lat_ref = f_lat;
f_lng_ref = f_lng;
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(LCD_PUTC," V-FENCING MODE");
system_on = 1; //set the flag
delay_ms(1000);
}
if(system_on)
{
result = get_gps_distance(f_lat_ref,f_lng_ref,f_lat,f_lng);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(LCD_PUTC,"Distance: %.0f mtrs",result);
lcd_gotoxy(1,2);
printf(LCD_PUTC,"Radius = %Lu",radius);
delay_ms(2000);
if(result > radius)
{
output_high(PIN_C0); //LED Indicator ON
output_high(PIN_C7); // Shock Generator ON
delay_ms(50);
output_low(PIN_C7); //Shock Generator OFF
output_high(PIN_B0); //Buzzer ON
}
else
{
output_low(PIN_C0); //Indicator OFF
output_low(PIN_C7); //Shock Generator OFF
output_low(PIN_B0); //Buzzer OFF
}
}
}
}
Some Importantant links below with reports.just view the link below. if u want any project report just search any project on our search box
Arduino interesting projects:
Arduino 30 simple and good projects
Atmega projects lists
Android Electronics projects lists
Rf based Projects with report
engineering study notes
GSM GPS based projects with report
Bluetooth based projects with reports
No comments:
Post a Comment
its cool