Serial PIC Programmer

The PIC programmer may cost you a few hundreds of rupees (India) in the market. However, you can always try to make one for yourself. You can develop this simple yet powerful programmer at home. Follow the simple steps described here to develop a circuit board. The basic requirements and necessary circuits diagrams and circuit tracks are given below.

Basic Requirements:
  • A copper clad of dimension - 30x30 cm
  • 30 gram ferrous chloride - highly exothermic and hazardous chemical.
  • The circuit track - click here to download the track for a PIC Programmer.
  • A shiny/glossy paper sheet.
  • An inkjet printer.

The track for PIC Programmer.




Click here to download the circuit and component diagram:




***

RFID, GSM and GPS Based Vehicle Security System


            This project was done during my post graduation diploma course. I was given a task to develop and complete a security device for a car. I developed a model using a GSM, GPS and RFID security system.


The project describes how to implement a car security system using a Global System for Mobile Communication, Global Positioning System and Radio Frequency Identification modules. Basically the procedure is to access the car using a key as usual. However, in case of any theft issue, the owner can send a message from his pre registered phone number to the GSM module fitted in the car and he will receive the current location of the device (car). Another message can stop the car engine and the device demands RFID verification. The car cannot be started until the RFID card is verified successfully.



      Basic modules in the project are: 
  • RFID detector and two cards.
  • GPS module
  • GSM module
  • Coordinating Unit
  • A PIC Micro controller – PIC16F876A.



A walk through the details :


Now, I will take you through a deeper explanation of the project, features, its advantages and disadvantages. As I mentioned earlier, the device can take control over the engine functions and stop the engine from working. Under normal condition, the car engine functions as normal as any other engine. Whereas when the device receives a message from a pre-stored GSM number, it acts as a master and takes control over the functioning of the engine. The owner can send a message: location, the GSM modules installed in the car verifies the message and the phone number and replies with the latest data received from GPS to the owner. If the data in message is – stop, the device starts monitoring the car engine. The device requests RFID verification when the car engine is tried to start the next time. The car does not start until it clears the RFID verification.



Module wise description:

Global Positioning System – the GPS device that I used is a standalone device that has four pins. The pins are +5V, Din, Dout and GND. The GPS device provides lots of information. One needs to separate the desired or required information. Here is a sample of the GPS message from the device that I used:


$PMTK010,001*2E

$GPGGA,235946.055,8960.0000,N,00654.0000,E,0,0,,137.0,M,13.0,M,,*4C

$GPGSA,A,1,,,,,,,,,,,,,,,*1E

$GPRMC,235946.055,V,8960.0000,N, 16650.0000,E,0.00,0.00,050180,,,N*72

$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32

$GPGGA,235947.054,8960.0000,N, 16650.0000,E,0,0,,137.0,M,13.0,M,,*4C

$GPGSA,A,1,,,,,,,,,,,,,,,*1E

$GPRMC,235947.054,V,8960.0000,N, 16650.0000,E,0.00,0.00,050180,,,N*72



And it goes on. So, in order to find the location as per my requirement in this project, all I need is the data in the row that reads: $GPRMC

So using a simple do-while loop and if-else ladder I can pull out the required data.

------------------------

I have generated a HEADER FILE (GPS.h file) that you may use in your program.
-----------------------



Now you can store the received data to a character array. This array can be later transmitted through the GSM module to a desired number.

To check the functioning of GPS module, you can connect your device to the PIC micro controller and transmit the data through the serial port to the computer. You will have to use the RS232 conversion by using a MAX232 chip (from MAXIM) and a DB9 port to transmit the data to computer.

I used a baud rate of 9600. You can see the transmitted data on the computer screen in a Hyper Terminal.







Global System for Mobile Communication – The module that I used had two features. It supports both GSM and GPRS. In order to connect the GSM module to a computer you will have to make use of the serial port. This one does not require a RS232 conversion while directly connecting to the computer. However, while you connect the GSM to a PIC micro controller, you will require a RS232 conversion.



To transmit and receive GSM data, use the standard AT commands.

