Short Range Personal Radar

Questions and Comments on All Projects
ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Short Range Personal Radar

Postby ThePyroElectro » Thu Feb 07, 2008 10:05 pm

Short Range Personal Radar Project Write-up

The idea to create a type of close proximity radar system came from a student in one of my classes. We went ahead and decided to streamline the idea into the course as one of the projects we'd build.



Questions & Comments?

jrob
Newbie Pyro
Posts: 1
Joined: Sun Feb 10, 2008 9:22 pm

Postby jrob » Sun Feb 10, 2008 9:24 pm

Might want to move the box into the back seat or have it be an auditory display. Imo if ppl are staring at this box they might be paying less attention to the things behind their car.

Lakerol
Newbie Pyro
Posts: 2
Joined: Wed Feb 27, 2008 5:09 pm

Postby Lakerol » Wed Feb 27, 2008 5:12 pm

Hi, I would like to know if the codes can be applied/modified to run on a 16F877 20 MHz osc?

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Wed Feb 27, 2008 7:19 pm

Hi Lakerol,

You can definitely use a 16F877 for this project :D .
You'll need to modify the:
#include <p18f452.h> to <p16f877.h>

along with a few of the port statements so that it matches up with the ports used in the program.
The 2 timers used will also need to have some numbers modified to match the clock frequency.
If you need to know more specifics just ask :wink: .

Lakerol
Newbie Pyro
Posts: 2
Joined: Wed Feb 27, 2008 5:09 pm

Postby Lakerol » Thu Feb 28, 2008 4:55 pm

Hi,

Actually I'm a newbie to PIC stuff so pardon me if some questions sound simple to you... After searching for days on the net for information, it seems that if I were to use a 20 MHz crystal, it is impossible to do PWM using timer2 because the frequency required to control the servo is too low and requires a lower crystal such as ~4 MHz? Pls correct me if I'm wrong...

Right now what I'm doing is to use time delays to generate pulses and using a oscilloscope to measure it... something like trial and error... and it can still control the servo... but it would be great if you can shed some light into the feasibility of using a 20 MHz crystal to control the servo using PWM.

BushidoShonin
Newbie Pyro
Posts: 4
Joined: Wed Mar 05, 2008 2:38 pm

Got questions

Postby BushidoShonin » Sat Mar 08, 2008 1:34 am

Hello, I am new to all this stuff and I have some questions.

First: In the line:
"if(ir_data > 0x171 && ir_data <= 0x19E){"
where did "0x171" come from and is it Hex?

Second: Is there recommendations on learning material?

Thank you in advance.

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Sat Mar 08, 2008 5:48 am

Hey BushidoShonin,

:arrow: For your first question:

0x171 and 0x19E are representations of hexadecimal values in C.
0x171 = 369 (decimal), 0x19E = 414 (decimal).

These values are chosen as 'limits' and if you look, you'll see there's a few of them used in the radar program, one for each possible led on the radar output display.

They are used as comparators for the IR sensor data input. Depending upon the value coming in, a different led may or may not light up on the display.

(I'm just giving a high level description of what's going on)

:arrow: For your second question:

Unfortunately there is no one magical book out there that you can buy to learn all this stuff. It is a cumulative learning process like most things. Here's my recommendation:

First:
-Learn the basics of Digital Logic Design (and, or, not, xor...etc).
-Learn the basics of Programming C.

Then:
-Get a Microcontroller Development Board & Programmer Setup (these are available alllll over)
-Begin programming very simple programs & work your way up.
These two tutorials give an example of a microcontroller & programmer:
http://www.pyroelectro.com/tutorials/pi ... index.html
http://www.pyroelectro.com/tutorials/pr ... index.html


If you want specifics just give a reply, I can make some recommendations. :D

BushidoShonin
Newbie Pyro
Posts: 4
Joined: Wed Mar 05, 2008 2:38 pm

Postby BushidoShonin » Mon Mar 10, 2008 12:00 pm

Thank you for your help, but I was wondering a little more indepth. Where are the hex numbers coming from? (ie if I want to change the distance of when the LED is lit, how do I get the number that represents said distance).

Again, thank you for your help.

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Thu Mar 13, 2008 7:33 pm

Hey BushidoShonin,

