zazo725
Published

Chocolate Milk Machine (Circuit)

This project takes cocoa powder and makes chocolate milk when a cup is placed underneath it. And, a screen dictates the status.

IntermediateWork in progress233
Chocolate Milk Machine (Circuit)

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Male/Male Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Schematics

Connect the wires as shown

Code

code

Arduino
its code
#include <Servo.h>
Servo servo_9;
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

long readUltrasonicDistance(int triggerPin, int echoPin)
{
  pinMode(triggerPin, OUTPUT);  // Clear the trigger
  digitalWrite(triggerPin, LOW);
  delayMicroseconds(2);
  digitalWrite(triggerPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(triggerPin, LOW);
  pinMode(echoPin, INPUT);
  return pulseIn(echoPin, HIGH);
}

void setup()
{
  servo_9.attach(9, 500, 2500);
  
  lcd.begin(16,2);
  
  lcd.print("Insert Milk");

}

void loop()
{
  0.01723 * readUltrasonicDistance(7, 6);

  if (0.01723 * readUltrasonicDistance(7, 6) < 8){
    lcd.clear();
    lcd.print("Processing...");
    servo_9.write(180);
    delay(1000);
  }
  else{
    lcd.clear();
    lcd.print("Insert Milk");
    servo_9.write(0);
    delay(1000);
  }
}

Credits

zazo725
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.