------------------------

I have generated a HEADER FILE (GSM.h file) that you may use in your program.

-----------------------

The received data through the GSM can be stored in a location if necessary. Read the message in the GSM and using a switch control, activate the RFID task of the GPS task.

If the message content is location, reply to the number with current GPS data and if the message content is stop, activate the RFID verification. This action will monitor the functioning of the car engine. The next time when the car engine is started, the device will demand RFID verification.


As I mentioned before, the car engine cannot be started unless the RFID is verified successfully.





Radio Frequency Identification module – The RFID module that I used has a DB9 port. You can connect this device to your computer directly through a serial port and can read the RFID card number that you are using, in the Hyper Terminal. 




The RFID card reader needs to be connected to the PIC micro controller through a MAX232 chip (RS232 conversion is required). The card number is pre-stored in a character array and is compared during RFID verification process.

------------------------

I have generated a HEADER FILE (RFID.h file) that you may use in your program.

-----------------------



 A special circuit - The PIC micro controller PIC 16 F 876 A that I used had a software UART (Port C) in terminal as well as a hardware UART terminal. I preferred to use hard ware UART transmission.




However, for the project I required three UARTs one each for GSM, RFID and one to the computer for checking purpose (This part can be used to connect to a display unit to display the data on a LCD screen in the device). The GPS module is directly connected to the PIC.

Hence, I developed a small circuit board with four relay switches and four DB9 ports. One of the port is connected the PIC micro controller and the rest to the other devices. The model of the circuit and circuit diagram is given below.



-

Finger Print controlled Vehicle Access System

              Here I am discussing about a project that I had done during my graduation. I had to complete this project as a part of my college final year project. I had teamed up with two others, my classmates to complete it in the mentioned deadline. 

             



           The project describes how to implement a car security system using a finger print technology. Basically the procedure is to access the car using a finger (finger print). The car access security is so designed that it can be accessed by anyone whose finger is registered with the device. The car is loaded with a master fingerprint (MFP) that has access to all the functions of the device, full access to car’s features so on. The other (not mandatory) member’s finger prints registered not as master (SFP) can access limited features of the car. The master can add, remove or deactivate a slave member. 

Basic modules in the project are:
• Finger print scanner.
• Module control unit. 

A much powerful renases R8C25 IC [features] is used for this project. The reason why I preferred to use this particular IC was just with a mere intention to learn about this new chip. One can use any cheaper IC with similar features. 

Let us go through the details:

            Now, I will take you through a deeper explanation of the project, features, its advantages and disadvantages. As I mentioned the device is fully controlled by a master. In the project designed, the master can access the car doors, the bonnet (hood), the boot, start engine and drive the car. The slave members can access only those parts authorized and permitted by the master. The device understands the identifies the user and thus activates the profile as Master or as slave. 

The device which can be fitted inside the car, does not allow the vehicle to start without the verification of fingerprint, even though the right key is used. It immobilizes the car in the driver’s absence and thus reduces thefts possibilities. 

The control unit is normally installed inside the deck. The scanner can be installed in any convenient location in the vehicle with the keypad and scanner slots. 



A brief description about the IDE, modules and source code development: 

IDE: The IDE (Integrated Development Environment) HEW (High Performance Embedded Workshop) is used to program the Renases R8C25. HEW enables the use of the right tool for each process. HEW supports multiple tool chain integration enabling development for any number of projects under a single user interface. HEW also eliminates the need to switch environments between coding and debugging operations.


The feature of the finger print module: 

           




Hardware connections: 

                 The hardware connection is via serial interface. The module may communicate with MCU of 3.3V or 5V power. TD connects with RXD of MCU, RD connects with TXD of MCU. Should the computer be in RS-232 mode, add level converting circuit like MAX 232 between module and PC. UART or serial communication is made use of for communication of the module with the computer. The baud rate may be set between 9600 and 115200 LCD 

Display: 

                    A STN type 16X2 LCD display is used in the circuit. Further details about how to use a LCD display is described in relevant post. Power Supply: LM7805 for 5V supply required in control unit and LM117 for 3.3V supply required in Finger Print Module is used. 


