Measuring length of block

I have a task where I need to measure the relative length (short, medium, long) of a block before picking it up with a robot and I need help in figuring out the best way of doing that. I made a quick illustration of what I’m trying to do and have attached it to this post.

This is assuming I have a fully mobile Arduino based robot with the ability to pick up the blocks either with an arm of a scoop.

What I’m trying to figure out:

  • The best sensor/method to measure the relative length of an object (short, medium, long)

I know this is probably easy to do using something like a camera and OpenCV but I don’t have room on the robot for much more equipment and I’m running everything off an Arduino.

I would appreciate any input on this - it’s been a tough one to figure out.


Paint the blocks with matt paint, either black, white or grey, according to their length. Use the reflectivity of the paint to determine their length.

I can't rely on color in this application since the robot has to be able to determine length without any prior knowledge of the properties of the blocks. It just knows that there is a block in this location of unknown length and it needs to categorize that.

Does it know which way the blocks are orientated? If length is the only variable, end on, all the blocks will look to be the same size.

Weight/mass? Could the arm pick up each block and, by integrating a strain guage into its arm, weigh the block? Strictly speaking, this is not measuring the block before picking it up.

Or integrate an ir reflection sensor into the arm, like the ones used in line follower robots. The robot scans the length of the block by moving its arm, detecting the edges with the sensor. Orientation could be a problem.

Oh wow, I didn't even think of weighing the blocks - that's creative! It adds another measure of (no pun intended) precision that will have to be factored in though, especially since I would have to weigh them all to get relative lengths.

My one IR sensor idea involves the use of an array of IR sensors -the robot picks up a block and puts it in front of this array. Depending on how many IRs are triggered, I can get a measure of length. Not sure if that's the best solution out there though.

Some of my assumptions might be wrong, but here they are.

  1. The blocks are of known width and height and the length are longer than either W or H.
  2. You are allowed to either push the blocks around or pick them up before determining length.
  3. You have a wall.

Method 1: push a block against a wall such that the length axis is perpendicular to the wall run the robot up to the end of the block and use an ultrasonic sensor to read the distance to the wall

Method 2 - use the arm to pull the side of a block up against the side of the robot. - run the robot backward until you sense the end of the block (light sensor or arm movement up/down, or small arm with roller to detect drop at end. - Run forward, counting wheel travel distanlc until the other end is sensed.

If the robot is to pick up the block with a "finger and thumb" mechanism that could also be used to measure the length - depending on how much the finger and thumb close towards each other. You could have a potentiometer at the junction between the finger and thumb.