I'm trying to design a hand-held device which would allow to measure the weight and a size of a fruit (orange/apple).
For the weight I can use a load cell, but not sure how to measure the diameter.

What I'm thinking at the moment is a cone shape. The bigger the orange the farther it will be from the end of the cone. What I can measure is the distance from the end of the cone to the orange or by measuring the distance from the end of the cone to where the orange touches the wall.

For the first one I could use some kind of resistive rod which the orange will push out and then measure the resistance.
For the second one I could use a touch bar sensor.

Any ideas what kind of elements I can use for either solution?
Can someone think of a better way to measure the diameter of an orange on the go with arduino?


A little bit of a background: the quality of oranges in my local stores is not very good - you get a lot of dried out ones. The idea is that the heavier the orange given the same diameter the better it is (it contains more juice). I want to build a kind of hanging scale which you hold in your hand and put an orange in it - it will sense the diameter of an orange and it's weight and displays the "juiciness" of the orange. This way I can filter out the bad ones.

  • \$\begingroup\$ You're really persnickety about your oranges! Is an ultra sonic sensor like sparkfun.com/products/13959 suitable? Will +/- 3mm do? \$\endgroup\$
    – Paul Uszak
    Apr 21, 2017 at 3:13
  • 3
    \$\begingroup\$ +1 for the clever 3D to 1D mechanical measurement pre-processing \$\endgroup\$
    – Neil_UK
    Apr 21, 2017 at 4:40
  • 1
    \$\begingroup\$ I worked on a device to size fruit using this exact method about 15-20 years ago. Used an ultrasonic distance sensor facing up towards the bottom of the cone (actually just 3 rods to form the 'cone'). Little hint: if you choose the correct angle for your cone, the math to convert distance to diameter becomes almost trivial. \$\endgroup\$
    – brhans
    Apr 21, 2017 at 6:29
  • \$\begingroup\$ I hate dry oranges! Please mass produce on global scale. +1. \$\endgroup\$
    – Dampmaskin
    Apr 21, 2017 at 7:21
  • \$\begingroup\$ I don't know the typical electric resistance of the orange surface, but you can test it with a multimeter. I'm almost sure it will be detectable. Then you will be able to put concentric metal half-circles on the inside surface of the cone and detect where the orange closes the circuit. An op-amp may be needed if the resistance's too high. Then use an analog multiplexer to scan through the circles, using just a single Arduino analog input. \$\endgroup\$ Apr 21, 2017 at 7:45

4 Answers 4


You might also consider measuring diameter using a linear encoder, which would add precision and accuracy at the cost of...cost. Or you could even go about it like digital calipers do - a mechanism based on varying capacitive and measuring phase shift of PWM signals (i.e. probably more complicated than is worthwhile).

But, better yet, use a slide pot, which is resistive and dead-simple to integrate. Sliders are relatively cheap and wouldn't necessarily require any external components - just reading voltage level through divider. You'd just need to be sure to get one longer than the greatest diameter fruit you expect to encounter.

On the other hand, the manufacturers who produce calipers and linear encoders opt for other methods - capacitance, inductance, Hall effect, magnetoresistive, optical, etc. - for increased precision (resolution) and accuracy. I expect that your application does not call for such precision, though.

In any event, you'd avoid the need for a cone, which adds a good deal of bulk to your portable device.


that's a nice question! I've got an Idea, which might help.

You can use an ultrasonic sensor, and place them in front of a board, based on how large you want it to be. Measure the distance between the board and the sensor(serial.print and then take 5-6 values get an average figure). Put an object now, and subtract this reading from the initial distance(between the board and the sensor). You got the DIAMETER!

Or if you don't want a board and want a hi-fi, cool looking thing that just measures the dia by just putting it there, you should take 2 sensors, put them at a desired distance and note that distance down(don't use serial.print here, use a scale/ruler/measuring tape) now put an object in between. Take both the readings from the sensors and add them up. Subtract this from the total distance between the sensors. YOU HAVE THE DIAMETER!( with this you can also adjust the size of the whole setup)

Or the last method: get a digital vernier calipers, and glue a gear to it and connect it to servo. get it to the max distance initially, and make the servo go to as close as possible. now google a method to take the value from the circuit inside the calipers, and use it as input and display it. YOU HAVE THE DIAMETER! (I know the last one is shit)

let me know if it worked for you! Good Luck!


  • \$\begingroup\$ Unfortunately I can only mark one answer, but your idea about using 2 distances to get the diameter is great! Thanks! \$\endgroup\$
    – Leonti
    May 11, 2017 at 22:31

I would use an IR distance finder with your cone such as the Sharp GP2Y0A41SK0F that has an analog output and works off 5v supply so is quite easy to interface to. It's very good at measuring distances close to (but needs to be above 4cm). It is also fast, compact, light weight, low power, reliable, and has no moving parts.

Side note: a cone is bulky, perhaps would be more portable to just use a V-shape made from 2 rods - although then weighing would be tricky.


Hey this is a good question. Completely useless in the real world but nice for a school kid to overcome.

The problem with your proposal is measuring the weight of juice content based on circumference alone gives too greater +/- tolerance to prove effective. How many oranges have you seen perfectly round?

The simplest method and possibly the most precise would be water displacement with a level probe. Include buoyancy prevention and stick the whole thing on a load cell. Portability may be a burden in today's society nevertheless its achievable.

Theres obviously no real life application to such a device, I mean if you cant tell a good orange from a bad one using the senses of most abled bodies, you shouldnt be eating oranges.

  • 1
    \$\begingroup\$ The simplest method for a handheld device would be to use water displacement? I'm pretty sure that's not the simplest, no matter the exact application. He does not need the specific gravity to four levels of precision - just needs a back-of-the-envelope method to get a rough idea. How many oranges have you seen which are not close enough to spherical for his method to prove sufficiently accurate? He even said he's already built a similar device years ago. You then proceed to criticize the OP's project after he specifically cited a real-world need which catalyzed it. Just...wow. \$\endgroup\$
    – tjbtech
    May 10, 2017 at 2:05
  • 1
    \$\begingroup\$ Welcome to Stackechange Rick. Please remove the trouble making paragraphs at the beginning an end. The other two paragraphs are constructive enough, though you could add some ideas how to actually measure the water displacement. \$\endgroup\$ May 10, 2017 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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