All software files for Salad Mixer are accessible in our Bitbucket repository.
Servo FSM
The servo FSM govens the motion of servo motor. The servo motor starts at a locked state. It will only rotate to unlock on the gate when the bowl is present and the servo button is pressed. A audio reminder will be triggered and repeat until the gates are closed and the servo will return to its locked position.
LED FSM
The LED FSM governs the display output on Dot Matrix LED. In the welcome mode, the display will print "Hello Ed". When mixing function is initialized, a progress bar will move from left to right until timeout. When mixing is complete, "Mix Done" message will be displayed. When the servo motor is in unlocked or locked state, "Gate Open" and "Gate Closed" messages will be displayed respectively
DC Motor FSM
DC motor FSM governs the motion of the DC motor. Motor is turned on by the touch of the mix button. When motor is in mixing mode. It receives anolog input signal from the event checker and adjust the motor speed accordingly.
Audio service
The audio service provides different audio feedback based on different user inputs. A soundtrack is triggered on a digital Low signal input and terminated on a digital High input.
Bowl service
The bowl service detects if a bowl is present under the gate.
There are 5 event checker functions created for the framework and they are responsible for checking status of the peripherals connected to PIC32.
CheckADEvent: Check the change in potentiometer for DC speed control
CheckDCButtonEvents: Check if Mix button is pressed
CheckServoButtonEvents: Check if Gate Open button is pressed
CheckSensorStatus: Check switch sensors are pressed by both gates
CheckBowlEvents: Check if bowl is present under the gate.
One of the most important software concepts we learned from ME218A is Hardware Abstraction Layer. The purpose of HAL is to abstract SPI modules in PIC32 and provide developers with a programming interface to the microcontroller. HAL acts as an intermediary layer between the hardware and high-level software, allowing developers to write code independent of hardware details. In this project we used four HAL modules to simplify the control the display output, servo motor, and DC motor. All source files and header files are accessible in our BitBucket repository.
PIC32_SPI_HAL: This module enables the configuration and use of SPI modules provided in PIC32 Mirco controller
DM_Display: This module allows the user to manipulate the output on Dot Matrix LED display
PIC32_AD_Lib: This module provides a set of functions to perform Analog to Digital conversion on input pins.
PIC32_PWM_Lib: This module provides a set of functions to perform initialization and configuration of PWM on output pins.