go_away

Author Topic: Manual calibrate Sharp IR  (Read 5035 times)

0 Members and 1 Guest are viewing this topic.

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
Manual calibrate Sharp IR
« on: March 15, 2008, 07:45:26 PM »
How do you manually calibrate the Sharp IR?  I would like to use it for my obstacle avoidance whenever an object comes within a predefined range.

Thanks.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Manual calibrate Sharp IR
« Reply #1 on: March 16, 2008, 08:04:46 PM »
1) Check the datasheet

and if its not in there already . . .
2) make a chart by measuring distance vs signal from your ADC (using UART)

now using data from 2), either make a lookup chart, or put it into an equation:
http://www.societyofrobots.com/sensors_interpret.shtml

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #2 on: March 17, 2008, 06:10:55 AM »
what do u exactly mean by calibration?
you just have to wait a fixed amount of time after the sensor is setteled in a position then you read the value using adc.
this time is mentioned in the datasheet and its about 50 ms
good ol' BeNNy

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #3 on: March 17, 2008, 09:12:56 AM »
Ok, sounds like the first thing I need to do is set up UART for my bot.  Back to the tutorials for me ;)


EDIT::
Uh oh, just peaked back at the UART tutorial and noticed that TX and RX are on the same pins as my servos.  I'm running four wheels and ultimately using all five pins for servos.  How can I use UART and run all of them at the same time?
« Last Edit: March 17, 2008, 09:18:51 AM by javafiend »

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #4 on: March 17, 2008, 10:29:51 AM »
why the heck dont you change the servos controls into another port ?????????
good ol' BeNNy

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #5 on: March 17, 2008, 01:25:23 PM »
why the heck dont you change the servos controls into another port ?????????

Because I'm running 5 servos and only have 5 ports.  Am I missing something on the $50 robot board that gives me expanded space for servos?
« Last Edit: March 17, 2008, 01:26:06 PM by javafiend »

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Manual calibrate Sharp IR
« Reply #6 on: March 17, 2008, 01:40:20 PM »
there are unused pins on the AVR microcontroller used in teh 50 dollar robot
Check out the Roboduino, Arduino-compatible board!


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

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #7 on: March 17, 2008, 01:42:54 PM »
calibration means findinout out what ur mcu reads for different values of distance now how u do it??/

keep ur sharp ir at a known distance and using uart see wats the reading of ur mcu keep doing this at different distances and find out the trend in the readings

ex-

distance              reading
      10 cm               90
      12 cm               100
      14 cm               120
      18 cm               150

draw a graph using these readings by taking distance in the X axis and Reading in the Y axis and suppose u have to avoid something within a distance of 6 cms then take 6 cms in The X axis and find out corresponding reading

use that value in the code and thats wat calibration means

and about the  TX AND RX ,try to make the yart circuit on another breadboard and use ur mcu there for the calibration


« Last Edit: March 17, 2008, 01:43:33 PM by superchiku »
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #8 on: March 17, 2008, 05:05:22 PM »
Quote
Because I'm running 5 servos and only have 5 ports.
as long as i believe a servo only need one pin to control it
so as long as you have 5 ports only , you can control up to 5*8 = 40 servos only ;D
good ol' BeNNy

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Manual calibrate Sharp IR
« Reply #9 on: March 17, 2008, 05:08:42 PM »
Quote
Because I'm running 5 servos and only have 5 ports.
as long as i believe a servo only need one pin to control it
so as long as you have 5 ports only , you can control up to 5*8 = 40 servos only ;D

thats 8 servos per pin ONLY if you buy an external servo controller

what javafiend want is for the microcontroller to control the servos directly
Check out the Roboduino, Arduino-compatible board!


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

www.Narobo.com

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #10 on: March 17, 2008, 05:24:37 PM »
doesnt he mean motors like the hitec ones? which have an embedded driver ?if no
why dont you buy one of those as they are cheap and easy to use??
making your own servo driver is a whole project itself
good ol' BeNNy

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #11 on: March 17, 2008, 10:19:05 PM »
well servo control is quite easy, u should not have any problems at all and abt the motor driver ya using it is difficult but not impossible , it can be done too
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #12 on: March 18, 2008, 07:36:49 AM »
So what I'm hearing is that I should use UART to just get the initial sensor data for calibration.  If I wanted to keep UART constantly connected, I would need a separate servo controller.

