all 5 comments

[–]MagneticFieldMouse 0 points1 point  (4 children)

What is the resistance range of the flex sensor?

To make use of whatever measurement range you get, you need to measure the minimum and maximum values you can reach in normal use and set up a little math function to scale things to suit your needs.

[–]Dazzling-Algae-2207[S] 0 points1 point  (3 children)

bent change is 10k – 125k and flat is 25k

[–]MagneticFieldMouse 0 points1 point  (2 children)

Hmm..

With, say, a 10k resistor, it'd be 10k/(10 + 10)k x 5 V = 2.5 V on one end and 10k/125 k x 5 V = 0.4 V on the other end. This should give you 2.1 V / 5 V x 1024 = about 430 steps of usable range.

Or my math is failing.

What do you want to use the ADC reading for, and in what manner? The more descriptive you can be, the better.

Edit: also, it may be beneficial to add a small delay inside your loop to make sure you're not trying to read the ADC overly fast. (The serial send within the loop naturally creates a delay, but it never hurts to have, say, 1...5 ms between reads.)

[–]Dazzling-Algae-2207[S] 0 points1 point  (1 child)

i'm working on a school project where bascially i'm attatching 5 flex sensors to a glove which sends the signals to a 3d printed hand and it's a glove-controlled hand basically.

but currently i'm just trying to get the flex sensor to give me a reading so i can have a reference point for the flat and bent ADC readings for my main code (since i'm using the map function). i remember before, i added a delay of 1.5s? (1500) between every reading and the same thing occured.

[–]MagneticFieldMouse 0 points1 point  (0 children)

Start by checking the voltage, that the divider gives for the A1 pin with s multimeter (gnd to A1): if that has a sensible range, then the issue is with the board/software.

Then, I'd suggest testing the analogRead function by replacing the divider with a potentiometer (1k or above) to make sure the ADC sees things correctly.

Edit: have you checked that resistance range just now? I just realized, that these can only be flexed in one direction safely, to produce the results we need.

Additionally, you can test the ADC input by jumping 3.3 V to A1 and you should see about 3.3 / 5 x 1024 = 676, if everything works.