My project is not working (im a newb)

can someone help me check if my wiring is the same as the circuit diagram,im using flex sensors to detect how much they’re bent, and the Arduino uses that to tell the DFPlayer which sound to play on the speaker. but when i bend my flex sensors,nothing is happening please help me i have a competition in a 2 days so any help is appreciated

Welcome to the forum

Please post your full sketch, using code tags when you do

Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Have you tried printing the values returned when you read the force sensors ?

You need to use a higher value resistor 20K to 50K
You can only bend those sensors in one direction

// Left glove demo - flex sensors -> DFPlayer mini
// Assumes:
// B (thumb)  -> A0 -> plays track 10 (010.mp3 "Hello")
// F (index)  -> A1 -> plays track 6  (006.mp3 "How are you")
// G (middle) -> A2 -> plays track 8  (008.mp3 "Thank you")
// H (ring)   -> A3 -> plays track 9  (009.mp3 "Please")
// I (pinky)  -> A4 -> plays track 7  (007.mp3 "Help me")

#include <SoftwareSerial.h>
#include "DFRobotDFPlayerMini.h"

SoftwareSerial dfSerial(9, 10);  // DFPlayer TX -> pin 9, DFPlayer RX -> pin 10
DFRobotDFPlayerMini dfplayer;

const int sensorCount = 5;
const int sensorPins[sensorCount] = { A0, A1, A2, A3, A4 };

// thresholds (your measured mid values)
const int thresholds[sensorCount] = {
  180,  // B (thumb)
  150,  // F (index)
  299,  // G (middle)
  198,  // H (ring)
  204   // I (pinky)
};

// corresponding DFPlayer track numbers
const int tracks[sensorCount] = { 10, 6, 8, 9, 7 };

bool lastBent[sensorCount];
unsigned long lastPlayMs = 0;
const unsigned long cooldownMs = 1000UL;  // 1 second minimum between plays

void setup() {
  Serial.begin(9600);
  dfSerial.begin(9600);
  Serial.println("Left glove starting...");
  if (!dfplayer.begin(dfSerial)) {
    Serial.println("DFPlayer init failed. Check wiring & SD card.");
    while (true) { delay(200); }
  }
  dfplayer.volume(22);  // 0..30
  // init last states by reading current values
  for (int i = 0; i < sensorCount; i++) {
    int v = analogRead(sensorPins[i]);
    lastBent[i] = (v < thresholds[i]);  // your sensors: bent => value < threshold
  }
  delay(200);
}

void loop() {
  // read all sensors
  int vals[sensorCount];
  bool bent[sensorCount];

  for (int i = 0; i < sensorCount; i++) {
    vals[i] = analogRead(sensorPins[i]);
    bent[i] = (vals[i] < thresholds[i]);  // bent if reading below threshold
  }

  // debug print
  Serial.print("Vals: ");
  for (int i = 0; i < sensorCount; i++) {
    Serial.print(vals[i]);
    if (i < sensorCount - 1) Serial.print(", ");
  }
  Serial.println();

  // check for new bends (straight -> bent)
  for (int i = 0; i < sensorCount; i++) {
    if (bent[i] && !lastBent[i]) {
      // just changed to bent
      if (millis() - lastPlayMs > cooldownMs) {
        Serial.print("Finger ");
        Serial.print(i);
        Serial.print(" bent. Play track ");
        Serial.println(tracks[i]);
        dfplayer.play(tracks[i]);
        lastPlayMs = millis();
      } else {
        Serial.println("Cooldown active, skipping play");
      }
    }
    lastBent[i] = bent[i];
  }

  delay(120);  // small delay
}

I’ve checked the flex sensor values individually, and they work fine, but once everything is connected in the glove setup with the DFPlayer Mini, the readings don’t seem to register correctly. I’m not sure if it’s a wiring issue or something else.

How did you select the thresholds?

I selected the thresholds by first measuring the readings from each flex sensor. I recorded the values when the sensor was straight and when it was fully bent, then chose a number roughly in between as the threshold for detecting a bend.

What does it show as an output.

When you increase that delay a bit something that doesn't completely flood the Serial monitor ?

No, sorry, not from a video and not with all that spaghetti wiring.

Connect everything you can directly to the breadboard.

Get another breadboard if needed and clip them together.

Use solid-core hookup wire, cut to length and laid flat to the breadboard for as many connections as possible. Use flexible wires only for minimum of components that can't be directly connected to the breadboard.

Use several colours of wire and be consistent with the colours. Reserve red for 5V and black for ground.

Take photos that are bright and clear, from directly above the circuit.

Something like this:

Then we may be able to check the wiring for you!

I’ll try increasing the delay a bit to see

Well the wiring is correct but what do you mean by nothing is happening.
If you were able to measure the ADC values, and select the thresholds then the sensors seem to be working OK

Complicated code for "newb".
Did you wrote it yourself?

nope i got it from github and adjust what is necessary

@belle1_1
Your code uses A0 to A4 but you are connected to A1 to A5

wht i meant was,when i bend the flex sensor,the speaker should play the mp3 but rn i tried w a new code and only was flex sensor is doing something so for now im trying to fix the flex sensor and adjust the coding bit thank you..

See post #14

OH.. i see ,thank you for pointing out that mistake..

Does it work now?

yess it does! just need a lil bit more work but its working now,thank you all!! appreciate all the helpp

Have fun!