HCMC University of Technology
Embedded Systems
Vending Machine
Lecturer Dr. Pham Hoang Anh
Students ID
Hồ Hoàng Thiên Long 1852161
Đoàn Anh Tiến 1852789
Nguyễn Duy Tịnh 1852797
Requirements 01
Table of
Contents
Implementation 02
01.
Requirements
Requirements gathering
Requirements analysis
3
Requirements
Requirements gathering
PSI420
*Images are for illustrative purposes only.
Functional Requirements
- Stock box shall consists a number of cells, each cell is a
row of products with the same type and SKU code
- Cash validation:
⫶ 10.000 VND
● Vietnamese paper currency only
● Divisible by 10.000 VND
● No changes
“Money please”
- Workflow:
1. User deposits money, wait for display screen notify
“Deposits more or press Enter to continue”
2. Enter the product’s code, the machine will push the
“Got my 7Up”
product at specific cell to the receiving box “12.000 VND left, Timeout = 1 min
you want more?
3. Display screen shows remaining cash, user can either
choose another product or input more money.
4. System will reset after 1 minute of no interactions
4
Requirements
Requirements gathering
Non-functional Requirements, the vending machine shall…
- Stock layout: 4 rows x 4 columns - Money reader is always polling the money every 10ms,
with the accuracy of successful charge of 0.9
- Components:
● A money reader (cash) - Total of 3 steps for user to get drink:
● A keypad with number keys (0-9), an enter Money charge -> Select product -> Receive product
key, a clear key
- The system is always available with 99% uptime
● A display screen
● Motors to drop drink
● A receiving drink box
● A closet storing bottle products
5
Requirements
Requirements analysis
Hardware
- Software: compiled binary file
containing operating code
- Complexity when implementing the algorithm
LED display Keypad Currency detector/
to find money respect to drink code:
(min 13 keys) Bill acceptor
● O(n) time
● O(1) space
where n is the number of drink codes
16 motors MCU
*Images are for illustrative purposes only. 6
02.
Implementation
System design
System implementation
7
Implementation
System design
Solution 1: Payment in cash
Hardware
8
Implementation
System design
Solution 1: Payment in cash
Software
9
Implementation
System design
Solution 2: Pay by E-Wallet
Hardware
10
Implementation
System design
Solution 2: Pay by E-Wallet
Software
11
Implementation
System design
Tradeoff
Solution 1: Payment in cash Solution 2: Pay by E-wallet
Pros: Pros:
- No internet required - No change handling needed
- Can buy multiple products Cons:
continuously - Internet required
Cons: - Cannot buy multiple products
- Change cannot be returned continuously
- Paper money required - Mobile phone with E-wallet required
Complexity when implementing the algorithm to find money respect to drink code:
- O(n) time
- O(1) space Choose solution 1
where n is the number of drink codes
12
Implementation
System design
Testing strategy for Solution 1
Functional testing:
- Test workflow
- Total malfunction buttons / total buttons
- Total malfunction motors / total motors
- Number of money acceptance / Total number of times input money
Non-functional testing:
- Response time of processing money
- Response time of dropping drink
- Malfunction LED screen show in a unit time
13
Implementation
System implementation
Paper money reader:
- BRV2300
- money acceptance rate > 96%
- read Vietnam paper money
- box can hold ~300 papers
- Protocol: RS232
Buttons matrix:
- IP65, 4x4 (items)
- waterproof
- backlit
- Protocol: USB
Display screen:
- LCD1602 + I2C
- 2 rows, enough to show information
- I2C have reduced number of pins to 4
- Protocol: I2C 14
Implementation
System implementation
RS232 relays (additional):
- 2 x 8 + 1 x 4 (items)
- Protocol: RS232
Motors:
- DC Servo Deceleration motor
+ springs, 4x4 (items)
- Protocol: on/off via relays
MCU:
- STM32F103C8T6
- 8MHz
- 2 x I2C
- 3 x UART
15
Implementation
System implementation
Power:
- DC 12V - 20A
- 2.5A (money sensor) + 16 x 1A (motors) + others ≈ 20A
16
Implementation
System implementation
Software:
- Program STM32 MCU with C/C++, with open-source libraries.
17
Thank you for your attention!
Do you have any questions for us?
18