0% found this document useful (0 votes)
39 views20 pages

Project Title: Temperature Monitoring System Project Created By: S. No. College Register No. Full Name With Initials

The document outlines a project for a Temperature Monitoring System, detailing its objectives, scope, hardware and software requirements, and architecture. The system simulates an electronic chocolate vending machine using an Arduino Uno, with features including keypad input for selection and servo motor control for dispensing. It emphasizes fundamental concepts in embedded systems and includes test cases for validating functionality within the Wokwi simulation environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views20 pages

Project Title: Temperature Monitoring System Project Created By: S. No. College Register No. Full Name With Initials

The document outlines a project for a Temperature Monitoring System, detailing its objectives, scope, hardware and software requirements, and architecture. The system simulates an electronic chocolate vending machine using an Arduino Uno, with features including keypad input for selection and servo motor control for dispensing. It emphasizes fundamental concepts in embedded systems and includes test cases for validating functionality within the Wokwi simulation environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Project Title

Temperature Monitoring System

Project Created By:

S. College Register Full Name with Initials (as per


No. No. college certificate)

1 12342008xxxxxx01 Ramkumar A.

2 12342008xxxxxx02 Soumya Balaji J.

3 12342008xxxxxx03 Niranjana P. S.

4 12342008xxxxxx04 Arun Kumar E. M.

Project Reviewed By: “Trainer Name”


Project Created Date: “last day of class or Submission
Date”
Project Code: “import From project list file”
College Code: 1234
Team Name: PET1234
Table of Contents:

Contents
Project Title............................................................................................................. 1
[Link] of Contents:................................................................................................ 1
[Link] Objective & Description:...........................................................................1
[Link]& features:.................................................................................................. 1
[Link] & Software Requirements:...................................................................1
[Link] & Skill required:................................................................................. 1
[Link] Architecture Submission :.........................................................................2
[Link] Cases:........................................................................................................... 2
[Link] and Result Submission:............................................................................... 2
[Link] & Further improvements:.................................................................2
[Link]:........................................................................................................ 2

2. Project Objective & Description:


Objectives:
 The primary goal is to simulate an electronic chocolate vending
machine prototype within the Wokwi environment.
 This involves using an Arduino Uno to control a servo motor for
dispensing chocolates.
 A simulated keypad will allow users to select a chocolate option.
 The system aims to display chocolate options and respond to user
input from the keypad.
 Use an Arduino Uno to control a servo motor: The Arduino will send
signals to the servo motor to control its rotation, simulating the
dispensing mechanism.
 Implement keypad input for product selection: A virtual keypad in
Wokwi will allow users to enter a code corresponding to a chocolate
option.
 Display chocolate options: The available chocolate options will be
displayed to the user, likely via the serial monitor in the Wokwi
simulation.
 Simulate dispensing based on user input: Upon receiving valid input
from the keypad, the Arduino will activate the servo motor to simulate
dispensing the selected chocolate.
Description:
 The Electronic Chocolate Vending Machine is a Wokwi-based project
that simulates the basic functionality of a vending machine.
 An Arduino Uno microcontroller is used to control a servo motor, which
represents the dispensing mechanism.
 A simulated keypad within Wokwi provides the user interface for
selecting a chocolate.
 The Arduino's firmware is responsible for:
o Reading input from the keypad.
o Identifying the selected chocolate based on the keypad input.
o Controlling the servo motor to simulate the dispensing action for
the chosen chocolate.
o (Potentially) providing feedback to the user via the serial monitor
about the selection and dispensing.
 The Wokwi environment allows for the simulation of all hardware
components and their interactions, enabling development and testing
without physical hardware.
 This project demonstrates fundamental concepts in embedded
systems, including input handling from a keypad, control of a servo
motor, and basic decision-making based on user input.

3. Scope & Features:


Scope:
 The project focuses on simulating a basic electronic chocolate vending
machine with keypad selection and servo dispensing in Wokwi.
 "Basic" implies that the system will implement core vending machine
functionality without monetary transactions.
 It will include features like displaying options, accepting keypad input,
