Thursday, July 9, 2015

Food Detector with Arduino

Hi guys!Today I am going to show you how to make your own food detector by measuring foods resistance.



The parts we need
---------------------------
-Arduino
-Jumper Wires
-FOOD❤❤❤❤(I used cucumber and red plum)
-LCD
-10k ohm Potentiometer
-10k ohm Resistance
---------------------------

And here is a diagram of our circuit

The probes are just simple wires or you can use little metal rods.
And our code
---------------------------
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int sensorVal = A0;
void setup() {
  // put your setup code here, to run once:
  lcd.begin(16, 2);
  lcd.print("Food Detect:");
  Serial.begin(9600);
}

void loop() {

    int sensor = analogRead(sensorVal);
    delay(200);
    lcd.setCursor(0, 1);
    if (sensor<10)
    {
      lcd.print("No Food");
      lcd.print("          ");
    }
    else if(sensor<400 & sensor>280)
    {
      lcd.print("Cucumber");
      lcd.print("          ");
    }
    else if(sensor<279 & sensor>100)
    {
      lcd.print("Red Plum");
      lcd.print("          ");
    }
    
    Serial.println(sensor);

    }
---------------------------
Some pictures about my circuit








Yes it's that simple guys.Ask me anything in the comment section.^-^ See you later in 
another tutorial ^-^

















No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...