## 5 Case Study: COTS-based Embedded Real-Time Control of a Time Mash Delivery Machine
### The COTS-Based Controller
#### 5.2.1 COTS-based Control Architecture  
The COTS-based control architecture is shown in Figure 8. This consisted of: (i) the RPi3 COTS component, (ii) an RS232 serial module component, (iii) the lime slurry flowmeter, and (iv) the 5V solid state relay module and triac circuit for the control of the AC motor drive frequency regulator.  
The overall monitoring and control are performed on a central control board, the setting of which is based on an RPi3 panel that monitors the machine's operation. The RPi3 controller is connected to a Danfoss Magflo MAG6000 electromagnetic flowmeter, through an RS232 serial module (MODBUS RTU), in order to receive the lime flow rate volume (as pulses count). Accordingly, it regulates with PWM (Pulse Width Modulation) the speed of the variable frequency ac motor, through a specific triac circuit (integrated into the motor unit), in order to set the required volume. The RPi3 controller operates the status (on/off) of the machine under control (motor's run/stop status) through a 5V relay module (with high-level switching voltage 380V) that enables/disables (1/0 signals) the motor's relay.  
The lime mixing tank is fitted with an agitation system and actuators to continuously maintain the lime slurry in suspension prior to its delivery. The operation of the machine is initiated and terminated by on/off (1/0) signals from the RPi3 (through 1-channel 5V relay module with high-level switching voltage 380V) that sets the motor's run/stop status. This could also be accomplished manually through the on/off button provided (for practical and security reasons too). The speed of this AC motor, with variable frequency driver/regulator (VFD) is automatically controlled (increase/decrease) by the RPi3 with PWM (Pulse Width Modulation) signals (through the triac circuit) to a set value, by using as a  
Figure 7: Lime mash/slurry machine custom-build control system.  
comparative input the corresponding flow rate volume (vol), which is proportional to the velocity of the flow, from the feedback flow control loop (flowmeter volume pulse). The RPi3 receives this flow rate volume through an RS232 unit connected (MODBUS RTU) to an electromechanical counter within the flowmeter, configured as a volume pulse output unit. Then, the RPi3 controller will reduce/increase the speed (\(\omega\)) (actually voltage frequency) of the VFD AC motor until the desired volume is registered by the flowmeter. Thus, flow control is modulated accordingly to the flow rate of lime slurry out of the tank. This could also be accomplished manually through the feed buttons (+,-), or by using the up and down keyboard arrows keys, or from the GUI (Graphical User Interface) of a specific application developed for this purpose (running and displaying at a PiTFT touch screen). On the spot, on-line commissioning and configuring is performed by using auxiliary peripherals, a PiTFT Plus 480 \(\times\) 320 3.5\" TFT display with touchscreen, and a 2.4G mini wireless keyboard with touchpad. In addition, the RPi3-based controller has the ability to wirelessly connect to other mobile devices (e.g., Android or iOS iPhone) for monitoring or configuring purposes using standard connection protocols (Wi-Fi, Bluetooth).