Now what is this about each pin being able to control 8 servos?  Can someone point me to something showing how this works and is implemented - both hardware and software?

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #13 on: March 18, 2008, 08:13:56 AM »
Quote
Now what is this about each pin being able to control 8 servos? 

1 pin controls 1 servo ,1 port controls 8 servos

when you say 1 pin controls 8 servos this means that you are using the same control signal to all servos
so the 8 servos would act the same
i dont think you meant that anyways.

check the website for more info about servos
good ol' BeNNy

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #14 on: March 18, 2008, 09:07:43 AM »
well u dont need to connect the usart always , just do ur sensor calibration in another ckt by using uart then use them in ur program

and do u understand the difference between port and pin????

8 pins === one port

like portd which has pins from 0-7
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #15 on: March 18, 2008, 09:43:40 AM »
and do u understand the difference between port and pin????

8 pins === one port

Quote
Because I'm running 5 servos and only have 5 ports.

Ah, that may be where I originally confused the issue.  I should have said I only have 5 pins.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #16 on: March 18, 2008, 11:55:52 PM »
i really reccomend usig a breadboard to make the usart circuit and testing ur sensors there
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: Manual calibrate Sharp IR
« Reply #17 on: March 19, 2008, 05:17:19 PM »
If you are using the board from the $50 robot. There are mcu pins not connected up to anything. Its up to you to add more headers to connect them up.
look at the picture below:



pins pc0,pc1,pc2,pc3,pd2,pd3,pb0,pb1,pb2,pb3,pb4,pb5,pb6,pb7 arent connected to anything. They can all be connected to extra headers for you to use for servo's etc..

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #18 on: March 19, 2008, 10:55:34 PM »
yes andtry uising usart
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Manual calibrate Sharp IR
« Reply #19 on: March 23, 2008, 08:33:49 AM »
In addition to what paulstreats and airman00 said, you can also use the analog ports to control servos - you just need to reconfigure them to digital ports in software (sor utils file explains it).

You can control like ~14 servos I think with the $50 Robot (I didn't count, but its around that number).

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #20 on: March 25, 2008, 06:44:49 AM »
analog port means the analog to digital converter pins isnt it?
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #21 on: March 25, 2008, 10:31:37 AM »
no , i guess admin meant the digital to analog ones, which are related to the timer(called pwms)
good ol' BeNNy

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: Manual calibrate Sharp IR
« Reply #22 on: March 25, 2008, 11:13:28 AM »
you can use the analogue input pins. you just need to configure them as digital i/o and set them to output

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #23 on: March 26, 2008, 06:54:30 AM »
ook thats easy to do by software
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #24 on: March 26, 2008, 09:41:48 AM »
It sounds like the microcontroller pins are kind of multi-purpose.  For example, I was concerned about using PB6 and PB7 (XTAL1 and XTAL2) for anything besides whatever XTAL is.  Perhaps I am in over my head :(

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #25 on: March 28, 2008, 04:59:34 AM »
for ur 1st bot or whatever...
always remember the KISS principle or ull end up with a robot whose motors even dont turn properly
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #26 on: March 28, 2008, 09:16:28 AM »
what is this KISS principle?
good ol' BeNNy

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Manual calibrate Sharp IR
« Reply #27 on: March 28, 2008, 09:20:08 AM »
what is this KISS principle?

Keep It Simple Stupid
Check out the Roboduino, Arduino-compatible board!


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

www.Narobo.com

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: Manual calibrate Sharp IR
« Reply #28 on: March 28, 2008, 09:25:45 AM »
Quote
what is this KISS principle?


Keep It Simple Stupid

lol ,, tricky one
good ol' BeNNy

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Manual calibrate Sharp IR
« Reply #29 on: March 28, 2008, 09:50:58 AM »
hmm... really really Tricky
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

 


Get Your Ad Here