SSHS_CS_8반_2019_store management system

This is the management system that we can use in our school store.

IntermediateShowcase (no instructions)320
SSHS_CS_8반_2019_store management system

Things used in this project

Hardware components

Arduino Mega 2560 & Genuino Mega 2560
Arduino Mega 2560 & Genuino Mega 2560
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×2
HC-06 Bluetooth Module
×1
SparkFun Load Cell Amplifier - HX711
SparkFun Load Cell Amplifier - HX711
×2
Load Cell, Low Profile
Load Cell, Low Profile
×2
Grove - Variable Color LED V1.1
Seeed Grove - Variable Color LED V1.1
×1

Software apps and online services

Arduino IDE
Arduino IDE
MIT App Inventor
MIT App Inventor

Hand tools and fabrication machines

10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long

Story

Read more

Schematics

appinventor

schematics1 음료수 재고 관리

초음파 센서

schematics 2 과자 시스템

무게 센서

Code

음료수 캔 재고 관리

Arduino
#include <SoftwareSerial.h>

int triggerPin1 = 2;
int echoPin1 = 3 ;
int triggerPin2 = 4 ;
int echoPin2 = 5 ;
int RED=13;
int BLUE=11;
int GREEN=12;

void setup() 
{
  Serial.begin(9600);
  Serial.begin(9600);
  Serial.println("hello");
  Serial1.begin(9600);

  pinMode(triggerPin1, OUTPUT);
  pinMode(echoPin1,INPUT);
  pinMode(triggerPin2, OUTPUT);
  pinMode(echoPin2,INPUT);
  pinMode(13,OUTPUT);

  pinMode(RED,OUTPUT);
  pinMode(GREEN,OUTPUT);
  pinMode(BLUE,OUTPUT);
  

  /*scale.set_scale(2280.f);
  scale.tare();*/
}

void loop()
{
  int duration1;
  int duration2;

  float distance1;
  float distance2;

  int temp;
  
  digitalWrite(triggerPin1, HIGH);
  delayMicroseconds(10);
  digitalWrite(triggerPin1,LOW);

  duration1=pulseIn(echoPin1,HIGH);
  distance1 = (float)duration1 * 0.017;
  Serial.print(distance1);  


  digitalWrite(triggerPin2, HIGH);
  delayMicroseconds(10);
  digitalWrite(triggerPin2,LOW);

  duration2=pulseIn(echoPin2,HIGH);
  distance2 = (float)duration2 * 0.017;
  Serial.print(" ");
  Serial.print(distance2);
  Serial.print(" ");
  
  
  if(7<distance1&&distance1<11)
  {
    temp=4;
  }  
  if(13<distance1&&distance1<17)
  {
    temp=3;
  }
  if(19<distance1&&distance1<23)
  {
    temp=2;
  }
  if(25<distance1&&distance1<30)
  {
    temp=1;
  }
  if(30<distance1)
  {
    temp=0;
  }
  
  if(distance1<7)
  {
    temp=5;
  }
  if(temp==5)
  {
    if(distance2>27.6)
    {
      temp=5;
    }
    if(24<distance2&&distance2<27.6)
    {
      temp=6;
    }
    if(18<distance2&&distance2<21)
    {
      temp=7;
    }
    if(10<distance2&&distance2<15)
    {
      temp=8;
    }
    if(5<distance2&&distance2<10)
    {
      temp=9;
    }
    if(distance2<5)
    {
      temp=10;
    }
  }
  
  Serial.print(temp);
  Serial.print("\n");
  
  

  

 
  if(temp>=4)
  {
    digitalWrite(BLUE,HIGH);
    delay(500);
    digitalWrite(BLUE,LOW);
  }
  
  if(temp<4)
  {
    digitalWrite(RED,LOW);
    delay(50);
    digitalWrite(RED,HIGH);
    delay(50);
    digitalWrite(RED,LOW);
    delay(50);
    digitalWrite(RED,HIGH);
    delay(50);
    digitalWrite(RED,LOW);
    delay(50);
    digitalWrite(RED,HIGH);
    delay(50);
    digitalWrite(RED,LOW);
    delay(50);
    digitalWrite(RED,HIGH);
    delay(50);
    digitalWrite(RED,LOW);
    delay(50);
    digitalWrite(RED,HIGH);
    delay(50);
  }
  
  /*Serial.print(scale.get_units(), 1);
  scale.power_down();
  delay(5000);
  scale.power_up();
*/  
   if (Serial1.available())
  {
    Serial.write(Serial1.read());
  }
  
   if (Serial.available()) 
  {
      Serial1.println(temp);
  }
  
  
}

Snack admistrating.ino

Arduino
#include <HX711_ADC.h>
#include <EEPROM.h>

HX711_ADC LoadCell_1(4, 5);
HX711_ADC LoadCell_2(6, 7); 

const int eepromAdress_1 = 0;
const int eepromAdress_2 = 4;
long t;
int SnackCheck_1=0;
int SnackCheck_2=0;


void setup() {
  
  float calValue_1; 
  float calValue_2; 
  
  calValue_1 = 696.0; 
  calValue_2 = 733.0;
 
  Serial.begin(9600); delay(10);
  Serial.println();
  Serial.println("Starting...");
  LoadCell_1.begin();
  LoadCell_2.begin();
  long stabilisingtime = 2000;
  byte loadcell_1_rdy = 0;
  byte loadcell_2_rdy = 0;
  while ((loadcell_1_rdy + loadcell_2_rdy) < 2) { 
    if (!loadcell_1_rdy) loadcell_1_rdy = LoadCell_1.startMultiple(stabilisingtime);
    if (!loadcell_2_rdy) loadcell_2_rdy = LoadCell_2.startMultiple(stabilisingtime);
  }
 
  LoadCell_1.setCalFactor(calValue_1); 
  LoadCell_2.setCalFactor(calValue_2); 
  Serial.println("Startup + tare is complete");
}

void loop() {
  
  LoadCell_1.update();
  LoadCell_2.update();

  if (millis() > t + 250) {
    float a = LoadCell_1.getData();
    float b = LoadCell_2.getData();
    Serial.print("Load_cell 1 output val: ");
    Serial.print(a);
    if (a>10)
    SnackCheck_1=1;
    else
    SnackCheck_1=0;
     if (b>10)
    SnackCheck_2=1;
    else
    SnackCheck_2=0; 
    Serial.print("    Load_cell 2 output val: ");
    Serial.println(b);
    Serial.print("\n");
    Serial.print("   counts : ");
    Serial.println(SnackCheck_1+SnackCheck_2);
    t = millis();
  }
  
  if (Serial.available() > 0) {
    float i;
    char inByte = Serial.read();
    if (inByte == 't') {
      LoadCell_1.tareNoDelay();
      LoadCell_2.tareNoDelay();
    }
  }
delay(100);
}

Credits

1811송석원

1811송석원

1 project • 0 followers
1804김태윤

1804김태윤

1 project • 0 followers
장광재

장광재

29 projects • 15 followers
박다솜

박다솜

14 projects • 2 followers
1803김준서

1803김준서

1 project • 0 followers
박래오

박래오

1 project • 0 followers

Comments