and simulating dispensing.
 It will not initially involve advanced features like an LCD display for
options, inventory management, or handling invalid inputs beyond
basic recognition.
 The project emphasizes understanding Arduino control of a servo and
keypad input for a simple vending process.
Features:
 Simulated keypad input for selecting chocolate options.
 Control of a servo motor to simulate chocolate dispensing.
 Display of chocolate options (likely via serial monitor).
 Basic mapping of keypad input to chocolate selection.
 Simulation of the entire system within the Wokwi environment.

4. Hardware & Software Requirements:


Inputs:
 Keypad input (user selection).
Outputs:
 Control signals to the servo motor.
 (Potentially) output to the serial monitor for displaying options and
feedback.
Hardware Requirements:
 Arduino Uno (simulated)
 Servo motor (simulated)
 Keypad (simulated)
Software Requirements:
 Arduino IDE (for code development)
 Wokwi Online Simulator

5. Knowledge & Skill Required:


 Knowledge Required:
o Basic electronics principles.
o Arduino programming (C/C++).
o Temperature sensor interfacing.
o LCD interfacing.
 Skill Required:
o Circuit design and simulation (in Wokwi).
o Arduino code development and debugging.
o Problem-solving and troubleshooting.
6. Project Architecture Submission:
Hardware Architecture:
 The hardware architecture consists of:
o Arduino Uno: The microcontroller that controls the servo and reads
keypad input.
o Servo Motor: The motor used to simulate the dispensing mechanism.

o Keypad: The input device for selecting chocolate options.


 Connections:
o The servo motor is connected to a digital output pin on the Arduino.

o The keypad is connected to digital input/output pins on the Arduino.

Block Diagram:

[Link] Description :

Overview
This project implements a fully automated chocolate vending
machine prototype using Arduino Uno as the control unit. Designed
for virtual simulation in Wokwi before physical implementation, the
system combines user input processing, electromechanical
actuation, and interactive feedback to create a realistic vending
experience without monetary transactions.
Core Functionality
1. Product Selection System
o 4×4 matrix keypad for user input
o Three chocolate options mapped to keys A, B, and C
o Visual menu displayed on 16×2 LCD (I2C)
2. Dispensing Mechanism
o SG90 servo motor simulates product release
o 90° rotation for "dispensing" action
o Automatic return to closed position after 3 seconds
3. User Interface
o Real-time LCD feedback:
 Product selection confirmation
 Dispensing status messages
 Error handling for invalid inputs
Technical Specifications

Component Specification

Control Unit Arduino Uno R3

Input Method 16-button membrane keypad

SG90 Micro Servo (180°


Actuation
range)

16×2 LCD with I2C interface


Display
(0x27)

Power
5V DC (simulated)
Requirements

<1 second for input


Response Time
processing

Key Features
 Intuitive Operation
o Clear menu-driven interface
o Instant visual feedback for all actions
o Tactile keypad input simulation
 Realistic Dispensing Simulation
o Servo motor mimics mechanical release mechanism
o Adjustable dispensing duration (3 seconds default)
 Error Handling
o Rejects invalid selections immediately
o Auto-returns to main menu after errors
o No-stuck state design
Educational Value
1. Hardware Integration
o Demonstrates interfacing of multiple peripherals (keypad, servo,
LCD)
o Implements I2C communication protocol
2. Software Concepts
o State machine implementation
o User input validation
o Non-blocking delay handling
3. Prototyping Skills
o Virtual testing before physical build
o Debugging via serial monitor
o Component behavior simulation
Application Scenarios
 Retail Prototyping
Test vending concepts before manufacturing
 STEM Education
Teach embedded systems and mechatronics
 Public Spaces
Non-cash snack dispensers in schools/hospitals
Simulation vs Physical Implementation

Wokwi
Aspect Physical Build
Simulation

Virtual
Components Real hardware
equivalents

Servo
Visual rotation Physical movement
Behavior

Keypad Feel Mouse clicks Tactile buttons

Hardware
Debugging Instant reset
troubleshooting
8. Test Cases:
Test Case 1: Hardware Setup
 Verify that all components are correctly connected in the Wokwi simulation.
 Expected Result: The simulation starts without errors, and all components are
visible.
Test Case 2: Keypad Input
 Test the ability to read input from the simulated keypad.
 Expected Result: The Arduino correctly reads the keys pressed on the
keypad.
Test Case 3: Valid Chocolate Selection
 Enter a valid code for a chocolate option on the keypad.
 Expected Result: The servo motor activates to simulate dispensing.
Test Case 4: Invalid Chocolate Selection
 Enter an invalid code on the keypad.
 Expected Result: The system (potentially via serial monitor) indicates an
invalid selection, and the servo does not activate.
Test Case 5: Multiple Selections
 Test making multiple valid and invalid selections.
 Expected Result: The system responds correctly to each input.

9. Code and Results Submission:


 9.1 Code Submission:
Aurdino Code:
#include <LiquidCrystal_I2C.h> // Includes the library for I2C LCD communication.
LiquidCrystal_I2C lcd(0x27,16,2); // Creates an LCD object, specifying the I2C
address (0x27), 16 columns, and 2 rows.

#include <Servo.h> // Includes the Servo library for controlling servo motors.
Servo servo_A; // Declares a Servo object for servo A.
Servo servo_B; // Declares a Servo object for servo B.
Servo servo_C; // Declares a Servo object for servo C.

#define coinSlot 2 // Defines the Arduino pin connected to the coin slot.
#define button 3 // Defines the Arduino pin connected to the button.
#define buzzer 12 // Defines the Arduino pin connected to the buzzer.
#define motorA 6 // Defines the Arduino pin connected to motor A.
#define motorB 7 // Defines the Arduino pin connected to motor B.

// Timer variables for controlling motor timing.


unsigned long motorA_on = 60000; // Time (ms) motor A stays ON (60 seconds).
unsigned long delay_motorB = 2000; // Delay (ms) before turning ON motor B.
unsigned long motorB_on = 5000; // Time (ms) motor B stays ON.
unsigned long timeA_on; // Variable to store the time motor A was turned ON.
unsigned long timeB_on; // Variable to store the time motor B was turned ON.
unsigned long display_blink = 0; // Variable for controlling display blinking.
unsigned long countdown_timer = 0; // Variable for the countdown timer.

// Servo timer variables for controlling servo movements.


unsigned long servo_A_on = 500; // Time (ms) servo A is active.
unsigned long servo_C_on = 10000; // Time (ms) servo C is active.
unsigned long servo_timer = 0; // Variable to track servo timing.

// Servo position variables.


// ---- Initial Positions ----//
int init_pos_A = 0; // Initial position of servo A.
int init_pos_B = 0; // Initial position of servo B.
int init_pos_C = 0; // Initial position of servo C.
// ----Final positions -----//
int final_pos_A = 90; // Final position of servo A.
int final_pos_B = 90; // Final position of servo B.
int final_pos_C = 90; // Final position of servo C.

// Coin Slot Variables


int required_amount = 30; // Amount required to activate the machine.
int inserted_amount = 0; // Amount inserted by the user.
byte prev_pulse_state = 1; // Stores the previous state of the coin slot pulse.

byte state = 0; // State variable to control the vending machine's operation.


/* 0 --->> Vending Machine in Welcome Mode, displays insert coin message
* 1 --->> Required amount is reached, ready for dispensing
* 2 --->> Vending Machine in dispensing mode, motors are running
* 3 --->> Vending operation finished, displays thank you message
*/

bool t = true; // Auxiliary variable to blink the display.


bool countdown = false; // Flag to indicate if the countdown is active.
bool move_servo = false; // Flag to indicate if servo movement is active.
bool run_motor = false; // Flag to indicate if motors are running.
int count_num = 5 ; // Counter for the dispensing countdown.

void setup(){
[Link](); // Initializes the LCD.
[Link](); // Turns on the LCD backlight.
[Link](); // Clears the LCD display.

//Servo initialization
servo_A.attach(8); // Attaches servo A to pin 8.
servo_B.attach(9); // Attaches servo B to pin 9.
servo_C.attach(10); // Attaches servo C to pin 10.
//Move Servos to Initial Positions
servo_A.write(init_pos_A); // Sets servo A to its initial position.
servo_B.write(init_pos_B); // Sets servo B to its initial position.
servo_C.write(init_pos_C); // Sets servo C to its initial position.

delay(500); // Delays for 500 milliseconds.


[Link](0, 0); // Sets the LCD cursor to the first column, first row.
[Link](" SUGARCANE"); // Prints "SUGARCANE" on the LCD.
[Link](0, 1); // Sets the LCD cursor to the first column, second row.
[Link]("VENDNING MACHINE"); // Prints "VENDNING MACHINE" on the LCD.
delay(2000); // Delays for 2000 milliseconds.
[Link](); // Clears the LCD display.

//Pin Initialization
pinMode(motorA, OUTPUT); // Sets motor A pin as an output.
pinMode(motorB, OUTPUT); // Sets motor B pin as an output.
digitalWrite(motorA,LOW); // Initially turns off motor A.
digitalWrite(motorB, LOW); // Initially turns off motor B.
pinMode(button, INPUT_PULLUP); // Sets the button pin as an input with pull-up
resistor.
pinMode(coinSlot,INPUT); // Sets the coin slot pin as an input.
}

void loop(){
switch(state){ // State machine to control the vending machine's logic.
case 0: // State 0: Welcome Mode
if(inserted_amount == 0){ // If no coins are inserted yet.
[Link](0,0); // Sets the LCD cursor to the first column, first row.
[Link](" PLEASE "); // Prints "PLEASE" on the LCD.
[Link](0,1); // Sets the LCD cursor to the first column, second row.
[Link]("INSERT COINS!!!"); // Prints "INSERT COINS!!!" on the LCD.
}
prev_pulse_state = digitalRead(coinSlot); // Reads the current state of the coin
slot.
delay(20); // Delays for 20 milliseconds.
if(!digitalRead(coinSlot)){ // If the coin slot detects a pulse (HIGH to LOW
transition).
inserted_amount=inserted_amount+5; // Increases the inserted amount by 5.
tone(buzzer, 1000); // Plays a tone on the buzzer.
[Link](0,0); // Sets the LCD cursor to the first column, first row.
[Link](" Bal. Php: "); // Prints "Bal. Php: " on the LCD.
[Link](inserted_amount); // Prints the inserted amount.
[Link](".00"); // Prints ".00" on the LCD.
delay(50); // Delays for 50 milliseconds.
}
noTone(buzzer); // Turns off the buzzer.
if(inserted_amount >= required_amount ){ // If the required amount is inserted.
[Link](0,0); // Sets the LCD cursor to the first column, first row.
[Link](" Bal. Php: " + String(inserted_amount)+ ".00"); // Prints the balance.
[Link](0,1); // Sets the LCD cursor to the first column, second row.
[Link]("PRESS BUTTON!!!"); // Prints "PRESS BUTTON!!!".
count_num = 5; // Resets the countdown number.
state = 1; // Transitions to state 1 (ready for dispensing).
}
break;

case 1: // State 1: Ready for Dispensing


if(digitalRead(button) == LOW && !countdown && !run_motor){ // If the button
is pressed and no dispensing is in progress.
[Link](0,0); // Sets the LCD cursor to the first column, first row.
[Link](" - GO JUICEEE! -"); // Prints "- GO JUICEEE! -".
[Link](0,1); // Sets the LCD cursor to the first column, second row.
[Link]("Dispensing in: "); // Prints "Dispensing in: ".
countdown = true; // Starts the countdown.
countdown_timer = millis(); // Stores the start time of the countdown.
move_servo = true; // Activates servo movement.
servo_timer = millis(); // Stores the start time of servo movement.
}

if(move_servo){ // If servo movement is active.


if(millis()-servo_timer < 50){ // Moves servos A and C briefly at the beginning.
servo_A.write(final_pos_A);
servo_C.write(final_pos_C);
}
if(millis()-servo_timer > servo_A_on){ // Returns servo A to its initial position
after a delay.
servo_A.write(init_pos_A);
/*if(millis() - servo_timer > servo_A_on + servo_AB_delay){
if(millis() - servo_timer < servo_A_on + servo_AB_delay + servo_B_on){
servo_B.write(final_pos_B);
}
} */
}
/*if(millis() - servo_timer > servo_A_on + servo_AB_delay + servo_B_on){
servo_B.write(init_pos_B);
} */
if(millis()-servo_timer > servo_C_on){ // Returns servo C to its initial position
after a longer delay.
servo_C.write(init_pos_C);
}
}
if(countdown){ // If the countdown is active.
[Link](15,1); // Sets the LCD cursor to the 16th column, second row.
[Link](count_num +1 ); // Prints the remaining time.
if(count_num == 5 || millis()-countdown_timer > 1000 ){ // Decrements the
counter every second.
count_num = count_num-1;
tone(buzzer,500,500); // Plays a short tone on the buzzer.
countdown_timer = millis(); // Updates the countdown timer.
}
if(count_num < 0){ // If the countdown is finished.
delay(1000); // Delays for 1 second.
countdown = false; // Stops the countdown.
run_motor = true; // Activates the motors.
}
}

//Activate and Deactivate Motors


if(run_motor){ // If the motors are to be activated.
if(digitalRead(motorA) == LOW){ // If motor A is off.
digitalWrite(motorA, HIGH); // Turns on motor A.
timeA_on = millis(); // Stores the time motor A was turned on.
}
if(millis() - timeA_on >= delay_motorB && millis() - timeA_on <
delay_motorB+20){ // Turns on motor B after a delay.
digitalWrite(motorB,HIGH);
timeB_on = millis(); // Stores the time motor B was turned on.
}
if(millis() - timeB_on >= motorB_on ){ // Turns off motor B after its allotted
time.
digitalWrite(motorB, LOW); // Turns off Motor B
}
if(millis() - timeA_on >= motorA_on){ // Turns off motor A after its allotted
time.
digitalWrite(motorA, LOW); // Turns off Motor A
state = 2; // Transitions to state 2 (dispensing).
}
if(millis()- display_blink >=500){ // Blinks the display while dispensing.
[Link](0,0); // Sets the LCD cursor to the first column, first row.
[Link]("-- Dispensing --"); // Prints "-- Dispensing --".
[Link](0,1); // Sets the LCD cursor to the first column, second row.
if(t){[Link](". . . . . . . . ");} // Alternates dots for the blinking effect.
else {[Link](" . . . . . . . .");}
display_blink = millis(); // Updates the blink timer.
t = !t; // Toggles the blink state.
}
}
break;

case 2: // State 2: Dispensing Complete


[Link](); // Clears the LCD.
[Link](0,0); // Sets the LCD cursor to the first column, first row.
[Link](" THANK YOU!!!"); // Prints "THANK YOU!!!".
delay(1500); // Delays for 1.5 seconds.
tone(buzzer, 2000); // Plays a high-pitched tone.
delay(200); // Delays for 200 milliseconds.
noTone(buzzer); // Turns off the buzzer.
delay(150); // Delays for 150 milliseconds.
tone(buzzer, 1800,250); // Plays another tone.
delay(1500); // Delays for 1.5 seconds.
inserted_amount = 0; // Resets the inserted amount.
move_servo = false; // Stops servo movement.
run_motor = false; // Stops motors.
state = 0; // Returns to state 0 (welcome mode).
break;
}
}
Code Description:

1. Includes Libraries: The code starts by including the


LiquidCrystal_I2C.h library for controlling an I2C-based LCD and the
Servo.h library for controlling servo motors.
2. LCD Initialization: It initializes the LCD with its I2C address,
specifying the number of columns and rows. This LCD is used to display
messages to the user.
3. Servo Objects: It creates three Servo objects (servo_A, servo_B,
servo_C) to control three different servo motors, likely responsible for
different dispensing actions.
4. Pin Definitions: It uses #define to assign meaningful names to the
Arduino pins connected to various components like the coin slot,
button, buzzer, and motors. This improves code readability.
5. Timer Variables: It declares several unsigned long variables to
manage timing for motor activation, delays, display blinking, and
countdown sequences. unsigned long is used because millis() returns
an unsigned long.
6. Servo Timing Variables: It defines variables to control the timing of
the servo movements, allowing for sequenced or timed actions of the
servos.
7. Servo Position Variables: It sets up integer variables to store the
initial and final positions of each servo motor, defining the range of
motion for the dispensing mechanism.
8. Coin Slot Logic: It includes variables to handle coin input, track the
amount inserted, and detect coin pulses. The code appears to be
designed to detect pulses from a physical coin slot mechanism.
9. State Machine: The code uses a byte variable state to implement a
state machine, controlling the overall flow of the vending machine's
operation (welcome, accepting coins, dispensing, thank you).
10. Auxiliary Variables: It uses boolean variables (t, countdown,
move_servo, run_motor) and an integer (count_num) to manage
display blinking, countdown sequences, and the activation of servos
and motors.
11. setup() Function: The setup() function initializes the LCD,
attaches the servo motors to their respective pins, sets the initial
positions of the servos, displays a welcome message on the LCD, and
configures the pin modes for motors, button, and coin slot.
12. Welcome State (State 0): The vending machine starts in the
welcome state, prompting the user to insert coins and tracking the
inserted amount. It uses a simple pulse detection method to register
coin inputs.
13. Ready to Dispense (State 1): Once the required amount is
inserted, the machine transitions to the ready-to-dispense state,
waiting for the user to press the button. It then initiates a countdown
sequence and activates the servo motors.
14. Dispensing Sequence: The code controls the sequence and
timing of servo movements and motor activation to simulate the
dispensing process. It appears to have a timed sequence for each
servo and motor.
15. Motor Control: It activates and deactivates two motors
(motorA, motorB) with specific timing, likely to control a conveyor or
other dispensing mechanism.
16. Display Feedback: The LCD is used to provide feedback to the
user, displaying messages such as "INSERT COINS", "Dispensing in:",
and "-- Dispensing --", and it even includes a blinking effect during
dispensing.
17. Buzzer Feedback: The buzzer is used to provide audio
feedback, such as beeps during coin insertion and countdown.
18. Thank You State (State 2): After dispensing, the machine
displays a "THANK YOU!!!" message and resets for the next transaction

Test Case Wise Results:

Tes Expecte
Action
t d Result
Servo
moves,
1 Press 'A'
"Chocolate"
dispensed
Press "Invalid
2 invalid key Choice!"
(e.g., 'D') message
Returns
No input
3 to main
for 10s
menu

Final Project :
Setup Steps:
1. Create Project:
o Go to Wokwi → "Start New Project" → Select Arduino Uno.

2. Add Components:
o Search and add:

 4x4 Keypad
 SG90 Servo
 16x2 LCD (I2C, address 0x27)
3. Wire Components:
o Connect keypad rows to D6-D9, columns to D2-D5.

o Servo signal to D10.

o LCD SDA to A4, SCL to A5.

4. Upload Code:
o Copy the provided code into Wokwi editor.

o Click "Start Simulation".

5. Test:
o Press A/B/C to simulate chocolate selection.

o Observe servo movement and LCD feedback.

10. Screenshots & Further Improvements:


Further Improvements:

 Inventory Management
o Track "stock levels" for each product
o Show "out of stock" messages
 Enhanced UI
o Scrolling product descriptions
o LED indicators for selection
 Advanced Mechanics
o Multiple servo setup for different products
o Simulated conveyor belt system
 IoT Integration
o Remote monitoring via WiFi
o Usage analytics collection

11. References:
 Arduino LiquidCrystal Library
 Arduino. (n.d.). Arduino Official Website. Retrieved from
[Link]
 Wokwi. (n.d.). Wokwi - Embedded Systems Simulator. Retrieved from
[Link]

You might also like