Arduino-Based DIY Tea Maker Project

With the continuous evolution of the smart home concept, you may be interested in DIYing a device that can make tea-making smarter and more convenient, adding a touch of fun to your life. TechSparks’ Arduino-based smart tea maker might just inspire you. What sets this DIY project apart is its combination of mechanical structure and electronic control, allowing it to automate the tea brewing process. Let’s get started!

Table of Contents

Required for the Project


MG99519As the executive controller for the mechanical functions of the tea brewing machine.
HC-051As a communication bridge between the mobile phone and the microcontroller to establish a Bluetooth communication connection.
Line Tracking and Obstacle Avoidance Module3Integrating multiple sensors and circuits for detecting obstacles along the path of motion, and achieving navigation, tracking, or obstacle avoidance functions by controlling motors or servos. In the Arduino tea maker project, these sensors and circuits are used to detect tea cups, enabling human-machine interaction features.
Pump1Extracting drinking water from the water tank and conveying it to the teapot.
Relay1Programming Arduino to set the operating time of the water pump, thereby controlling when the water pump turns on and off.
Voltage Buck (220V to 5V)1Powering sensors and actuators
Arduino Uno2Used to control water control robots and teapot robots
Arduino Mega1Implementing communication with Arduino Uno as a control board
16-way servo drive board1By utilizing I2C communication to control servos, and reducing the extensive use of I/O pins, it provides 16 independent channels, with each channel capable of connecting a servo.


Power Supply Issue: Due to the inability to keep the Arduino board connected to the power source at all times during device operation, power supply issues may arise. To address this, TechSparks recommends adding a charging port to the project or creating a voltage regulation module to power the Arduino.

Communication Problem: To ensure stable communication, using the Mega board as the master and the Uno board as the slave is suggested. However, there are still latency issues in communication. Here, TechSparks offers two solutions: First, utilize Arduino’s software serial communication to emulate a serial communication interface programmatically instead of using a hardware serial port. Second, consider using the Mega board to replace the original Uno board design to increase the number of communication ports.

Servo Control Functions

In this Arduino tea maker project, we use MG955 servos as actuators, and there are two ways to drive these servos: one is by using Arduino’s built-in Servo library, and the other is by using a third-party library called Adafruit_PWMServoDriver.h.

Regardless of which method you choose to control the servos, it’s essential to note that you shouldn’t rely on the “delay” function to precisely control the duration of servo rotation. The “delay” function can only provide a certain amount of delay to ensure that the servo has enough time to complete its rotation or perform other actions. The specific duration and angle of servo rotation are determined by the parameters and commands you set in your code.

Servo Library

Here are explanations of some functions and operations related to servos in Arduino:

  • attach(): Used to specify the pin to which the servo is attached.
  • write(): Used to rotate the servo to a specified angle.
  • writeMicroseconds(): Sends commands in microseconds to control the servo’s rotation.
  • read(): Reads the current angle of the servo.
  • attached(): Checks whether the servo is connected to a pin.
  • detach(): Detaches the servo from the pin to free up the pin for other purposes.

Please note that typical Arduino boards in the market usually support 14 pins for connecting servos. In this project, we will primarily use the attach() and write() functions to control the servo’s movement.

Adafruit_PWMServoDriver.h Library

The Adafruit_PWMServoDriver.h library is a tool for controlling a 16-channel servo driver board, usually provided in the form of a compressed file. Here are the main functions and their purposes in this library:

  • Adafruit_PWMServoDriver(uint8_t addr = 0x40): Constructor function, which can specify the default address as 0X40 for the Adafruit_PWMServoDriver library.
  • begin(void): Initialization function, no parameters required.
  • reset(void): Reset function, no parameters required.
  • setPWMFreq(float freq): Sets the refresh frequency, typically using 60Hz.
  • setPWM(uint8_t num, uint16_t on, uint16_t off): Sends a pulse with a specified interface number to the 16-channel servo driver with a pulse length count of “off.”

Please note that if you want to use the servo driver board, you will also need to include the following two built-in Arduino libraries: #include <SPI.h> and #include <Wire.h>. These two libraries are used to support I2C communication.

Servo Operating Speed

Essentially, a servo motor is a special type of electric motor. By observing its operational curve, it can be noted that when it starts, its rotation speed is relatively slow, gradually accelerating until it stabilizes. Additionally, when selecting servos for your project, it’s important to be aware that servos from different manufacturers may have variations in their speed, especially at different voltages. Taking a 9-kilogram-copper-tooth servo as an example, its unloaded speed at 4.8 volts requires 140 milliseconds to complete one full rotation, which is roughly 2.4 milliseconds per degree. This means that if you provide it with a control signal of only 120 milliseconds, it won’t complete a full rotation unless you increase the voltage. Similarly, if you give it a 200-millisecond signal, it will still use only 140 milliseconds to complete the rotation, leaving the remaining 60 milliseconds idle.

Therefore, to better control the rotation of the servo, we can divide the required degrees of rotation based on the two characteristics mentioned above. Next, I will use an example to illustrate how to address the issue of servo speed. In this article, we are using the first control method of the Servo.h library and have chosen a 9-kilogram-copper-tooth servo with a supply voltage of 4.8 volts to operate in an unloaded state.

					#include <Servo.h>
