ME405: Mechatronics
Project Documentation and Portfolio by Neil Patel
Lab0x01: FSM Practice and User Interface Development

Summary

The objective of this assignment is to develop a a program that embodies the function of the vending machine of assignment HW0x00, where we created a state transition diagram. State transition diagrams are high–level design tools that can be used to ensure that code will function according to stated design requirements. The Vendotron runs cooperatively; the code does not contain any blocking commands.

Design Features

The Vendotron operates without utilizing any 'blocking' commands and hence, functions cooperatively. The figure below depicts the machine that the Finite State Machine has been modeled after.

Figure 1: The Vendotron Machine (Source: Lab0x01 Handout)

The Vendotron has several buttons including one for each kind of drink that is available. Additionally there is a small two-line LCD text display and coin return button as you would expect on an average vending machine.
The Vendotron exhibits the following features:

  • On startup, Vendotron displays an initialization message on the LCD screen.
  • At any time a coin may be inserted, which results in the balance being displayed on the screen.
  • At any time, a drink may be selected. If the current balance is sufficient, the Vendotron vends the desired beverage through the flap at the bottom of the machine and then computes the correct resulting balance. If the current balance is insufficient to make the purchase then the machine displays an "Insufficient Funds" message and then displays the price for the selected item.
  • At any time the Eject button may be pressed, in which case the machine returns the full balance through the coin return.
  • The Vendotron keeps prompting the user to select another beverage if there is remaining balance.
  • If the Vendotron is idle for a certain amount of time, it shows a "Try Cuke today!" scrolling message on the LCD display.

User Inputs

Beverage Selection:
'c' - Cuke
'p' - Popsi
's' - Spryte
'd' - Dr. Pupper

Insert Payment
'0' - Penny
'1' - Nickle
'2' - Dime
'3' - Quarter
'4' - $1
'5' - $5
'6' - $10
'7' - $20

Return Change
'e' - Eject change

Vendotron State Transition Diagram

Figure 2: Vendotron State Transition Diagram

Documentation

Documentation of this lab can be found here: Lab0x01

Source Code

The source code for this lab: https://bitbucket.org/npatel68/me405_labs/src/master/lab1/vendo.py


Author
Neil Patel
Date
April 22, 2021