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

Arduino UNO-Based Smart Request System with Flex Sensors and I2C LCD

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Request System with Flex Sensors and I2C LCD

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller interfacing with multiple resistors, flex resistors, and an I2C LCD 16x2 screen. The circuit is designed to read analog values from the flex resistors and display messages on the LCD screen based on the readings. The Arduino also communicates via a software serial interface.

Component List

Arduino UNO

Basic Flex Resistor

Resistor

I2C LCD 16x2 Screen

Wiring Details

Arduino UNO

Basic Flex Resistor

Resistor

I2C LCD 16x2 Screen

Code Documentation

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

SoftwareSerial mySerial(3, 2);
LiquidCrystal_I2C lcd(0x27, 16, 2);

#define blue 2
#define green 3
#define red 4

unsigned int f;
unsigned int g;
unsigned int h;

void setup() {
  pinMode(blue, OUTPUT);
  pinMode(green, OUTPUT);
  pinMode(red, OUTPUT);
  Serial.begin(9600);
  mySerial.begin(9600);
  Serial.println();
  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() {
  f = analogRead(1);
  g = analogRead(2);
  h = analogRead(3);

  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 {
  }
  delay(200);
}

This code initializes the LCD and sets up the pins for the Arduino. It reads analog values from the flex resistors and displays messages on the LCD based on the readings. The messages are also sent via software serial communication.