Servo servo_2;         // Create a global Servo variable
int Degree = 0;        // Record the current angle
int Target = 0;        // Record the target angle to rotate to
int Velocity = 20;     // Record the delay time per degree, acting as rotation speed
int Acceleration = 1;  // Acceleration
int readnum = 0;       // Used to store random numbers
void setup() {
  servo_2.attach(2);  // Here, I'm using pin 2 for the servo
void loop() {
  Target = random(1, 180);  // Generate a random number as the target angle
  Degree = Run_Servo(Degree, Target, Velocity, Acceleration);  // Get the current angle
  delay(1000);  // Delay for 1 second before the next rotation
// Servo execution function, taking current degree, target degree, speed level, and acceleration as input
int Run_Servo(int Deg, int Tar, int v, int a) {
  int flag = -1;            // Record whether to rotate clockwise or counterclockwise
  int Decode_Motor_Degree;  // Record the degree to be rotated
  int Variable = 0;         // The difference between two degrees
  // Calculate the degree difference
  Variable = Deg - Tar;
  // Determine if the degree difference is positive or negative and set the flag
  if (Variable >= 0) {
    flag = 1;
  } else {
    flag = -1;
  for (int i = 1; i <= Variable * flag; i++) {
    Decode_Motor_Degree = Deg + i * flag;
    servo_2.write(Decode_Motor_Degree);  // Rotate the servo one degree at a time
    // Calculate the delay time for each degree, ensuring it's non-negative
    int delayTime = Velocity - a * i;
    if (delayTime < 0) {
      delayTime = 0;
  return Tar;  // Return the target angle after completion

Conceptual Process of the Arduino Tea Maker Project

In the early stages of project development, the original plan was to use a single Uno board to control the entire tea maker. However, due to limited technical expertise, this idea was eventually abandoned. If you are like me, a beginner in electronic projects, it is advisable to use multiple Arduinos to simplify your design. As you can see, this project involves the use of three Arduinos. The following iterations were made during the project’s creation to achieve effective communication:

Version 1: The initial plan involved using an Uno board to control the robotic arm while manually recording the time required for each action. Additionally, a Mega board served as the upper controller, tasked with sending instructions to the lower controllers and then entering a delay state to await the completion of actions by the lower controllers. However, this approach proved time-consuming, labor-intensive, and prone to recording errors due to manual efforts.

Version 2: To address the time coordination issue, the second version considered sharing a time reference among the three Arduino boards. It’s worth noting that detailed research and implementation of time synchronization were lacking in this approach. Specific attempts included using the Mega board to establish I2C connections with two Uno lower controllers to achieve time synchronization. However, due to limited knowledge of Uno’s I2C addresses and communication mechanisms, this approach was eventually abandoned.

Version 3: Borrowing the concept of the three-way handshake in network communication, but with some modifications. In this scheme, if the upper controller does not receive a response from the lower controller, it remains in a waiting state and does not continue to send new instructions. The benefit of this modification is preventing situations where the previous action has not yet completed, but other robotic arms have already started working, effectively avoiding collisions and conflicts between the robotic arms.

Problems & Solutions

Code is Correct but Not Running

Use a standalone, simple servo driver to test the problematic servo separately to determine if there is an issue with that particular servo. If the servo exhibits clear issues, such as overheating, it may need replacement.

If the first step is not the issue, then check the input voltage of your device and ensure it matches the specifications of the servo you purchased.

Inspect the 16-channel servo driver board for issues. Confirm that the servo in question is connected to the driver board correctly, and also check if the output voltage of the driver board is within the normal range (usually around 5V).

Check for anomalies on the servo driver board; some servos may behave abnormally during motion and affect the signals of other servos.

Lastly, inspect the connections. Ensure that the servo’s signal wires are well-connected without any looseness or disconnections.

Severe Jitter

Check the connections of other servos on the same servo driver board or breadboard to ensure they all operate correctly and do not have any conflict issues; otherwise, they may interfere with the entire system.

More content you may be interested in

How to Enable Multi-Core on ESP32 Microcontroller
How to Enable Multi-Core on ESP32 Microcontroller

This comprehensive guide elucidates the process of enabling multi-core functionality on the ESP32 microcontroller, leveraging its dual-core architecture for enhanced parallel processing capabilities. Through detailed

Arduino MQ-3 Alcohol Sensor Project
Arduino MQ-3 Alcohol Sensor Project

Creating an alcohol sensing project with an MQ-3 sensor and Arduino allows for accurate alcohol concentration monitoring in environments like bars and factories. The MQ-3

Arduino Temperature Alarm Project
Arduino Temperature Alarm Project

This Arduino temperature alarm project effectively demonstrates how to create a practical temperature monitoring system. By utilizing the LM35 temperature sensor and a buzzer, it

Arduino Breathing LED Project
Arduino Breathing LED Project

A breathing light is an LED lighting effect that simulates the human breathing process, gradually increasing or decreasing in brightness within a specific cycle. This

Scroll to Top