Pseudocode
Pseudocode
Software Development
4.1 Design of Block Diagram
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
(Tossing tray)
step_pin = 3
dir_pin = 4
num_steps = 200
digitalWrite(dir_pin, HIGH)
for i in range(num_steps):
digitalWrite(step_pin, HIGH)
delay(1)
digitalWrite(step_pin, LOW)
delay(1)
if i== (num_steps/3):
digitalWrite(step_pin, LOW)
digitalWrite(dir_pin, LOW)
(Conveyor Belt with cutting process)
step_pin = 3
dir_pin = 4
num_steps = 200
digitalWrite(dir_pin, HIGH)
for i in range(num_steps):
digitalWrite(step_pin, HIGH)
delay(1)
digitalWrite(step_pin, LOW)
delay(1)
if i == 150:
delay(3000)
cutting_process()
digitalWrite(step_pin, LOW)
digitalWrite(dir_pin, LOW)
4.4.2 For Thermocouple and sending data to MySQL
# Import thermocouple library
import thermocouple
tc1 = thermocouple.Thermocouple(thermocouple.types.K)
tc2 = thermocouple.Thermocouple(thermocouple.types.K)
tc1.connect(tc1_pin)
tc2.connect(tc2_pin)
cnx = mysql.connector.connect(
host="hostname",
user="username",
password="password",
database="dbname")
cursor = cnx.cursor()
while True:
temp1 = tc1.temperature
temp2 = tc2.temperature
delay(1000)
# Close the connection
tc1.close()
tc2.close()
import heat_tube_library
ht1 = heat_tube_library.HeatTube()
ht2 = heat_tube_library.HeatTube()
ht1.connect(ht1_pin)
ht2.connect(ht2_pin)
while True:
current_temp1 = ht1.get_temp()
current_temp2 = ht2.get_temp()
ht1.turn_on()
else:
ht1.turn_off()
ht2.turn_on()
else:
ht2.turn_off()
delay(1000)
ht1.close()
ht2.close()
import stepper_motor_library
import time
conveyor_belt = stepper_motor_library.StepperMotor()
conveyor_belt.connect(conveyor_belt_pin)
conveyor_belt.set_steps_per_rev(200)
conveyor_belt.set_speed(10)
time.sleep(10)
conveyor_belt.stop()
conveyor_belt.close()