IR Distance Sensor Help
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- reg bitley
- Posts: 5
- Joined: Tue Dec 22, 2009 2:36 pm
IR Distance Sensor Help
I recently purchased the Arduino Duemilanove board and the sensor pack from Adafruit. I have completed most of the example sketches and am ready to start improvising with the sensor pack. I want to make a distance sensor utilizing the Sony IR Distance Sensor and a push button and I am looking for a sketch with some basic code for the sensor. I would appreciate it if someone could provide a link. TIA
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: IR Distance Sensor Help
you can use just analogread to read the value. the value will vary with distance.
- reg bitley
- Posts: 5
- Joined: Tue Dec 22, 2009 2:36 pm
Re: IR Distance Sensor Help
Thanks, that was easy enough. I marked off a 1x4 with 10cm increments and created 3/4"x4"x4" target with white paper taped on and made some initial test readings. I was surprised at the repeatability of the raw readings over the test length (10cm to 60cm), but they sure weren't linear. I've got to dust off the old math books now and come up with a 'non-linear' scaling formula. Thanks again.
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: IR Distance Sensor Help
good work! check the datasheet for some rough curves
- zener
- Posts: 4567
- Joined: Sat Feb 21, 2009 2:38 am
Re: IR Distance Sensor Help
You can plot the values in Excel and do a regression on it. I would have assumed they would be linear, but I have never used that sensor.
Please be positive and constructive with your questions and comments.