IR Radar System

31,833

72

39

Introduction: IR Radar System

About: Hello All drop me a message.

Recently I've worked on a IR radar system by utilizing the sharp GP2D12 sensor. The sensor generates a voltage proportional to the distance to the measured object. I've used a PIC 18F458 microcontroller to measure that voltage and draw a radar screen on the 128x64 graphical LCD display.

The microcontroller also generates the pwm signals for driving the RC servo motor. The servo motor turns the IR sensor for scanning the environment.

Step 1: Videoclip

here is a videoclip of the system while working.


Step 2: Circuit Schematic

here is the circuit schematic and the proteus simulation file

a more detailed version of the circuit schematic is in the zip file.

the DSN file is also full detail. it also simulates the circuit, all you need to do is to download the proteus demo version from www.labcenter.co.uk

Step 3: Source Code

#include <18F458.h>
#device ADC=8
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=8000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#define GLCD_WIDTH 128

#define GLCD_E PIN_E0 // Enable
#define GLCD_DI PIN_B5

#define GLCD_CS1 PIN_A1 // Chip Selection 1
#define GLCD_CS2 PIN_B0

#define SERVO PIN_A3

#include <HDM64GS12.c>
#include <graphics.c>
#include <math.h>

char message[] = "EndtaS RaDaR";
float theta = 0, ytheta;