Advantages:
  •   The natural uniqueness of finger print of a person increases the level of security. 
  •  The locked car can be accessed only by the registered members. 
  •  The user friendly features and flexibility helps one to control the slave member’s user access.  
Disadvantages:
  •        The car cannot be used by friends in case of emergency.

Source Code:  

// HEADER FILES

#include "sfr_R825.h"                                            //Definition of R8C/25 SFR
#include "hd4478_8b.h"

// INITIALIZATIONS AND FUNCTIONS

int i=0;
void delay(int x);
void Hold_Parent(void);
void enroll_fp(void);
void initial_display(void);
void scanning(void);
void enrolled(void);
void fp_not_recognized(void);
void access_vehicle(void);
void enroll_completed(void);
void Parent_mode(void);
void fp_recognized(void);
void hold_child(void);
void init(void);
void lock(void);
void fp_recognization(void);
void child_mode(void);
void parent_or_child(void);

int i,h,k,d,w,timer=0,count,image_create_enable=0;
int store_location_select=0;

char flag=0,msg_format[25]={"BWD<SEND INFORMATION>"};

int enroll_count,enroll_act=0,library_check = 0;
int library_check2=0,sens=0;
int enable,Number_of_bytes=0,array_count=0;

void finger_print_scan(void);
void uart_transmit(const char b[100]);
void finger_print_module_initialisation(void);
void store_location(int x);
void beep(void);
void short_beep(void);
void enroll_finger_print(void);
void Command_for_collecting_the_image_from_the_scanner_1st_time(void);
void Moves_the_image_in_to_char_buffer1_(void);
void Command_for_collecting_the_image_from_the_scanner_2nd_time(void);
void Moves_the_image_in_to_char_buffer2_(void);
void Creating_Finger_Templates_(void);
void Store_the_templates_into_the_flash_0th_Location_(void);
void empty_library_(void);
void uart_transmit_array(char *b);
void delay_ms(unsigned long int ms);
void delay_us(unsigned long int uS);
void delay(int);
void init(void);
void _empty_library_(void);
void _enroll_finger_print_(void);
void hold_your_fgr(void);
void _finger_print_scan_(void);

unsigned char finger_print_initialisation[100]={0xFB,0x0D,0xFA,0x27,0xFC,0xFC,0xD0,0x12,0xEC,0x3F,0xFF,0xFF,0x10,0xB1,0x10,0x10,0xB0,0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x07,0x13,0x00,0x00,0x00,0x00,0x00,0x1B,0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01};

unsigned char device_open[100]={0xFB,0x0D,0xFA,0x27,0xFC,0xFC,0xD0,0x12,0xEC,0x3F,0xFF,0xFF,0x10,0xB1,0x10,0x10,0xB0,0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x07,0x13,0x00,0x00,0x00,0x00,0x00,0x1B};

unsigned char command_for_collecting_the_image[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x03,0x01,0x00,0x05};

unsigned char Moves_the_image_in_to_buffer1[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x04,0x02,0x01,0x00,0x08};

unsigned char Moves_the_image_in_to_buffer2[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x04,0x02,0x02,0x00,0x09};

unsigned char Creating_Finger_Templates[12]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x03,0x05,0x00,0x09};
unsigned char Store_the_templates_into_the_flash_0th_Location[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x06,0x06,0x02,0x00,0x00,0x00,0x0F};

unsigned char Store_the_templates_into_the_flash_1st_Location[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x06,0x06,0x02,0x00,0x01,0x00,0x10};

unsigned char Store_the_templates_into_the_flash_2nd_Location[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x06,0x06,0x02,0x00,0x02,0x00,0x11};

unsigned char Store_the_templates_into_the_flash_3rd_Location[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x06,0x06,0x02,0x00,0x03,0x00,0x12};

unsigned char search_library[20]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x08,0x1B,0x01,0x00,0x00,0x01,0x01,0x00,0x27};