:idea: Check out the datasheet for one of the IR sensors (for example part #GP2D120). They have a really nice graph that shows how the ouput voltage from the device relates to distance, there is even a nice method to create a linearization of the graph.

I included it in this tutorial as well:
:arrow: http://www.pyroelectro.com/tutorials/in ... heory.html

The analog output voltage nears 3v and varies much lower when objects are far, far away (depending on the sensor specified range). In my project I used an A/D coverter to get the voltage value with a reference to +5v. The hex numbers you see are ranges for the different values. Each LED that lights up represents a distance range away from the sensor with similar distances away from each other.

You choose the (hex) value that you need for your given application. That's how i did it for this one, very little mathematical theory was done, just basic manual ranging and testing with a battery and a piece of paper to determine voltage/distance relationships in different light settings and to confirm the graph on the datasheet. :shock:

cevbe
Newbie Pyro
Posts: 1
Joined: Mon Apr 07, 2008 8:17 pm

short range personal radar problem

Postby cevbe » Mon Apr 07, 2008 8:45 pm

Hii first of all i would like to thank you for project. i set up ciruit and loaded the pic18f452 with c18. But my device is working very absurd. I used sharp 2yoa21 and standart servo. servo and circuit are working out of order . I wanted to use pic16f877 but c18 was not compile. please help me what can i do? in addition my programmer is not work (for xt 10Mhz.) max 4 Mhz. thanks right now.

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Tue Apr 08, 2008 8:24 pm

Hi Cevbe,

Reguarding the operation being 'absurd'. This is most likely because you haven't calibrated the ranging of the sensor. The code I developed was specific to my enviornment (i.e. lighting conditions, weather). You will need to altar the range of A/D values (in the code) that light up the LEDs. :idea:

After you have the sensor calibrated it will work much more accurately. Remember the IR sensors can be thrown off quite easily, like any sensor can, if you drastically change the surrounding enviornment. :?

The PIC 16F877 can be programmed using the ICD2 programmer, not all PIC programmers are created equally so yours may not be able to program it. You will need to double check with the manufactuerer. Be sure to:
:arrow: #include <p18f877.h>
atop the code so that things compile & program properly.

With a 10MHz clock you should be choosing an HS oscillator configuration. XT is meant for up to 4 MHz if my memory serves me correctly. :wink:

tylerl
Newbie Pyro
Posts: 1
Joined: Wed Mar 26, 2008 10:37 am

74HCT...

Postby tylerl » Tue Apr 22, 2008 8:32 am

Is there significant reason to use the 47HCT373 chips in particular, as opposed to another logic family?

I'm fairly new to building my own hardware, so I what to look out for and what I can get away with.

Say, for example, could I use a 74ALS373 or a 74ACT373 chip instead? I've heard of problems if you mix logic families, though to be honest, I have no idea what family microcontrollers use anyway, so I wouldn't know what I'm mixing.

So, to nutshell the issue: does it matter here? when does it matter? and when it does matter, what should I use? Thanks.

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Tue Apr 22, 2008 6:23 pm

Hi Tylerl,

The reason 74HCT373's were used is because they are 'high current' logic devices. For the personal radar application 74HCT/74LS shouldn't make a difference. Just test the chip out and make sure it is capable of lighting 8 LEDs at once. The LEDs I used for displaying output are low current so in the end it didn't really matter. :wink:

In a nutshell:
:arrow: It doesn't matter here.
:arrow: It matters when you need to have high current outputs.
:arrow: You should use whichever device suits your needs. compare the data sheets side by side and you'll see the differences in output current.

derrick1616
Newbie Pyro
Posts: 6
Joined: Thu May 15, 2008 6:08 pm

need help compiling

Postby derrick1616 » Thu May 15, 2008 6:15 pm

This is the error message i keep getting when i trying compile using MPlab

Release build of project `C:\Documents and Settings\Derrick\Desktop\project\radar.mcp' started.
Thu May 15 13:11:28 2008
----------------------------------------------------------------------
Build aborted. The project contains no source files.
----------------------------------------------------------------------
Release build of project `C:\Documents and Settings\Derrick\Desktop\project\radar.mcp' failed.
Thu May 15 13:11:28 2008
----------------------------------------------------------------------
BUILD FAILED

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Thu May 15, 2008 6:41 pm

You need to add your .c file (i.e. main.c) to the current project. This means right clicking on the 'source files' folder in your project window and adding the file. Then your project should compile. :D


Return to “Projects”

Who is online

Users browsing this forum: No registered users and 7 guests