This project is for the computer systems architecture course. Its objective is to create a computer system designed to detect cups placed in specific locations and fill them with liquid. The compiled code will run on an ATmega328P microcontroller. The prototype board for development is Arduino Uno.
- Prerequisites:
- VS Code with installed extension PlatformIO IDE.
- Arduino Uno board (ATmega328P).
- Clone repo and open with VS Code. PlatformIO automatically downloads all dependencies.
git clone https://github.com/Aleks334/RoboBarman.git-
Make sure that your board is detected by PlatformIO by running:
pio device list. -
Choose your enviroment This project supports two hardware configurations defined in platformio.ini. You must specify the environment using the -e flag.
| Environment | Hardware target | Bootloader |
|---|---|---|
uno |
Arduino Uno board | Optiboot (115200 baud) |
atmega328 |
standalone chip on custom PCB | Duemilanove (57600 baud) |
- Compile & upload
For Arduino Uno:
pio run -e uno
pio run -e uno -t uploadFor standalone ATmega328P (used on our custom PCB):
pio run -e atmega328
pio run -e atmega328 -t uploadMore about PlatformIO CLI and moving from Arduino to a microcontroller on a breadboard
To run unit tests located in the test/ directory, specify your environment:
Testing on Uno:
pio test -e unoTesting on standalone chip:
pio test -e atmega328To adjust the behaviour or change pins please edit GlobalConfig.h file here.
- The arm returns to position 0
- The pump is off
- The order queue is empty
- currently_served = NULL
- stations array length = NUMBER_OF_STATIONS - 1. All stations default to IDLE state.
- LEDs are SOLID_GREEN
States:
- IDLE – Station is empty.
- OCCUPIED – Cup detected, waiting in queue.
- IN_PROGRESS – System has started handling the order.
- READY – Liquid dispensed, cup ready for pickup.
Transitions:
stateDiagram-v2
[*] --> IDLE
IDLE --> OCCUPIED
OCCUPIED --> IDLE
OCCUPIED --> IN_PROGRESS
IN_PROGRESS --> IDLE
IN_PROGRESS --> READY
READY --> IDLE
States:
- WAITING_FOR_TASK
- MOVING
- FILLING
Transitions:
stateDiagram-v2
[*] --> WAITING_FOR_TASK
WAITING_FOR_TASK --> MOVING
MOVING --> WAITING_FOR_TASK
MOVING --> FILLING
FILLING --> WAITING_FOR_TASK
States:
- IDLE
- START_DELAY
- RUNNING
- STOP_DELAY
Transitions:
stateDiagram-v2
[*] --> IDLE
IDLE --> START_DELAY
START_DELAY --> RUNNING
START_DELAY --> IDLE
RUNNING --> STOP_DELAY
RUNNING --> IDLE
STOP_DELAY --> IDLE
- User places a cup on one of the available stations.
- The sensor detects the cup; station state changes to OCCUPIED, LED turns SOLID_RED.
- The system pulls the task from the queue. Station state changes to IN_PROGRESS, LED FLASHING_RED.
- The robot moves the arm to the station's position.
- The robot initiates the pouring sequence.
- Station state changes to READY, LED FLASHING_GREEN.
- User removes the cup, releasing station. Station state returns to IDLE, LED turns SOLID_GREEN.
-
Cup removed during the filling process.
[SOLVED]: barman calls abort() method to instantly return to idle position, turn off the pump and cancel order. -
Liquid tank is empty.
[IN PROGRESS] -
Microcontroller reset during the filling process.
[IN PROGRESS] -
Hand placed instead of a cup.
[SOLVED]: sensors are located from bottom of the case and only placing cup inside the station hole will trigger the process.