unsigned char capture[50]={0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05,0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X0A,0X00,0X0E,0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X0A,0X00,0X0E};

unsigned char finger_collection_success[12]={0xef,0x01,0XFF,0XFF,0XFF,0XFF,0x07,0x00,0x03,0x00,0x00,0x0a};

unsigned char send[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0X00,0X03,0X16,0X00,0X1A};

unsigned char finger_presence_checking_array[12]={0xef,0x01,0xff,0xff,0xff,0xff,0x07,0x00,0x03,0x00,0x00,0x0a};

unsigned char send_acknowledgement[1000];

unsigned char empty_finger_library[12]={0xef,0x01,0XFF,0XFF,0XFF,0XFF,0x01,0x00,0x03,0x0d,0x00,0x11};

unsigned char empty_finger_library_acknowledgement[12];
unsigned char device_open_acknowledgement[10];

unsigned char command_for_collecting_the_image_acknowledgement_for_search[12];

unsigned char Creating_Finger_Templates_acknowledgement[12];

unsigned char command_for_collecting_the_image_acknowledgement[12];

unsigned char command_for_collecting_the_image_acknowledgement2[12];

unsigned char Store_the_templates_into_the_flash_0th_Location_acknowledgement[12];

unsigned char Store_the_templates_into_the_flash_1st_Location_acknowledgement[12];

unsigned char Store_the_templates_into_the_flash_2nd_Location_acknowledgement[12];

unsigned char Store_the_templates_into_the_flash_3rd_Location_acknowledgement[12];

unsigned char buffer1_acknowledgement[12];

unsigned char buffer1_acknowledgement_for_search[12];

unsigned char buffer2_acknowledgement[12];

unsigned char search_library_acknowledgement[18];

// MAIN

void main(void)
{

asm("FCLR I"); //Interrupt disable
prc0=1; //Protect off
selected.(cm14=1)
cm13=1;cm05=0;cm14=0; //Main Clock selected(cm0 bit 5, cm1 bit 3 and 4)
for(i=0; i<10; i++);
cm15=1; //High Drive Capacity selected(cm1 bit 5)
ocd2=0; //Main Clock selected(ocd bit 2)
cm16=0;cm17=0;cm06=0; //No division selected(cm0 bit 6,cm1 bit 6 and 7)
prc0=0; //Protect on

// Inital setting
asm("FSET I");
Hardware_Setup ();                         //Interrupt enabled
init();
initial_display();
delay(1500);
finger_print_module_initialisation()
while(1)
{
if(enroll_act == 0)
{
_empty_library_();
enroll_fp();
delay(500);
_enroll_finger_print_();
enroll_act = 1;
}
access_vehicle();
delay(500);
_finger_print_scan_();
}
}

// END OF MAIN

// FUNCTION DEFENITIONS

void initial_display(void)
{
Lcd_clear();
Print_RAMstring ("FINGER PRINT",2,0);
Print_RAMstring ("VEHICLE ACCESS",1,1);
}

void enroll_fp(void)
{
Lcd_clear();
Print_RAMstring ("Press SW1",3,0);
Print_RAMstring ("To Enroll FP",2,1);
}

void Hold_Parent(void)
{
Lcd_clear();
Print_RAMstring ("Hold Parent's Fngr",0,0);
Print_RAMstring ("On Optical Scanr",0,1);
}

void scanning(void)
{
Lcd_clear();
Print_RAMstring ("Scanning......",1,0);
}

void enrolled(void)
{
Lcd_clear();
Print_RAMstring ("Enrolled",4,0);
}

void enroll_completed(void)
{
Lcd_clear();
Print_RAMstring ("Enrollment",3,0);
Print_RAMstring ("Completed",3,1);
}

void access_vehicle(void)
{
Lcd_clear();
Print_RAMstring ("Press SW2",3,0);
Print_RAMstring ("To Access Vehicle",0,1);
}

void hold_child(void)
{
Lcd_clear();
Print_RAMstring ("Hold Child's Fngr",0,0);
Print_RAMstring ("On Optical Scanr",0,1);
}

