# What sensors to use to read gym machine selected weight [duplicate]

This question already has an answer here:

I'm trying to find a set of sensors (to build a solution) to determine how many weight blocks an athlete is lifting on the weight machine like this:

I already tried this solutions:

1. Put RFID tag on each weight block and set a RFID reader a little bit above the top block. The idea was that when blocks are moving up, the RFID reader would know what blocks were lifted just by comparing how many unique RFIDs were detected in a sequence. The problem with such approach was that RFID reader was skipping some of the RFID tags (probably because weight blocks were lifted too fast so that RFID reader couldn't keep up).

2. Attach ultra sonic sensor (Sensor_1) (https://www.sparkfun.com/products/13959) on top of the block weights stand and other ultra sonic sensor (Sensor_2) on the side as shown in the picture:

Sensor_1 is facing down. Sensor_2 is attached to a helper stand as is facing horizontally to the side of the block weights stand. The idea was that when user starts lifting the weights, at some point Sensor_2 detects a weight block (that is horizontally at the same height), Sensor_1 remembers the distance (Distance_1) to the top block weight. When Sensor_2 shows there is no block at the same height anymore, Sensor_1 checks the current distance (Distance_2) to the top block again and then it calculate the number of blocks by the following formula (Formula_1):

number_of_blocks = (Distance_1 - Distance_2) / height_of_1_block_weight , where height_of_1_block_weight = 4 cm, Distance_1 ~= 115 cm, Distance_2 < 115 cm

The problem with such approach was that ultrasonic doesn't measure distance to the point (like a ray), but there is a wave with a 15 degree angle instead and therefore we have issues with wave reflection from other objects (block weights stand or other stuff)

1. We tried the same approach as #2, but with IR sensors (https://www.pololu.com/product/1137). It doesn't give accurate distance because the sensor measurement error sometimes is more than 5 cm so the Formula_1 doesn't give expected output. Also, the sensor has 25 Hz limitation so if you lift the weights quick, it will skip distances > 3.2 cm (80 cm / 25 measurements a second).

The only way left that I see is to attach a camera and analyze the output image on the software layer...

Please, let me know if you have any other ideas or if you see a gap in the solutions that I specified. Thank you!

## marked as duplicate by Dmitry Grigoryev, JRE, winny, Matt Young, RedGrittyBrickJan 8 '18 at 22:13

• Is it okay if the measurement only works in a lifted state? – DonQuiKong Jan 8 '18 at 10:58
• Instead of the rfid reader, use QR codes. Or gray code stickers and a few photodetectors. – PlasmaHH Jan 8 '18 at 12:19
• Put a strain gauge at the bottom of the stack, when the weights are lifted up subtract the lifted weight from the total weight. Easy peasy – laptop2d Jan 8 '18 at 22:53
• @DonQuiKong Thank you for asking. Yes, it's ok to measure only in a lifted state! – Leonid Kokhnovych Jan 10 '18 at 8:06

3 come to mind.

An IR encoder as RoyC mentioned. Paint the back or sides of the weights alternating white and black.

A camera as you already mentioned. OpenCV would make quick work of this. And You can do it at a distance without touching anything on the machine.

And the last option is an actual weight sensor. A load cell placed under the weights. When the selected weights are lifted, the load cell will show a negative change equal to the weight that was removed upwards.

• A load cell configured as described is a great idea. Are these robust enough to tolerate very high transient loads? – RoyC Jan 8 '18 at 9:58
• Sure are. If you pay for them. A dollar store ebay webcam and a cheap plug computer (Raspberry pi) is much cheaper though. And safer. Not modifying or introducing anything to the machine is the best course of action. – Passerby Jan 8 '18 at 10:01
• @RoyC: you can get load cells rated in the tons. Think about what is used to measure the weight of trucks. For example: omega.com/pptst/LCCD.html – whatsisname Jan 8 '18 at 17:41
• A load cell on the pulley indicated "sensor 1" would experience much smaller transients compared to underneath the entire stack. load cells are a bit foreign to people who don't have much experience with them, but they are dead simple and well worth the reduced time investment. – Aaron Jan 8 '18 at 21:49
• @RoyC, I worked with a load cell that could handle transient loads upwards of 30 tons (think: trailer hitch failing under load). We had to get the calibration checked after any event outside the 30-ton rating, but it never had any problems. – Mark Jan 8 '18 at 23:34

I would look at it from a different angle and try to detect in which slot the metal pin is placed.

This is an easier task and could be done in several ways such as using proximity sensors or micro switches. These could be wired to a micro controller and thus you could detect the amount of weight blocks lifted.

This is just an idea for a possible way forward. Designing circuitry would be a different question.

• These pins typically have a large, often brightly coloured handle on them, which could be picked up by a camera – Chris H Jan 8 '18 at 12:00
• Most pins used in gyms are black as far as I remember... – John Smith Jan 8 '18 at 12:01
• mine are yellow knobs with chrome pins – Passerby Jan 8 '18 at 20:01

Put a small infra red reflector on each block and arrange these in a vertical line. Your sensor set up is an IR illuminator and a directional IR sensor (photo-diode or transistor in a tube) mounted to line up with the reflectors just above the top block at rest. You need to amplify the output from the photo detector and set the detection threshold so that it gives an output only for the reflectors. This will give a chain of pulses which you can count to give you the number of blocks passing.

This can be made to work at very high frequencies so no problem with speed.

Small cheap magnets on the weight block and two hall sensor facing the magnets. The first sensor needs to be a little above(the gap between the blocks) the height of the top magnet and 2nd one exactly facing the top magnet. Count trigger in the first one to check how many weights have been lifted. And when the 2nd sensor is trigger and first one is not, the weights are at rest.

Looking at the top arm, I'd suggest a strain gauge. It's a very simple component, which you can glue directly on top.

You may need to smooth the measured values a bit, as the strain depends on the force bending the top bar. And while that's exactly the gravitational force in the stationary situation, when exercising the weights accelerate up and down so you need to use the average force.

I'm not sure what kind of time/effort you're willing to invest into this, or how elegant of a result you're lookign for, but here's a cheap/simple simple approach, which amounts to creating a switch between every pair of plates.:

• Tape aluminum foil contacts on the top and bottom of each plate, in a consistent location so that each contact touches the one of the plate next to it.
• Connect each plate's bottom wire to a common wire.
• Connect each plate's bottom wire to a separate digital IO pin.
• Count how many plates there are by how many wires are connected to the common.
• To save on IO pins, you could even use a priority encoder to use ceil(log_2(number_of_plates)) pins.

On the downside, this will look janky, will only be able to tell the weight while it's in motion, and it might break with use. But on the bright side, it's cheap, simple, and you probably already even have all the parts you need to get a working prototype