void main() {

int1 enbas;
int mesafe;
int car1, sayac, a;
int16 servopos;

setup_adc_ports(RA0_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
set_adc_channel(0);
enbas:
glcd_init(ON);

glcd_fillScreen(OFF);

glcd_text57(30, 0, message, 1, 1);

glcd_circle(29, 37, 26, 0, 1) ;
glcd_pixel( 29 , 37 , ON);
theta = 7.85;
servopos = 550;
printf("Scan_START\r\n");
while(TRUE){

mesafe = read_adc();
//printf("th: %f -> %u \r\n\n",theta, mesafe);

ytheta = theta;
sayac = 1;
if ( enbas == TRUE ){
sayac = 50;
}
for ( a=0 ; a<sayac ; a++){
output_high(servo);
delay_us(servopos);
output_low(servo);
delay_us( 20000 - servopos );
}
if ( enbas == TRUE ) {
glcd_circle(29, 37, 25, 1, 0);
glcd_pixel( 29 , 37 , ON);
printf("Scan_START\r\n");
delay_ms(300);
}

if (ytheta >= 4.51 ) {
ytheta -=.02;
servopos += 12;
enbas = FALSE;
}
else {
//glcd_circle(29, 37, 25, 1, 0) ;
ytheta = 7.85;
servopos = 550;
//glcd_pixel( 29 , 37 , ON);
enbas = TRUE;
printf("Scan_COMPLETE\r\n");
}

//glcd_pixel( 28+(int)(car1*sin(-theta)+.5), 38-(int)(car1*cos(theta)+.5), OFF);

//glcd_pixel( 28+(int)(car1*sin(-theta-1)+.5), 38-(int)(car1*cos(theta-1)+.5), OFF);

theta = ytheta;

car1 = mesafe / 8;
glcd_pixel( 28+(int)(car1*sin(-theta)+.5), 38-(int)(car1*cos(theta)+.5), ON);
//delay_ms(10);
}
}

The Instructables Book Contest

Participated in the
The Instructables Book Contest

Be the First to Share

    Recommendations

    • Anything Goes Contest 2021

      Anything Goes Contest 2021
    • Raspberry Pi Contest

      Raspberry Pi Contest
    • New Year, New Skill Student Design Challenge

      New Year, New Skill Student Design Challenge

    39 Comments

    0
    Reivach777
    Reivach777

    8 years ago on Step 3

    Hello, friend. Thanks for sharing your work. But, I try to compile, and got some errors.

    I'll apreciate it, if you could help me.

    Clean: Deleting intermediary and output files.
    Clean: Deleted file "Radar.ESYM".
    Clean Warning: File "C:\Microcontroller software\PICC\Devices\Radar.o" doesn't exist.
    Clean: Deleted file "Radar.ERR".
    Clean: Done.
    Executing: "C:\Microcontroller software\PICC\Ccsc.exe" +FH "Radar.c" I+="C:\Microcontroller software\PICC\Devices" +DF +LN +T +A +M +Z +Y=9 +EA
    *** Error 18 "Radar.c" Line 17(10,23): File can not be opened
    Not in "C:\Microcontroller software\PICC\Devices\HDM64GS12.c"
    Not in local "C:\Trabajos Micro2\HDM64GS12.c"
    *** Error 18 "Radar.c" Line 18(10,22): File can not be opened
    Not in "C:\Microcontroller software\PICC\Devices\graphics.c"
    Not in local "C:\Trabajos Micro2\graphics.c"
    *** Error 18 "Radar.c" Line 19(10,18): File can not be opened
    Not in "C:\Microcontroller software\PICC\Devices\math.h"
    Not in local "C:\Trabajos Micro2\math.h"
    *** Error 12 "Radar.c" Line 35(10,11): Undefined identifier -- glcd_init
    *** Error 12 "Radar.c" Line 37(16,17): Undefined identifier -- glcd_fillScreen
    *** Error 12 "Radar.c" Line 39(12,13): Undefined identifier -- glcd_text57
    *** Error 12 "Radar.c" Line 41(12,13): Undefined identifier -- glcd_circle
    *** Error 12 "Radar.c" Line 42(13,14): Undefined identifier -- glcd_pixel
    *** Error 12 "Radar.c" Line 63(12,13): Undefined identifier -- glcd_circle
    *** Error 12 "Radar.c" Line 64(13,14): Undefined identifier -- glcd_pixel
    *** Error 12 "Radar.c" Line 90(13,14): Undefined identifier -- glcd_pixel
    11 Errors, 0 Warnings.
    Halting build on first failure as requested.
    BUILD FAILED: Wed May 22 02:15:15 2013

    0
    Tobor 2.0
    Tobor 2.0

    9 years ago on Introduction

    why dosent the video play when i click play? is there even a video, plz post it to youtube and add a link in the reply

    0
    yaly
    yaly

    9 years ago on Introduction

    good project but can i make it with pic 16f877a and Nokia 3310 GLCD?

    0
    aefields
    aefields

    10 years ago on Introduction

    Infrared is LiDAR, not RADAR. Please use proper terminology so that when people search for projects they can find what they want.

    0
    tzq33tdq
    tzq33tdq

    Reply 10 years ago on Introduction

    it just the same. i dont think it needs the right terminology.

    0
    RoxEroX
    RoxEroX

    Reply 10 years ago on Introduction

    a little edgy of a comment. but i am sure you addressed your concern with Sharp directly.
    you must have gotten a ticket lately.

    0
    sahl199
    sahl199

    10 years ago on Introduction

    hiii.. I want that circuit diagram and part list toooo...
    hope can sent at my email: sahl199@yahoo.com
    thanks

    :)

    0
    xink25
    xink25

    11 years ago on Step 2

    i need proteus simulation of infrared beam detector circuit,
    that when receiver is not receiving it should enable relay and turn on LED.
    a similar circuit is given URL :

    http://www.extremecircuits.net/2010/03/beam-break-detector-for-camera-shutter.html

    contact: xink_25@yahoo.com

    PLZ HELP,,,

    0
    palabuto
    palabuto

    11 years ago on Introduction

    awesome project man.Can you send me all the component used on this project more detailed and also with the circuit.thanks for sharing this project.This is my emel address mfdh_90@yahoo.com.

    0
    ahem
    ahem

    11 years ago on Introduction

     Oks! 
    Can you please mail me the circuit diagram. The proteus file is hard to understand for me. Please! 
    My email id is braingreat@gmail.com! 
    Thanks! 

    0
    alikhan007
    alikhan007

    11 years ago on Introduction

     WoAAh .... What a project...... 
     can u tell each and every thing which is used in this project..... under a heading of "PARTS LISTs USED"
    THAnks ...

    0
    ahem
    ahem

    11 years ago on Introduction

     Oks! But where is the sensor GP2D12 connected? 
    I don't see it anywhere in the schematic diagram! 

    0
    ahem
    ahem

    12 years ago on Step 2

     Heya! 
    Nice work! 
    but I dont understand where have you kept the Gp2D12 sensor from your circuit diagram! 
    And pls can you tell me how have you simulated the sensor with Proteus and how can I input the position of any obstacle to it! 
    Thanks in advance! 

    0
    hobbyman
    hobbyman

    Reply 12 years ago on Step 2

    RV1, the trimmer resistor at the right side of the LCD  simulates the output voltage of the sensor. There is no direct sensor simulation in my proteus file. 

    0
    deepanshu203
    deepanshu203

    12 years ago on Introduction

     Thanks for the help! 
    Now I can work upon the code to understand it and make one for the AT89C51 I intend to use in this project :)

    0
    deepanshu203
    deepanshu203

    12 years ago on Introduction

    Great project! 
    But I have just one doubt! 
    Is the coding given complete?
    Because when i tried to compile it using Mplab it gave an error! And I feel that there are some functions being called in it which do not have any definations given! 
    Do i require to be a Pro member to get the full coding? Or am I doing something wrong?
    Pls reply, caus I really wanna make it! 

    0
    hobbyman
    hobbyman

    Reply 12 years ago on Introduction

    thanks.

    the code is complete but it is for CCS C compiler.

    You would need to make some porting to compile and run it in microchip c or any other c compiler.