In the field of AI hardware, combining precision, multifunctionality, and intelligence into a hardware product has become an industry trend. This case study shares how we successfully developed an innovative AI-powered multifunctional milk tea machine through meticulous hardware design, embedded AI control systems, user interface development, and a cloud data platform.
1. Background
In recent years, consumers' demand for personalized beverages and efficient production has been rising rapidly. Traditional milk tea machines can no longer meet the needs of modernized operations. The goal of this project was to develop a multifunctional AI milk tea machine with the following features:
- Precision Mixing: Optimize ingredient ratios through AI algorithms to ensure consistent taste and accuracy.
- Efficient Operation: Support simultaneous multi-channel operations to significantly increase output.
- Intelligent Management: Synchronize with a cloud platform to monitor machine status and analyze data in real-time.
- Automatic Cleaning: Simplify device maintenance and improve hygiene standards through one-click cleaning.
This milk tea machine is not only targeted at the beverage industry but can also be extended to other scenarios requiring precise liquid ratio control.
2. Technical Architecture
1. Hardware Design
The hardware forms the foundation of the device, requiring precise control, multifunctional concurrency, and efficient automation. The main components include:
Core Hardware
- High-Precision Pumps: Driven by stepper motors and equipped with closed-loop control to ensure precise liquid flow and ratios.
- Electromagnetic Valve Matrix: Facilitates the selection and distribution of various liquids (e.g., tea base, juice, syrup), supporting both independent and simultaneous operations.
- Weight Sensors: Based on strain gauge technology, combined with high-precision ADC (Analog-to-Digital Conversion) for real-time weight data collection.
- Flow Sensors: Monitor liquid flow rates and use algorithms to correct ratio errors.
- Automatic Cleaning System: Multi-channel valves and timers manage the automatic switching of cleaning liquids and air, supporting customizable cleaning processes.
Circuit Design
- Communication Interfaces: Use I2C, SPI, and UART to connect sensors and actuators.
- Main Control Chip: STM32F4 series MCU supports floating-point calculations and rich peripherals for real-time control.
- Power Management: Multi-channel stabilized power supplies ensure stable operation for high-power components.
2. Embedded AI Control System
The embedded control system serves as the brain of the device, handling data collection, real-time control, and AI inference.
Core Features
- Ratio Optimization Algorithm:
- Optimize liquid proportions using multivariate linear regression and gradient descent.
- Deploy lightweight AI models with TensorFlow Lite to enable efficient, low-power inference locally.
- Closed-Loop Control:
- Use PID controllers to dynamically adjust pump speeds and operating durations for precision dispensing.
- Perform multi-dimensional calibration based on weight and flow sensor data.
- Cleaning Logic:
- Employ a state machine design to support various cleaning modes (e.g., daily cleaning, deep cleaning).
- Parameterize cleaning workflows to enable remote configuration and updates via the cloud.
Implementation Techniques
- Real-Time Operating System (RTOS):
- Task scheduling implemented with FreeRTOS ensures fast and stable device responses.
- Sensor Data Processing:
- Use Kalman filters to reduce noise and improve data reliability.
- Hardware Acceleration:
- Optimize data processing speed using DSP instruction sets in the STM32 hardware acceleration module.
3. User Interaction System
The user interface, based on Android, provides a friendly and efficient operational experience.
Key Modules
- Ordering and Customization:
- Support QR code ordering with the Zxing library optimized for low-light environments.
- Enable beverage customization, allowing users to adjust formula ratios, sweetness, and temperature.
- Error Notifications:
- Real-time detection of machine issues, such as insufficient ingredients or pipe blockages, with alerts displayed on the interface.
- Order Management:
- Support order suspension, allowing incomplete orders to be resumed later.
- Integrate with POS systems for synchronized order management and queries.
Technical Framework
- MVVM Framework: Leverage Android Jetpack components (e.g., LiveData, ViewModel) for dynamic UI updates.
- Animation and Interaction Optimization: Use RecyclerView and ConstraintLayout to design smooth user experiences.
4. Cloud Platform
The cloud platform adopts a distributed architecture to provide real-time monitoring, data analysis, and AI optimization for the device.
Core Technologies
- Device Communication:
- Implement MQTT protocol communication with EMQX, supporting high-concurrency connections for millions of devices.
- Ensure reliable data transmission with QoS (Quality of Service) mechanisms.
- Data Collection and Processing:
- Use Kafka for real-time data stream processing, collecting device status and sensor data.
- Process large-scale data in real time with Spark, enabling anomaly detection and trend prediction.
- Store time-series data in InfluxDB for tracking device history and performance metrics.
- AI Model Training and Deployment:
- Train models (e.g., TensorFlow, PyTorch) on the cloud to optimize recommendation systems and formula suggestions.
- Manage model deployment and automation using Kubeflow.
Core Features
- Status Monitoring:
- Real-time visualization of device operating parameters such as temperature, flow rate, and dispensing volume.
- Data Analysis:
- Generate reports on sales trends and device utilization with Spark SQL, supporting operational decisions.
- Intelligent Recommendations:
- Leverage collaborative filtering algorithms to recommend popular beverage formulas based on historical data.
3. Development Process and Challenges
1. Synchronizing Multi-Channel Dispensing
- Challenge: Different liquids have varying viscosities and flow rates, complicating synchronization.
- Solution: Equip each channel with independent flow sensors and implement a distributed control algorithm for precise synchronization.
2. Optimizing and Deploying Embedded AI Models
- Challenge: Limited resources in embedded devices for running AI models.
- Solution:
- Quantize TensorFlow Lite models to reduce model size by 80%.
- Use pruning techniques to eliminate redundant computations and improve inference speed.
3. Ensuring Reliable Cloud-Device Communication
- Challenge: Network instability may lead to data loss.
- Solution: Use EMQX's offline messages and resume transmission mechanisms to ensure data integrity.
4. Enhancing User Experience and Operational Efficiency
- Challenge: Complex functionality may increase the learning curve for users.
- Solution: Simplify the beverage selection process with AI-powered recommendations and enhance user experience with dynamic interface designs.
4. Results and Value
Through systematic development and optimization, this AI milk tea machine achieved the following:
- High Precision and Consistency: Achieved milligram-level dispensing precision, ensuring consistent product quality.
- Efficient Production: Multi-channel design significantly improved production efficiency.
- Intelligent Management: Cloud-based analysis optimized device operations and supported data-driven decisions.
- Automated Maintenance: One-click cleaning reduced manual maintenance effort and cost.
5. Lessons Learned
The success of this project relied on the deep integration of hardware, embedded systems, AI technology, and cloud platforms. Key takeaways include:
- AI Empowering Traditional Hardware: Incorporating AI technology optimized control logic and user experience, providing a competitive edge.
- Cloud-Edge Collaboration: Combining local processing on devices with cloud computing achieved efficient and stable operations.
- Data-Driven User Insights: Using data analysis and recommendation algorithms enhanced operational efficiency and user satisfaction.
Developing AI hardware products is a complex system engineering task. This case study aims to provide insights and inspiration for teams working in the field of AI hardware development.