0% found this document useful (0 votes)
372 views10 pages

Cookie Vending Machine

The document describes a self-study report on a cookie vending machine project. The project uses an Arduino Uno, DC motor, keypad, and other components to build a vending machine that dispenses cookies based on unique input codes. The Arduino code uses input matrices to define variables and check input codes to activate the corresponding DC motor and dispense the cookie. The report concludes the vending machine provides a specified output based on unique inputs coded using the Arduino Uno microcontroller.

Uploaded by

James Brown
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
372 views10 pages

Cookie Vending Machine

The document describes a self-study report on a cookie vending machine project. The project uses an Arduino Uno, DC motor, keypad, and other components to build a vending machine that dispenses cookies based on unique input codes. The Arduino code uses input matrices to define variables and check input codes to activate the corresponding DC motor and dispense the cookie. The report concludes the vending machine provides a specified output based on unique inputs coded using the Arduino Uno microcontroller.

Uploaded by

James Brown
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

R.V.

College of Engineering, Bengaluru


(Autonomous Institution Affiliated to VTU, Belagavi)

Department of Electronics and communication

3rd Semester
Self-Study Report

Title:
Cookie vending Machine

Name: Samarth Jain BS

USN: 1RV20EC133
Cookie Vending Machine

Introduction:
In this project we will be looking at the design and working of a cookie
vending machine which is a device which gives a specified output
based on unique inputs. This input dependent logic is coded using an
Arduino Uno.
Components used:
To build our setup, we used the following components which are
easily available in stores:
 DC Motor
 Arduino Uno
 Wires
 LED
 Keypad
We also used the following software to build a simulation:
• TinkerCad software
• Arduino IDE software

DC Motor: A DC motor is an electrical machine that converts


electrical energy into mechanical energy. In a DC motor, the input
electrical energy is the direct current which is transformed into the
mechanical rotation. DC motors were the first form of motor
widely
used, as they could be powered from existing direct-current
lighting power distribution systems.

Arduino Uno: The Arduino Uno is an open-source microcontroller


board based on the Microchip ATmega328P microcontroller and
developed by Arduino.cc. The board is equipped with sets of digital
and analog input/output (I/O) pins that may be interfaced to
various expansion boards and other circuits. The board has 14
digital I/O pins which include six capable of PWM output (Pulse
Width Modulation, or PWM, is a technique for getting analog
results with digital means), 6 analog I/O pins. It is programmable
with the Arduino IDE via a type B USB cable. It can be powered by
the USB cable or by an external 9-volt battery, though it accepts
voltages between 7 and 20 volts.
We also used wires to connect the above components and finish
the circuit, we used the buzzer and LEDs to send the signals.
Keypad: We use this device in order to give our input values
to activate particular DC outputs. The button pressed gives a
high output which activates all other active high devices for
the vending machine to work.

Software used:
Arduino IDE: The Arduino Integrated Development Environment - or Arduino Software
(IDE) - contains a text editor for writing code, a message area, a text console, a toolbar with
buttons for common functions and a series of menus. It connects to the Arduino and
Genuine hardware to upload programs and communicate with them.

TinkerCad Software: Tinkercad uses a simplified constructive solid


geometry method of constructing models. A design is made up of primitive shapes
that are either "solid" or "hole". Combining solids and holes together, new shapes
can be created, which in turn can be assigned the property of solid or hole. In
addition to the standard library of primitive shapes, a user can create custom shape
generators using a built-in JavaScript editor.

System as Simulated in TinkerCad


Working:
As we know, in order to use Arduino Uno, we need to make the required connections as
seen in the previous slides and program the Arduino board to execute the required
commands. In order to do so, we use the Arduino IDE where we used the following code to
get the required output:

Code:
#include <Keypad.h>

#define codeLength 4

char code[codeLength];

byte keycount = 0;

char codeMotor1[codeLength]="11A";

char

codeMotor2[codeLength]="12A";

char codeMotor3[codeLength]="13A";

char

codeMotor4[codeLength]="14A";

const byte ROWS = 3;

const byte COLS = 4;

char hexaKeys[ROWS]
[COLS] = {

{'1', '2', '3', 'A'},


{'4', '5', '6', 'B'},

{'7', '8', '9', 'C'}

};

byte rowPins[ROWS] = {9, 8, 7};

byte colPins[COLS] = {5, 4, 3, 2};

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

void setup()

Serial.begin(9600);

pinMode(13, OUTPUT);

pinMode(12,

OUTPUT);

pinMode(11, OUTPUT);

pinMode(10,

OUTPUT);

void loop()

char customKey = customKeypad.getKey();

if(customKey){
//Serial.println(customKey);

code[keycount]=customKey;

Serial.println(code);

keycount++;

if (customKey == 'C')

{ deleteCount();

Serial.println("Code cleared!");
}

if(keycount==codeLength-1){

//Serial.println(code);

if(!strcmp(code, codeMotor1))

{ Serial.println("Motor 1

activated!"); digitalWrite(13, HIGH);

delay(3000);

digitalWrite(13, LOW);

delay(500);

} else if(!strcmp(code, codeMotor2))

{ Serial.println("Motor 2

activated!"); digitalWrite(12, HIGH);

delay(3000);

digitalWrite(12, LOW);

delay(500);
} else if(!strcmp(code,
codeMotor3)){

Serial.println("Motor 3 activated!");

digitalWrite(11, HIGH);

delay(3000);

digitalWrite(11, LOW);

delay(500);

} else if(!strcmp(code, codeMotor4))

{ Serial.println("Motor 4

activated!"); digitalWrite(10, HIGH);

delay(3000);

digitalWrite(10, LOW);

delay(500);
} else {

Serial.println("Incorrect
code!");
delay(500);

deleteCount();

void deleteCount()

{ while(keycount !

=0){

code[keycount--]=0;

return;

Working:
We use the code given above to design matrices in order to define
the variables and operate the vending machine. The buttons on the
vending machine are linked to the arduino uno which then gives the
processed output to the servo motors. The basic logic we use is to
check if a particular code is typed and once the logic for confirmation
becomes one we activate the particular motor to drop the required
cookie.
When we give input as 12A.Above is the output

When we give input as 11A.Above is the output

When we give input as 14A.Above is the output


When we give input as 13A.Above is the output

Conclusion: As seen above is the design for a vending


machine with multiple input options using an Arduino Uno.
The device takes the input and via the code written
venerates a unique output which then gives out the item we
requested for.

You might also like