Author Topic: making range finding prg. for Sharp IR Sensor?  (Read 4292 times)

0 Members and 1 Guest are viewing this topic.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
making range finding prg. for Sharp IR Sensor?
« on: February 17, 2008, 08:09:48 AM »
Hello, I have a GP2D12 Sharp IR sensor that i'm trying to make a range finding program and not having luck :(.  I'm programming with BASIC MICRON software using the BOT BOARD II and BASIC Atom 28-pin.   

BOT BOARD II
http://www.lynxmotion.com/Product.aspx?productID=252&CategoryID=66

BASIC Atom 28 - pin
http://www.lynxmotion.com/Product.aspx?productID=269&CategoryID=66

I already tried asking on Lynxmotions forum, but no inteligent responses :'(.

Please help.

Bane
« Last Edit: February 21, 2008, 12:14:16 PM by BANE »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: making range finding prg. for Sharp IR Sensor?
« Reply #1 on: February 20, 2008, 08:00:50 AM »
What do you want your program to do? Can you show us what code you've tried but failed with?

If you are just trying to read the sensor with code, look up the Analog-to-Digital converter examples.

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: making range finding prg. for Sharp IR Sensor?
« Reply #2 on: February 20, 2008, 07:53:42 PM »
whats the problem?


Are you getting "good" values of the Sharp IR sensor from the ADC?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: making range finding prg. for Sharp IR Sensor?
« Reply #3 on: February 21, 2008, 12:13:41 PM »
see pic (amazing art skillz!)

In the program i want to tell the servo to run until the IR sensor reads a certain value (what ever that value is).
Ex. I want for the robot to move 6" from the sensor, the program should activte the servo in the right direction until the sensor reads 6" and stops.  (to get the servo moving in the right direction,   "If sensor reads X< desired move, then move robot away from it, if X> then desired position, than move towards until right value."  Now that what i want it to do, but i need some info on how to get the sensors values (data sheet) that would be given and the conditional statement that i discribed.

Hope this is enough info ;)

(all ready have data sheet advalable on website, but couldn't find it helpful)

Bane

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: making range finding prg. for Sharp IR Sensor?
« Reply #4 on: February 21, 2008, 05:58:11 PM »
what i need to know first ,is does the value of the Sharp IR sensor change with distance

Just hook up a MCU and LCD to see the values
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: making range finding prg. for Sharp IR Sensor?
« Reply #5 on: February 21, 2008, 06:41:50 PM »
yes, the sensor is stationary and the robot on the track is whats moving.  But i don't have a MCU or LCD to display their values.  Am I scruwd with out it or can i just play with what values it has by debugging.  But first i need to write a program that use the IR sensor

here is the pic again.

bane

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: making range finding prg. for Sharp IR Sensor?
« Reply #6 on: February 21, 2008, 07:01:33 PM »
invest in a serial LCD  and you can control a SERIAL LCD with one microcontroller


Just make sure you buy a serial LCD and not parallel , serial uses one pin on your micro
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: making range finding prg. for Sharp IR Sensor?
« Reply #7 on: February 22, 2008, 06:11:44 AM »
like this one
http://www.lynxmotion.com/Product.aspx?productID=61&CategoryID=105

is there anyother way around it?

bane

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: making range finding prg. for Sharp IR Sensor?
« Reply #8 on: February 22, 2008, 08:29:47 AM »
over here is cheaper http://melabs.com/products/displays.htm
Go with 4 line LCD since its only 10 bux more than the 2 line one

LCDs are necessary for debugging ( or you can do UART to your computer.... )
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: making range finding prg. for Sharp IR Sensor?
« Reply #9 on: February 22, 2008, 05:26:47 PM »
question:  even if i do get the display, i still need to have a program to take input from the IR sensor and display it on the screen?  What i really need is the program  ???(is that logical?)

bane

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: making range finding prg. for Sharp IR Sensor?
« Reply #10 on: February 23, 2008, 03:57:00 PM »
This is the program you would use (in pseudocode):

Code: [Select]
sensor_value = analog(rangefinder);

sensor_value = sensor_value*convert_constant;//convert to metric units

if(sensor_value > 6)
  servo(clockwise)
else if(sensor_value < 6)
  servo(counterclockwise)

 


data_list