Proximity sensor question

Questions about Modern Device and JeeLabs Sensors
gana
Posts: 2
Joined: Wed Feb 26, 2014 11:32 pm

Proximity sensor question

Post by gana »

Sorry for many questions.. i am new and i also have some questions.

1) http://moderndevice.com/wpcontent/uploa ... _AP580.pdf
in the link above there is a PDF and in the 4th and 5th page i see sensing range looks like circle but after i tested it looks like inverse parabola or egg check this out( https://lh3.googleusercontent.com/-KR2T ... /aaass.png )

so i am exciting how did you calculate 3D position using the equation in the PDF ?

2)
is that angle or direction pointer line is 2D or 3D? it seems 2D but not sure.
3)
and in the link you referred what does Processing_SI1143_ColorVisualizer example code do? is that related in this video?

4) how to connect it to matlab kk ( just if you know)?

5) i want to connect sensor to matlab to work for further estimation for my project. So i need to rewrite the algorithm below..i just followed the code and calculated by hand on a paper,,,but still dont understand why did you multiplied Vector B and C by 0.5 ? why multiplied by 0.866 and 57.296?



x = (float)Avect - (.5 * (float)Bvect ) - ( .5 * (float)Cvect); // integer math
y = (.866 * (float)Bvect) - (.866 * (float)Cvect);
angle = atan2((float)y, (float)x) * 57.296 + 180 ; // convert to degrees and lose the neg values
Tvect = (long)sqrt( x * x + y * y);

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Proximity sensor question

Post by oz »

Gaba,
1) http://moderndevice.com/wpcontent/uploa ... _AP580.pdf
in the link above there is a PDF and in the 4th and 5th page i see sensing range looks like circle but after i tested it looks like inverse parabola or egg check this out( https://lh3.googleusercontent.com/-KR2T ... /aaass.png )

so i am exciting how did you calculate 3D position using the equation in the PDF ?
I think that one of the issues with this sensor as a distance sensor is that it is hard to detect the difference between an object that is farther away, and one that is only partially in the sensor, might be painted gray or black etc (e.g. an object that is only partially reflecting). With three LEDs you could compare the values and if one is greater maybe make the assumption that an object is closer, but the object is either partially out of the "sensing cone" , or the object is oriented in an manner to reflect more light away from some LEDs. This would be the case if the sensor were on a robot and you wanted to sense whether the robot were at an angle to a wall.
2)
is that angle or direction pointer line is 2D or 3D? it seems 2D but not sure.
Maybe you could consider it 2.5 D. While it would be perhaps be possible to calculate rough 3D coordinates to a sphere, other shapes are going to be problematic, for the reasons listed above. One assumption that you can make in distance is that if you have readings indicating a close object (high LED values) that the object really is that close. If you have lower values, the case is more ambiguous as to whether you are dealing with a close object partially reflecting (for some reason) or a more distant object.
3)
and in the link you referred what does Processing_SI1143_ColorVisualizer example code do? is that related in this video?
The color in the video comes from adding the three sensors with vector addition. I just used the angles of the LEDs from the center as the vector angles. It worked pretty well as you can see from the video. You can find many tutorials on the web on vector addition, it's pretty simple trigonometry.
4) how to connect it to matlab kk ( just if you know)?
Sorry don't know
.

5) i want to connect sensor to matlab to work for further estimation for my project. So i need to rewrite the algorithm below..i just followed the code and calculated by hand on a paper,,,but still dont understand why did you multiplied Vector B and C by 0.5 ? why multiplied by 0.866 and 57.296?
.866 is the the sine of 120 degrees.
57.296 is a conversion from radians - all the trig functions work in radians (but not my brain ☺ )


x = (float)Avect - (.5 * (float)Bvect ) - ( .5 * (float)Cvect); // integer math
y = (.866 * (float)Bvect) - (.866 * (float)Cvect);
angle = atan2((float)y, (float)x) * 57.296 + 180 ; // convert to degrees and lose the neg values
Tvect = (long)sqrt( x * x + y * y);

gana
Posts: 2
Joined: Wed Feb 26, 2014 11:32 pm

Re: Proximity sensor question

Post by gana »

ok then 0.5 is cos 120...

thanks for nice answering...

i just made this sensor on the matlab like virtual sensor
https://www.youtube.com/watch?v=JioQbYGywLg

Post Reply