Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO and DFPlayer Mini-Based Smart Glove with LCD Display and Flex Sensors

View and Edit Project In Cirkit DesignerImage of Arduino UNO and DFPlayer Mini-Based Smart Glove with LCD Display and Flex Sensors

Circuit Documentation

Summary

This circuit is a "Smart Glove" system designed to detect finger movements using flex sensors and provide audio feedback through a DFPlayer Mini module and a speaker. The system also includes an LCD screen to display messages corresponding to the detected gestures. The entire setup is controlled by an Arduino UNO microcontroller.

Component List

  1. DFPlayer MINI

    • Description: Audio player module capable of playing MP3 files from a microSD card.
    • Pins: VCC, BUSY, RX, USB -, TX, USB +, DAC_R, K2/ADC_KEY, DAC_L, K1/ADC_KEY, SPK1, IO 2, GND, SPK2, IO 1
  2. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  3. LCD screen 16x2 I2C

    • Description: 16x2 character LCD display with I2C interface.
    • Pins: SCL, SDA, VCC, GND
  4. 2.2 inch Basic Flex Resistor

    • Description: Flex sensor used to detect bending.
    • Pins: Pin 2, pin 1
  5. Resistor

    • Description: 10k Ohm resistor.
    • Pins: pin1, pin2
  6. Speaker

    • Description: Audio output device.
    • Pins: +, -

Wiring Details

DFPlayer MINI

Arduino UNO

LCD screen 16x2 I2C

2.2 inch Basic Flex Resistor

Resistor

Speaker

Code Documentation

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

LiquidCrystal_I2C lcd(0x20, 16, 2);

// Pin definitions for DFPlayer Mini
SoftwareSerial mySerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

int flexSensor1 = A0; // Thumb
int flexSensor2 = A1; // Index finger
int flexSensor3 = A2; // Middle finger
int flexSensor4 = A3; // Ring finger
int flexSensor5 = A4; // Pinky finger

int threshold = 950;

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600); // DFPlayer Mini baud rate

  // Initialize LCD
  lcd.init();
  lcd.backlight();
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Smart Glove");
  delay(2000);

  // Initialize DFPlayer Mini
  if (!myDFPlayer.begin(mySerial)) {
    Serial.println("DFPlayer Mini initialization failed!");
    while (true);
  }
  myDFPlayer.volume(20); // Set volume level (0 to 30)
  Serial.println("DFPlayer Mini initialized.");
}

void loop() {
  int thumbValue = analogRead(flexSensor1);
  int indexValue = analogRead(flexSensor2);
  int middleValue = analogRead(flexSensor3);
  int ringValue = analogRead(flexSensor4);
  int pinkyValue = analogRead(flexSensor5);

  // Consider printing sensor values only when needed for debugging
  // Serial.print("Thumb: "); Serial.println(thumbValue);
  // ...

  checkFlexSensor(thumbValue, indexValue, middleValue, ringValue, pinkyValue);

  delay(500);
}

void checkFlexSensor(int thumb, int index, int middle, int ring, int pinky) {
  String message = "";
  int trackNumber = 0;

  if (thumb > threshold) {
    message = "I am Himanshi";
    trackNumber = 1;
  } else if (index > threshold) {
    message = "I want water";
    trackNumber = 2;
  } else if (middle > threshold) {
    message = "Can you be my friend?";
    trackNumber = 3;
  } else if (ring > threshold) {
    message = "Time for medicine";
    trackNumber = 4;
  } else if (pinky > threshold) {
    message = "Good night";
    trackNumber = 5;
  } else {
    message = "No gesture";
  }

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(message);

  Serial.println("Message: " + message); // Fixed error

  if (trackNumber > 0) {
    myDFPlayer.play(trackNumber); // Play the corresponding audio track
    delay(1000); // Allow time for the audio to play
  }
}

This code initializes the LCD and DFPlayer Mini, reads values from the flex sensors, and displays corresponding messages on the LCD. It also plays audio tracks based on the detected gestures. The checkFlexSensor function determines which message and audio track to play based on the sensor values.