Background…We are using a potentiometer to read the value of our claw position. Yesterday, the values returned to RobotC for position seemed to work fine with values in the typical published range for the sensor. Our wide open position value was around 2300 with closed near zero.
Issue…today the returned values for the sensor are limited to 0 to around 250 for the full range of the potentiometer. This is the case for 2 different sensors. The only thing that I know we changed was a firmware update on the cortex, but I don’t know why that would have made a difference.
Anyone have experience with this type of potentiometer problem? Suggestions for how to resolve the issue?
Sounds like you broke the sensor. You need to be very careful you don’t go beyond the sensor range. You said the range you used was 0-2300, so I suggest starting the sensor at a higher value. For example, closed near 500, open near 2800. This way, you’re certain you don’t over extend.
EDIT: Unless you meant all the sensors only return these values on your robot but work fine on others, then that’s a different story
You may be right, but I find it interesting that my spare sensor yields the exact same results. Unless, it is broken from a different time, which seems unlikely. If the sensor was broken, I wouldn’t have expected it to return any values.
My actual zero point was more like 150 to be sure that I didn’t overextend the range as you cautioned.
I don’t think the potentiometer has shifted. I have my spare potentiometer not mounted to anything and plugged directly into the cortex. Inserting an axle and twisting it also yields values between 0 and 256 as the one mounted to the robot does.
The values range from 0 - 250. If I twist to the very extreme side of one sensor the value jumps to 4095. The other one was giving me some ~2000 values, but now doesn’t exceed the ~200’s. I am thinking that perhaps both of these are bad given the erratic nature of these readings.
This may or may not be relevant, but back during our first year when we used EasyC, the online window showed our potentiometer reading from 0-300ish when the cortex was off, and then from 0-1024 when on.
I think I heard some kids from our teams complaining about the same thing, getting 0 - 200’s from the pots. I even wondered if they weren’t using some kind of code that was converting pot values to degrees since the readings looked somewhat lose. I’m interested to know if others have seen similar problems and what changed when this showed up. Maybe jpearman has some clues?
TL;DR connect and turn on the main cortex battery.
You have to use the main cortex battery for any of the sensors to work correctly. When the battery is connected the cortex will output 5V on the center pin of the three wire connector, the potentiometer acts like a voltage divider, the output will vary between 0V and 5V as it is turned. When there is no battery the input to the cortex “floats”, that is, whatever residual voltage created by the input to the cpu is used. When we sample this voltage we get a value of about 250 (on a 12 bit 0 to 4095 scale). As the pot is turned we gradually reduce this residual voltage and eventually connect the pin to 0V, hence we get readings that vary from 0 to 250.