Flex sensor not reading after re-soldering

Hi everyone,

So I'm using an Arduino UNO to build a circuit that will have a flex sensor detect changes in stomach circumference and at a certain threshold, will set off a vibration motor and LED simultaneously. The circuit looks like this (using 10k resistor for flex sensor and 1k for LED):

The code looks like this

[/*
  Code to control vibration motor with flex sensor
  Includes calibration on startup
*/

// declare pins
const int motorPin = 8;
const int sensorPin = A1;

// sensor variables
int sensor;           
int flexMin = 1023;   // high initial value
int flexMax = 0;      // low initial value
int threshold;        // will be calculated after calibration

const int n = 1;      // number of purr cycles
int i;                // counter for purring loop

void setup() {
  pinMode(motorPin, OUTPUT);
  Serial.begin(9600);  
  

  Serial.println("Calibrating flex sensor for 5 seconds...");
  unsigned long startTime = millis();
  
  // Calibration loop: 5 seconds
  while (millis() - startTime < 5000) {
    sensor = analogRead(sensorPin);
    if (sensor < flexMin) flexMin = sensor;
    if (sensor > flexMax) flexMax = sensor;

    Serial.print("Calib Reading: ");
    Serial.println(sensor);
    delay(50); // small delay to limit reads
  }

  // Set dynamic threshold (50% between min and max)
  threshold = flexMin + 0.5 * (flexMax - flexMin);
  
  Serial.println("Calibration complete!");
  Serial.print("Min: "); Serial.println(flexMin);
  Serial.print("Max: "); Serial.println(flexMax);
  Serial.print("Threshold: "); Serial.println(threshold);
}

void loop() {
  sensor = analogRead(sensorPin);

  // Print live sensor data to Serial Monitor
  Serial.print("Live Reading: ");
  Serial.println(sensor);


  if (sensor > threshold) {
    Serial.println("Threshold exceeded! Motor purring...");
    i = 0;
    while (i < n) {
      digitalWrite(motorPin, HIGH);
      delay(500);
      digitalWrite(motorPin, LOW);
      delay(500);
      i++;
    }
  }

  delay(100); // smooth out reads
}
]

Everything worked fine until the soldering for one of the ends on the flex sensor broke off, and I had to re-solder it. The soldering job was done well enough, but when I set-up the circuit again, my live readings from the flex sensor just came out to "0", with no amount of flexing changing this value. I thought the resistor might not be enough, so I switched out the 10k for a 47k, but the readings still remained inaccurate. Any ideas? Thanks so much for anyone who stumbles across this :frowning:

  1. it worked
  2. it broke
  3. it did not work
  4. it was fixed
  5. it still does not work

Repeat step 4 until true.

Also, running a vibration motor from a DIO pin will cause problems from feedback into the DIO pin.

Read here. Arduino Vibration Motor Code, Circuit, Control (Tutorial)

1 Like

Show a picture, well-lit, of your solder job - both sides if applicable.

1 Like

You broke it. Buy a new one. Those flexible PCBs are not very robust and almost impossible to fix.

You get a reading of zero because your flex sensor now looks like a short circuit. Nothing can be done by changing the external resistor because your sensor is a short circuit.

1 Like

Guess it was a job NOT done well enough. Follow @Grumpy_Mike suggestion and get a new one.