roshan-baig
Published © GPL3+

Multiple Sensor Station

This has several different sensors and it displays them on a LCD.

IntermediateShowcase (no instructions)3,589
Multiple Sensor Station

Things used in this project

Hardware components

Temperature Sensor
Temperature Sensor
×1
Tilt Sensor, SPST-NC
Tilt Sensor, SPST-NC
×1
Arduino UNO
Arduino UNO
×1
Through Hole Resistor, 1 kohm
Through Hole Resistor, 1 kohm
×6
6 pin gas sensor
×1
Grove - Round Force Sensor (FSR402)
Seeed Studio Grove - Round Force Sensor (FSR402)
×1
Photo resistor
Photo resistor
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Flex Sensor
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Tinkercad
Autodesk Tinkercad

Story

Read more

Schematics

This is the circuit diagram

Just copy this, sorry for the messy connections.

Code

the code

C/C++
If you followed the diagram, paste the code
#include <LiquidCrystal.h>

LiquidCrystal lcd(13,12,11,10,9,8);

const int r = 1000;
const float flatResistance = 37300.0;
const float bendResistance = 90000.0;
unsigned long fsrV;
unsigned long fsrC;
unsigned long fsrR;
long Force;
void setup()
{
  lcd.begin(16,2);
  lcd.home();
  Serial.begin(9600);
  pinMode(A4, INPUT);
  pinMode(6, INPUT);
  pinMode(A5, INPUT);
}
void loop()
{
  int flex = analogRead(A1);
  float Vflex = flex * 5 / 1023.0;
float Rflex = r * (5 / Vflex - 1.0);
  float angle = map(Rflex, flatResistance, bendResistance, 0, 90.0);
  lcd.clear();
  lcd.print("Flex:  ");
  lcd.print(angle);
  delay(3000);
  int gas = analogRead(A0);
  Serial.println(gas);
  if(gas > 100)
  {
    lcd.clear();
    lcd.print("There's gas!!!!!!!!!");
    delay(3000);
  }
  float temp = (analogRead(A2)*5.0f/1024 - 0.5) / 0.01;
  lcd.clear();
  lcd.print("Temp: ");
  lcd.print(temp);
  delay(3000);
  int light = analogRead(A5);
  if(light < 10)
  {
    lcd.clear();
    lcd.print("It is dark");
    delay(3000);
  } else
  {
    lcd.clear();
    lcd.print("It is light");
    delay(3000);
  }
  int tilt = analogRead(6);
  lcd.clear();
  lcd.print("Tilt: ");
  lcd.print(tilt);
  delay(3000);
  int fsr = analogRead(A4);
  fsrV = map(fsr, 0, 1023, 0, 5000);
  lcd.clear();
 lcd.print("MV: ");                                        
  lcd.print(fsrV);
  delay(3000);
  fsrR = 5000- fsrV;
  fsrR *= 1000;
  fsrR /= fsrV;
  lcd.clear();
  lcd.print("Ohms: ");
  lcd.print(fsrR);
  delay(3000);
  fsrC = 1000000;
fsrC /= fsrR;
  
Serial.print("Conductance in microMhos: ");
Serial.println(fsrC);
  lcd.clear();
  lcd.print("mMhos: ");
lcd.println(fsrC);
  delay(3000);
  if (fsrC <= 1000) {
Force = fsrC / 80;
    lcd.clear();
    lcd.print("Force: ");
    lcd.print(Force);
    delay(3000);
Serial.print("Force in Newtons: ");
Serial.println(Force);
} else {
Force = fsrC - 1000;
Force /= 30;
    lcd.clear();
    lcd.print("Force: ");
    lcd.print(Force);
    delay(3000);
Serial.print("Force in Newtons: ");
Serial.println(Force);
}
Serial.println("--------------------");
delay(1000);
}

Credits

roshan-baig
5 projects • 7 followers

Comments