Go Down

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

#### Kenneth2018

##### Jun 29, 2018, 08:40 am
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

#1
##### Jul 01, 2018, 04:01 pm
Do you have a question?
"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

#2
##### Jul 02, 2018, 01:39 pm
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>

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

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};

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;

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

pinMode(pumpControlPin, OUTPUT);

digitalWrite(pumpControlPin, LOW);

}

void loop(){

int l = 0;
for(l = (key);
{

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

(++currentPosition);
}
if(currentPosition == 2){
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);

delay(5000);
displaycodeEntryScreen;
}
}

{case : ( PRESSED):
Serial.print("Pressed: ");
Serial.println(eKey);

switch (eKey){
}
}
}

{

Serial.println("Success");
}

lcd.clear();
lcd.setCursor(0, 1);
lcd.print("input price");
Serial.print("customkey");
Serial.println("customkey")

int volume();
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 pmLast 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 pmLast 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

#5
##### Aug 03, 2018, 07:32 am
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