Go Down

Topic: Cooking oil dispensing machine (Read 2225 times) previous topic - next topic

Kenneth2018

Hello need HELP
I was looking towards a project using arduino microcontroller that involves a normal disperser like the milk,soda.... But to be precise its dispenses cooking oil..Back here in my country they are becoming economics of scale and would love to have a code that I can use in the dispenser
The code is supposed calculate and give exact time of disperse in accordance to volume to be dispensed per price input using a keypad,also can have changeable price per liter and can calculate flow rate...sorry for the hustle

AWOL

"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Kenneth2018

I need help guys have been working on this code for my project I wrote about(oil dispenser)
Compile was successful but seems not functioning as per the code..the flow is.user puts password,after acknowledge then the user puts the price of choice, then arduino calculate time for disperse and quantity to be dispersed according to this formula [price = quantity*rate(rupees per liter)]/1000 and [time= quantity/flow rate(ml/s)



Code: [Select]


<//
#include "SPI.h"
#include <LiquidCrystal.h>
#include <Arduino.h>
#include <Password.h>

#include <Keypad.h>

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

Password password = Password( "7877" );
int currentPosition = 0;
byte datacount = 0;
bool passGood = 0;

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = { 0, 1, 2, 3};
byte colPins[COLS] = { 7, 6, 5, 4};
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

int passwordcurrentPosition;
int displaycodeEntryScreen;
int price = 0;
int pumpControlPin = A5;
int dispenseType = 0;
int measurementType = 0;
int volumedispense = 0;
double time = 0.0;
bool dispenseAcknowledge = false;
bool Acknowledge = true;
byte rate = 0;
float volume = 0;
float volumemillilitres = 0;
float millilitres = 0;
unsigned long rateflow = 0;
unsigned long sales;
unsigned long seconds;       
bool invalidcode = false;
bool unlockkeypad = true;



void setup()
{
 Serial.begin(9600);
  lcd.begin(16, 2);
displaycodeEntryScreen;

pinMode(pumpControlPin, OUTPUT);
   
digitalWrite(pumpControlPin, LOW);

 
}

void loop(){

keypad.addEventListener(keypadEvent);

char key = keypad.getKey();
int l = 0;
  for(l = (key);;)
    {

    lcd.setCursor(0,0);
    lcd.print("*");
    lcd.setCursor(0,1);
     };
   }
  for( int l == 0; l<(currentPosition) l++ );{

   if(key == passwordcurrentPosition);{
     (++currentPosition);   
    }
   if(currentPosition == 2){
     unlockkeypad;
     currentPosition = 0;
       
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.print("ACCESS GRANTED");
   lcd.setCursor(0,1);
   lcd.print("WELCOME");
       
   delay:(5000);
    }
    else
    {
    invalidcode;
    currentPosition = 0;
       
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.print("INVALID CODE");
   lcd.setCursor(0,1);
   lcd.print("ACCESS DENIED");
     
   delay(5000);
   displaycodeEntryScreen;
     }
   }

void keypadEvent(KeypadEvent (eKey)){

    switch (keypad.getState())
    {case : ( PRESSED):
   Serial.print("Pressed: ");
   Serial.println(eKey);
   
int checkPassword;   
   
   switch (eKey){
     case '*': checkPassword; break;
     case '#': password.reset; break;
     default: password.append(eKey);
     }
  }
}



void checkPassword()
 {

  if(password.evaluate()){
    Serial.println("Success");
  }
       
char key = keypad.getKey();{
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("input price");
Serial.print("customkey");
Serial.println("customkey")
 
int volume();
 char customkey = keypad.getKey();
if(customkey){
  price == (customkey);
  volumemillilitres = customkey / rate * 1000;
     return;millilitres = 0;
     
long usigned;int delay();
  millilitres / rateflow;
   return;time = 0;
   
  pumpControlPin, HIGH;
  delay:(time);
  pumpControlPin, LOW;
               
  lcd.clear();
  lcd.setCursor(0,0);
 Serial.println("milliliters");
  lcd.print("milliliters");
 Serial.println("time");
  lcd.print("time");break;
 }

  switch:         
void setup();{
Serial.begin(9600);
lcd.setCursor(9, 1);
lcd.print("KEY");
lcd.print(key);

 if(key = 'A');{
   lcd.print("input rate");
    Serial.println("pressed");
    retun:rate;
            }
   
 if(key = 'B');{
   lcd.print("sales");
    Serial.print(sales);
                }
               
 if(key = 'C');{
   lcd.print("calibration mode");
   Serial.print("dispense");
                   
       switch ('Key'){
     case '*': dispenseAcknowledge = false; break;
     case '#': Acknowledge = true; break;             }
  }
 }
}else{
  pumpControlPin, HIGH;
  delay(5000);
  pumpControlPin, LOW;

      lcd.clear();
      lcd.print("enter vol dispense");
      Serial.println("volume dispense");
                       
   rateflow = delay / volume dispense;
       
    return;rateflow;}}
                    }
                   }
               
//_>>>>>

AWOL

#3
Jul 02, 2018, 01:43 pm Last Edit: Jul 02, 2018, 01:43 pm by AWOL
Code: [Select]
if(key = 'A');Did you ever see an if written like that?
There's a good reason for that, as you have found out.

Please remember to use code tags when posting code
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

AWOL

#4
Jul 02, 2018, 01:44 pm Last Edit: Jul 02, 2018, 01:46 pm by AWOL
Code: [Select]
long usigned;int delay();
  millilitres / rateflow;
   return;time = 0;

Nothing happens after a return.

You don't appear to do anything with your variable "usigned", and there is no need for a (incorrect) function prototype for "delay()"
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

KASSIMSAMJI

i have done exactly same project like yours , dispensing water instead of oil,

its a client-server based one meaning all the users info are stored on web database, PM me if you are interested
Electrical Engineer

Go Up