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

Arduino UNO Based Flex Sensor Monitoring System with Bluetooth and I2C LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Flex Sensor Monitoring System with Bluetooth and I2C LCD Display

Circuit Documentation

Summary

The circuit in question is designed around an Arduino UNO microcontroller, which interfaces with various components including a Bluetooth module (HC-06), an I2C LCD 16x2 screen, and multiple resistors including three Basic Flex Resistors and three standard resistors. The Arduino UNO is programmed to read analog inputs and control outputs based on these readings, displaying messages on the LCD and communicating via Bluetooth.

Component List

Arduino UNO

Basic Flex Resistor

HC-06

Resistor (200 Ohms)

I2C LCD 16x2 Screen

Wiring Details

Arduino UNO

Basic Flex Resistor

HC-06

Resistor (200 Ohms)

I2C LCD 16x2 Screen

Documented Code

#include "SoftwareSerial.h"
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // RX, TX
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address, 16 columns, 2 rows

// Define LED pins
#define blue 2
#define green 3
#define red 4

// Variables for sensor readings
unsigned int f;
unsigned int g;
unsigned int h;

void setup() {
  // Set LED pins as outputs
  pinMode(blue, OUTPUT);
  pinMode(green, OUTPUT);
  pinMode(red, OUTPUT);
  
  // Initialize serial communication
  Serial.begin(9600);
  mySerial.begin(9600);
  
  // Initialize LCD
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("  Welcome To");
  lcd.setCursor(0, 1);
  lcd.print("JustDoElectronic");
  lcd.clear();
  delay(3000);
}

void loop() {
  // Read analog values from flex sensors
  f = analogRead(1);
  g = analogRead(2);
  h = analogRead(3);

  // Check sensor values and act accordingly
  if (f <= 722) {
    digitalWrite(blue, HIGH);
    digitalWrite(green, LOW);
    digitalWrite(red, LOW);
    mySerial.println("Plz Give Me Water");
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("  Plz Give Me");
    lcd.setCursor(0, 1);
    lcd.print("     Water   ");
    delay(3000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" If Anything");
    lcd.setCursor(0, 1);
    lcd.print("  You Want ");
  }
  else if (g <= 670) {
    digitalWrite(green, HIGH);
    digitalWrite(blue, LOW);
    digitalWrite(red, LOW);
    mySerial.println("Plz Give Me Food");
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("  Plz Give Me ");
    lcd.setCursor(0, 1);
    lcd.print("     Food   ");
    delay(3000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" If Anything");
    lcd.setCursor(0, 1);
    lcd.print("  You Want ");
  }
  else if (h <= 675) {
    digitalWrite(green, HIGH);
    digitalWrite(blue, LOW);
    digitalWrite(red, LOW);
    mySerial.println("Plz Give Me Tea");
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("  Plz Give Me");
    lcd.setCursor(0, 1);
    lcd.print("     Tea   ");
    delay(3000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" If Anything");
    lcd.setCursor(0, 1);
    lcd.print("  You Want ");
  }
  else {
    // No action required
  }
  delay(200);
}

This code is designed to read sensor inputs and display messages on the LCD screen as well as send messages via Bluetooth depending on the sensor values. It also controls three LEDs, presumably for visual indication.