So i have make the simple one, and this is the arduino code
int ml;
int nyala;
int input;
int dc_pin = D1;
void setup() {
pinMode(dc_pin, OUTPUT);
Serial.begin(115200);
}
void loop() {
input = Serial.parseInt();
ml = input/10;
nyala = ml * 500;
if(nyala == 500){
digitalWrite(dc_pin, LOW);
delay(500);
MotorStop();
}
else if(nyala == 1000){
digitalWrite(dc_pin, LOW);
delay(1000);
MotorStop();
}
else if(nyala == 2000){
digitalWrite(dc_pin, LOW);
delay(2000);
MotorStop();
}
}
void MotorStop(){
digitalWrite(dc_pin, LOW);
digitalWrite(dc_pin, LOW);
}
The ml is the formula to calculate how many liquid must use following the input.
And nyala is how long the peristaltic pump have to turn on.