void hold_your_fgr(void)
{
Lcd_clear();
Print_RAMstring ("Hold Your Finger",0,0);
Print_RAMstring ("On Optical Scanr",0,1);
}

void fp_not_recognized(void)
{
Lcd_clear();
Print_RAMstring ("Finger",5,0);
Print_RAMstring ("Not Recognized",1,1);
}

void fp_recognized(void)
{
Lcd_clear();
Print_RAMstring ("Finger",5,0);
Print_RAMstring ("Recognized",3,1);
}


// Finger Print Module

void uart_transmit(const char b[100])
{
for(k = 0; k < Number_of_bytes; k++)
{
d = b[k];
while(ti_u0c1 == 0);
u0tb = d;
}
}

void uart_transmit_array(char *b)
{
for(k = 0; k < Number_of_bytes; k++)
{
d = b[k];
while(ti_u0c1 == 0);
u0tb = d;
delay_ms(1);
}
}

void Moves_the_image_in_to_char_buffer1_(void)
{
Number_of_bytes = 13;
uart_transmit_array(Moves_the_image_in_to_buffer1);
array_count = 0;
while(array_count < 12)
{
while(ri_u0c1 == 0);
buffer1_acknowledgement[array_count] = u0rb;
array_count++;
}
delay_ms(9000);
}

void
void Store_the_templates_into_the_flash_2nd_Location_(void)
{
Number_of_bytes = 15;
uart_transmit_array(Store_the_templates_into_the_flash_2nd_Location);
array_count = 0;
while(array_count < 12)
{
while(ri_u0c1 == 0);
Store_the_templates_into_the_flash_2nd_Location_acknowledgement[array_count] = u0rb;
array_count++;
}
}

void beep(void)
{
BUZZER_PIN_DIR = SET_AS_OUTPUT;
BUZZER = ACTIVATE;
delay_ms(20000);
BUZZER = DEACTIVATE;
delay_ms(100000);
}

void enroll_finger_print(void)
{
beep();
Command_for_collecting_the_image_from_the_scanner_1st_time();
Moves_the_image_in_to_char_buffer1_();
delay_ms(90000);
beep();
Command_for_collecting_the_image_from_the_scanner_2nd_time();
Moves_the_image_in_to_char_buffer2_();
if(image_create_enable == 2)
{
Creating_Finger_Templates_();
image_create_enable = 0;
store_location_select++;
store_location(store_location_select);
}
}

void finger_print_scan(void)
{
beep();
Number_of_bytes = 12;
uart_transmit_array(command_for_collecting_the_image);
array_count=0;
while(array_count < 12)
{
while(ri_u0c1 == 0);
command_for_collecting_the_image_acknowledgement_for_search[array_count] = u0rb;
array_count++;
}
Number_of_bytes = 13;
uart_transmit_array(Moves_the_image_in_to_buffer1);
array_count=0;
while(array_count < 12)
{
while(ri_u0c1 == 0);
buffer1_acknowledgement_for_search[array_count] = u0rb;
array_count++;
}
delay_ms(9000);
Number_of_bytes = 17;
uart_transmit_array( search_library);
array_count=0;
while(array_count < 16)
{
while(ri_u0c1 == 0);
search_library_acknowledgement[array_count] = u0rb;
array_count++;
}
}



void _empty_library_(void)
{
//if(SWITCH1 == ON)
//{
//short_beep();
empty_library_();
delay_ms(10);
while(SWITCH1 == ON);
//}
}

void fp_recognization(void)
{
//if(library_check == 0)
// {
if(search_library_acknowledgement[9] == 0)
{
//rec_activation=1;
for(sens=0;sens<2;sens++)
{
fp_recognized();
delay(700);
Lcd_clear();
delay(400);
library_check2 = 1;
}
}
else
{
for(sens=0;sens<2;sens++)
{
fp_not_recognized();
delay(700);
Lcd_clear();
delay(400);
}
}
//library_check = 1;
}
}

Disclaimer: You may use this piece of code, however the author is not responsible for any hardware of software damage caused by this code on your computer.


***