I have one sharp sensor and I have to use it to measure the height of a block (6cm - 12 cm). How can I accomplish this ? Actually it is to be connected to a robot which will move near the box and determine its height.

About GP2Y0A21YK0F: http://www.sharpsma.com/webfm_send/1489

The robot is like this: http://i.imgur.com/8qT8zeQ.jpg

Robot picture

If possible please suggest a solution that doesn't require moving the sensor. But any method will do fine.


Can you explain more about how the robot is to measure the height?

It would seem to me like you could put the sensor at the top of a mast of known height $h$, looking down. Then the robot drives up to the block until the sensor feedback registers some distance other than $h$ (plus or minus some margin for noise, etc.)

Once you are in position, the height of the block is

$$ h_{\mbox{block}} = h_{\mbox{mast}} - \mbox{sensor output} $$

  • $\begingroup$ Thanks for the quick reply. It is really helpful. But actually the sensor is placed on the bot like this: i.imgur.com/8qT8zeQ.jpg Your method requires me to move the sensor to a different position. Is there any way possible to measure height without moving the sensor ? $\endgroup$ Dec 2 '15 at 14:27
  • $\begingroup$ The robot image is helpful. Are you allowed to add other items to the robot, such as a rotatable mirror between the sensor and the block? $\endgroup$
    – SteveO
    Dec 2 '15 at 14:29
  • 1
    $\begingroup$ The way your sensor is oriented, it cannot measure the height. It is currently measuring distance away from the robot along the horizon, so the closest you can get is to essentially infer whether or not the box is taller or shorter than the height at which you placed the sensor. Just imagine doing this with a ruler instead of some sensor -- would you try measuring the height by extending the ruler out horizontally? No! You need to measure vertically as Chuck says, so move the sensor to point down otherwise use a mirror as suggested by SteveO. $\endgroup$ Dec 2 '15 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.