
THRESHOLD METHOD
Detecting change for infrared line sensor
Theory
Since the data from the setup we designed with the Infrared Line sensor was fairly clean, we decided to go with a tool called the threshold method to detect muscle flexes. The threshold method works similar to an analog to digital converter in that it outputs a 1 (or a flex) when below a certain value, and a 0 (or no flex) when above a certain value.
The flex zone is any point where the sponge compresses more than if the user were bending the arm normally without flexing. Therefore, a calibration method is used to determine the threshold by having a period of time where the user bends their arm in normal motion to determine the maximum compression the sensor reads without flexing.
Sensor Placement
Now it is appropriate to mention a challenge associated with the sensor. We found that placing the sensor on different parts of the arm made the sensor be affected differently by bending the arm. For example, when placed on the forearm, any bend past 90 degrees at the elbow causes the forearm to bulge - as shown in the picture below - and read as a flex.

Since we want the sensor to read independently from the bending at the elbow, we had to find an area that wouldn’t affect the velcro strap or sponge when the arm was bent. Since the main muscles that are deformed is the bicep and forearm, and in testing different parts of the arm, we found a sweet spot where the sensor was faced at the tricep and the velcro strap would avoid the main bulge of the bicep.

After finding a part of the arm where flexes in the tricep showed up more than any other movement of the arm, we came up with a calibration method that would determine the threshold. How it works is that during the first part of the calibration period, the user fully bends and unbends their arm without flexing the tricep. This determines Reflection max, or the minimum value that we know for certain where the user is not flexing. Then, the second part of the calibration the user straightens out their arm and flexes the tricep to give the value we call Reflection Min. This value is used so that we can determine the intensity of the flex and thus how fast the motors will be running in the prosthetic arm.
How Calibration Works (video):

Though fairly simple, the threshold method is very effective with this infrared sensor because the data coming from it is clean and consistent. Though this method cannot be used on every part of the arm, we are happy that we found a spot on the tricep that can be applicable to many who are without their forearm.
The link below is to the code that was used for the calibration:
