0% found this document useful (0 votes)
33 views

Pseudocode

The document describes the software development for an autonomous keropok lekor cooking machine. It includes block diagrams, specifications for components like the Arduino Uno microcontroller, and pseudocode for controlling processes like the stepper motors, thermocouples, heating elements, and conveyor belt. Pseudocode uses libraries and functions to automate tasks like taking temperature readings, turning heating elements on/off, and rotating the conveyor belt and tossing tray.

Uploaded by

Luqman Hakim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Pseudocode

The document describes the software development for an autonomous keropok lekor cooking machine. It includes block diagrams, specifications for components like the Arduino Uno microcontroller, and pseudocode for controlling processes like the stepper motors, thermocouples, heating elements, and conveyor belt. Pseudocode uses libraries and functions to automate tasks like taking temperature readings, turning heating elements on/off, and rotating the conveyor belt and tossing tray.

Uploaded by

Luqman Hakim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

4.

Software Development
4.1 Design of Block Diagram

Figure 1: Autonomous Keropok Lekor Cooking Machine block diagram.


4.2 Specifications

Arduino Uno
Technical Specifications Values
Microcontroller ATmega328P – High Performance, Low Power
8bit AVR family microcontroller
Operating Voltage 5V
Input Voltage (Recommended) 7-12V
Input Voltage Limits 6-20V
Analog Input Pins 6
Digital I/O Pins 14 (of which 6 provide PWM output)
DC Current per I/O Pins 20 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB of which 0.5kb used by bootloader
SRAM 2 KB
EEPROM 1 KB
Clock Speed 16 MHz

No. Item Specifications


1 Arduino IDE Developers: Arduino
It is used to write and upload programs to Arduino Software OS: Windows
compatible boards. In our project, to program the Language: C++
microcontroller which will control the process
from the data collected from the sensor and time
the system accordingly.
2 Qt Creator Developer: The Qt
A cross-platform integrated development Company, Qt Project
environment for C++, JavaScript, and QML that Software OS: Multi-cross
facilitates GUI application development. In our platform
case, to create a dedicated GUI for the display Language: C++, JavaScript,
panel. and QML

3 MySQL Software OS: Multi-cross


Develop a database that will store data from the platform
temperature sensor and status of cooking process Language: SQL
4.3 Process Flowchart
4.4 Pseudocode

4.4.1 For Stepper Motor

(Tossing tray)

# Define stepper motor pins

step_pin = 3

dir_pin = 4

# Define number of steps to take

num_steps = 200

# Set direction of rotation

digitalWrite(dir_pin, HIGH)

# Loop to take steps

for i in range(num_steps):

# Send pulse to step pin

digitalWrite(step_pin, HIGH)

delay(1)

digitalWrite(step_pin, LOW)

delay(1)

if i== (num_steps/3):

delay(10000)# pause for 10 seconds

# Turn off stepper motor

digitalWrite(step_pin, LOW)

digitalWrite(dir_pin, LOW)
(Conveyor Belt with cutting process)

# Define stepper motor pins

step_pin = 3

dir_pin = 4

# Define number of steps to take

num_steps = 200

# Set direction of rotation

digitalWrite(dir_pin, HIGH)

# Loop to take steps

for i in range(num_steps):

# Send pulse to step pin

digitalWrite(step_pin, HIGH)

delay(1)

digitalWrite(step_pin, LOW)

delay(1)

# Check if the cutting process should start

if i == 150:

# Pause for 3 seconds

delay(3000)

# Start cutting process

cutting_process()

# Start the conveyor belt again

conveyor_belt.rotate(360) # Rotate 360 degrees

# Turn off stepper motor

digitalWrite(step_pin, LOW)

digitalWrite(dir_pin, LOW)
4.4.2 For Thermocouple and sending data to MySQL
# Import thermocouple library

import thermocouple

# Create thermocouple objects

tc1 = thermocouple.Thermocouple(thermocouple.types.K)

tc2 = thermocouple.Thermocouple(thermocouple.types.K)

# Connect to thermocouple 1 & 2

tc1.connect(tc1_pin)

tc2.connect(tc2_pin)

Connect to MySQL database

cnx = mysql.connector.connect(

host="hostname",

user="username",

password="password",

database="dbname")

cursor = cnx.cursor()

# Loop to take data from thermocouples

while True:

# Get temperature from thermocouple 1

temp1 = tc1.temperature

print("Thermocouple 1: ", temp1)

# Get temperature from thermocouple 2

temp2 = tc2.temperature

print("Thermocouple 2: ", temp2)

# Wait for 1 second

delay(1000)
# Close the connection

tc1.close()

tc2.close()

4.4.3 For Heating Element of the tube


# Import the necessary libraries

import heat_tube_library

# Create heat tube objects

ht1 = heat_tube_library.HeatTube()

ht2 = heat_tube_library.HeatTube()

# Set maximum temperatures

ht1.set_max_temp(100) # Max temp for heat tube 1 is 100 degrees Celsius

ht2.set_max_temp(185) # Max temp for heat tube 2 is 185 degrees Celsius

# Connect to heat tubes

ht1.connect(ht1_pin)

ht2.connect(ht2_pin)

# Loop to control heat tubes

while True:

# Get current temperature of heat tube 1

current_temp1 = ht1.get_temp()

# Get current temperature of heat tube 2

current_temp2 = ht2.get_temp()

# Check if heat tube 1 needs to be turned on

if current_temp1 < ht1.get_max_temp():

ht1.turn_on()

else:

ht1.turn_off()

# Check if heat tube 2 needs to be turned on

if current_temp2 < ht2.get_max_temp():

ht2.turn_on()
else:

ht2.turn_off()

# Wait for 1 second

delay(1000)

# Close the connection

ht1.close()

ht2.close()

4.4.4 For Conveyor Belt on Drying section


# Import the necessary libraries

import stepper_motor_library

import time

# Create a stepper motor object

conveyor_belt = stepper_motor_library.StepperMotor()

# Connect to the stepper motor

conveyor_belt.connect(conveyor_belt_pin)

# Set the number of steps per revolution

conveyor_belt.set_steps_per_rev(200)

# Set the speed of the conveyor belt

conveyor_belt.set_speed(10)

# Start the conveyor belt

conveyor_belt.rotate(360) # Rotate 360 degrees

# Wait for 10 seconds for drying process

time.sleep(10)

# Start the conveyor belt again

conveyor_belt.rotate(360) # Rotate 360 degrees

# Stop the conveyor belt

conveyor_belt.stop()

conveyor_belt.close()

You might also like