Skip to content

Project Progress

In week 4 we continue working on Input and Output until I barn the motor. After that we continue search about best method to measurement the water.

Input and Output

I program the Arduino Nano the motor witch behave as pump to run for 5000 ms time then for 25000 ms (25 s) to have 1 ml and if we calculate the flow rate it shod be 25s x 5= 125 s but when we test it give us above 5 ml so we test for lower time after that we fide 120 s to give us 5 ml.

By Using the Syringe

For 1 ml the motor will run 25 s

For 5 ml the motor will run 120 s

By using the Smart Weigh

To measurement the amount of fluid by using v = m/p and for density (p) of water is 1.03 g the

1 ml

1.2/1.03 = 1.16 ml

5 ml

The Circuit

Just for remine you we use Arduino Nano connected with Motor Driver (L298N) concocted with motor and 5 V power splay. For 1 ml we use yellow pushbutton and for 5 ml we use red pushbutton

The Code

#define MotorIN1 4   // input1 is connected to d4
#define MotorIN2 5   // input2 is connected to d5
#define ENA 3

int button = 0;// variable for the button
int antState1 = 0;// variable for the anterior state of the button
int buttonOff1 = 0;// 0 = dc motor ON, 1 = dc motor OFF
int antState2 = 0;// variable for the anterior state of the button
int buttonOff2 = 0;// 0 = dc motor ON, 1 = dc motor OFF
int button1 = 10;
int button2 = 11;



void setup() {
  // MotorIN1 and MotorIN2 are Initialized as Output
  pinMode(MotorIN1, OUTPUT);  
  pinMode(MotorIN2, OUTPUT);
  pinMode(button1, INPUT);// BUTTON as INPUT
  pinMode(11,INPUT);// BUTTON as INPUT

}


void loop() {
    int buttonState1 = digitalRead(button1);

   if(buttonState1 == 1){
  digitalWrite(MotorIN1, HIGH);
  digitalWrite(MotorIN2, LOW);
  delay(25000);

   }

  else {
    digitalWrite(MotorIN1, LOW);
    digitalWrite(MotorIN2, LOW);
  }


 int buttonState2 = digitalRead(button2);

   if(buttonState2 == 1){
  digitalWrite(MotorIN1, HIGH);
  digitalWrite(MotorIN2, LOW);
  delay(120000);

   }

  else {

    digitalWrite(MotorIN1, LOW);
    digitalWrite(MotorIN2, LOW);
  }



}

Compare Between the syringe and Smart Weigh

As you can see we have different between the syringe measurement and Smart Weigh measurement. So we calculate the error between them by but 5 ml of water measurement by syringe to the Smart Weigh

so the error between the syringe measurement and Smart Weigh measurement is ((5.048-5)/5)x100= 0.96% and the error is acceptable if it lower than 5% .


Last update: August 14, 2023