A Robotic Tea Steeper
Embedded Project By Kayla Rossi.
This system consisted of multiple elements that combined together to make a robotic tea steeper. It cumulates mechanical and electronic parts through python programming in a linux operating system on a raspberry pi 4 (RPi) to create one large embedded system. This system works using multiple servo motors to dispense loose leaf tea, as chosen by the user, into a diffuser. It then pulls the diffuser through a self-closing ramp and dips the diffuser into a mug of hot water. Meanwhile, a countdown for the tea brew starts on the piTFT screen, the diffuser is steeped by being slightly lowered and lifted in the hot water. Once the steeping time is completed, the diffuser is withdrawn from the mug and the tea is brewed.
The mechanical design of the system evolved as the idea become more refined after idea conception. As depicted in figure 1, the original sketch involved a complex design of rotational to linear motion mechanisms and two continuous motors. After some discussion during project proposal, a few idea improvements were presented for consideration. One idea was to consider integrating a way for hot water to be automatically brewed and placed into position under the diffuser. Another idea was to incorporate a way to automate dispensing tea into a diffuser thus replacing the idea of a user putting a previously filled diffuser into the brewing mechanism. Lastly, the brewing mechanism that was used in the proposal, as seen in figure 1, was suggested to utilize a standard servo motor in place of the rotational to linear motion actuated by a continuous servo. This combination of ideas sparked larger changes for the entire mechanical design.
An amount of time was spent on considering how to involve a keurig style machine to heat up hot water and use a turn-style/lazy-susan type mechanism to swivel the mug into location under the diffuser. The complications that surfaced with this idea were largely surrounding concerns of weight. The combined weight of a ceramic mug plus 8-12 ounces of water, approximately as much as 1 pound, would be a heavy load for a small geared DC or servo motor to move. A more thorough motor selection would be needed in this regard and it was felt that the general idea addition did not add any significant value to the overall project.
It was decided that a more value-added path for the project direction was to incorporate a way to dispense tea into the diffuser before it was delivered into the mug. The original idea did allow for three types of tea to be selected by user input that would have an assigned brewing time to each. The assigned brewing time would be a specified duration that the diffuser would be in the hot water, to be discussed in more detail in programming design section below. Three types of tea were chosen to be dispensed - black tea, green tea, and herbal tea. The manner in which the teas were to be dispensed is based on a revolver/hopper design and as such the dispenser is referred to as the teavolver. The final overall system design can be seen in the CAD assembly in figure 2.
The manner in which each motorized part would actuate was straightforward. A standard servo would be needed for the teavolver and pacman plate. These parts would need to rotate to a specific angle each time, making the standard servo ideal. The motor that would be responsible for reeling in the diffuser through the self-closing ramp would need to be a continuous motor. A DC motor was ruled inadequate due to very low torque, as such, a continuous servo motor was used. All of the servo motors that were used were parallax motors and datasheets can be located in the references section.
The electrical design was relatively simple due to the nature of servo motors. Three GPIO (general purpose input/output) pins were used, one for each servo. The two standard servo motors were connected to the the two GPIO pins that are associated with hardware PWM (pulse width modulation) within the RPi, pins 12 and 13. As can be seen in figure 3, each GPIO was connected to a 1 kOhm resistor to protect the RPi from any feedback current. The resistor then connected to an LED which provided a visual feedback that the GPIO pin was producing output, and the other end of the LED went to ground. In parallel with the LED was the signal input for the servo motor. Each motor was also connected to input voltage from 6V power supply (battery pack) and connected to a common ground. The common ground in the circuit comes from the RPi GPIO breakout header and is connected to the ground header on the protoboard. All equipment in the system is connected to the same common ground.
The continuous motor was connected in the exact same manner as the two standard servos, the only difference being that it was not connected to a GPIO pin that was associated with hardware PWM in the RPi. It was connected to GPIO pin 19.
All of the programming for the system was conducted in python on a linux operating system, run on the RPi. The script that provided all of the functionality of each component for the whole system was called main.py. Numerous test scripts were created to assist in determining the necessary motion of the standard and continuous servos. This was then fed back into the main.py script and implemented. Additionally, the touchscreen prompts and buttons were first tested in test scripts. The piTFT display and touchscreen used pygame, a program that assists in visual display using Python language. The test scripts for the pygame aspects insured proper functionality of the pygame features and display before integrating into the main.py script.
There are two menus in the system that require user selection. The first menu presents tea types, i.e. black tea, green tea, and herbal tea, and the second menu lists tea strengths, i.e. weak, normal, strong. The tea strengths determine the duration of steep time per tea type as can be seen in Table 1. The final screen on the piTFT shows the countdown of time in minutes and seconds based on the prior selections of tea type and strength. In addition to these various selections, each screen has an option to quit the program by utilizing a programmed quit button displayed on the piTFT screen for the first two menus, or the indicated piTFT physical button while the countdown is running. The physical button was a necessity on the countdown screen due to the usage of time.sleep to control the continuous motor in that particular section of code. When using time.sleep, the touchscreen is unavailable to recognize or read touches during 4 out of the 5 seconds between the usage of time.sleep, thus rendering the touchscreen unusable during that time.
Multiple functions were needed in the code to keep it condensed and to keep the motor actuations concise for each call. The following were functions created for the specified motor actions:
The script was run with one main while loop. The loop had two if statements that represented the two menus on the piTFT. They not only consisted of the display for each menu and associated touch recognition, but they also set the teavolver into the correct position based on tea selection and fed the proper steep time into the countdown function based on user selection.
At the start of system assembly, all parts were hot glued to the base plane or to each other. The thought was that if any parts interfere, they would not be permanently mounted and thus would be easier to be relocated and realigned within the system. A few parts in the original design were not designed with alignment references and this lead to interference when parts were starting to be assembled, especially when attached to motors. When some other parts needed to be redesigned, alignment references were added to avoid some of the alignment problems.
One of the first issues that was noticed during testing was that all of the cylinders in the teavolver were unable to be reached by the servo motor. This took a while to realize that the servo only had a travel distance of 180 degrees instead of 360 degrees. The part was designed with the intent that the motor could reach 180 degrees one direction and 180 degrees the opposite direction. After reading through the Parallax data sheets, it was understood that that thought was incorrect and the teavolver had to be redesigned to include all three tea holes within 180 degrees of range (figure 4). The two outer holes were tangent to the midplane at 180 degrees, to ensure the full diameter of the circle would be reachable. Additionally, a small recessed hole was added to the teavolver and the pacman plate on the centerline of each to help center the parts relative to the respective motors. Lastly, during the redesign a deduction in part size for the teavolver, pacman plate, and the rectangular base plate was introduced. The deduction in size was a result of various cascading geometric factors between the parts.
The self-closing slide was not fully redesigned to the extent that it was reprinted, but it did have significant modification using cardboard. A more narrow ramp was created internal to the slide that allowed for more of a cradle for the diffuser, making it more stable in position. Additionally, two flat layers of cardboard were added to the base at the exit of the slide to create a tighter exit location. This encouraged a more secure close on the diffuser. Another addition to encourage a secure closure on the diffuser after tea was dispensed, was the addition of magnets. Two very strong magnets were glued to the outside of the diffuser on either side of the shell. This addition does mean that the tea would not necessarily be drinkable due to the glue in hot water. As such, this is more of a prototyped system overall due to this addition. It would be suggested that either a diffuser that already is constructed using magnets is used in the system, or a custom diffuser is made for the system that utilizes magnets for closure. In addition to the magnets on the diffuser, a weak flexible magnet was used at the starting point of the slide to encourage the diffuser to sit in a more upright, right-angled position for tea dispensing. Because the magnet in this location was weak, it easily released the magnet on the diffuser, allowing for a guaranteed closure when the diffuser was pulled through the slide.
As stated in the program design section, in an effort to test each aspect before converging on one large main script, various smaller test scripts were written specifically for various components in the system. Once these were proven to work, they were implemented into main.py. The programming for the standard and continuous servos took some time to understand and as such, individual test codes were written. When using the continuous servo, it was only vital for the system to use a clockwise and counterclockwise action. These actions were taken from the Parallax data sheets on pages 5 and 6, shown under Communication Protocol. To gain a clockwise rotation, the pulse width of 1.3 ms is needed and to gain a counterclockwise rotation, a pulse width of 1.7 ms is needed. The respective duty cycles were calculated from these numbers, 6.5% and 8.5% for clockwise and counterclockwise, and were hardcoded into the main.py script. The second variable needed for actuation of the continuous motors was time. The way in which this was implemented in the code was to set the duty cycle for the respective direction that was desired and follow it with a time.sleep call of a specified number of seconds, then change the duty cycle to 0% to stop the motor action.
The standard servo had some more complications when determining how to articulate the desired motor angles. Looking at the Parallax data sheets, on page 1 it is listed that the communication band from 0 to 180 degrees uses the pulse widths of 0.75 ms to 2.25 ms. An equation was developed to associate these limits in duty cycle percentage with an input angle variable. This allowed a streamlined method to dictate angle positional output of the motor through a duty cycle input. The equation that was developed was derived to be: dutycycle = ((((top of range - bottom of range) * angle) / 180) + bottom of range), which resulted in the following when applying the specific requirements for the Parallax motor: dutycycle = int((((7.5 * angle) / 180) + 3.75) * 10000). The 10000 factor was needed in order to scale the duty cycle to be in the proper input range. Hardware PWM was used for both standard servo motors, and as such, the duty cycle is multiplied by 1,000,000 as per specifications. This equation was incredibly useful in the script for easy motor actuation and had successful output.
There was overall success with the final system as demonstrated and the system worked as intended, meeting the majority of goals originally set forth. The only goals that were not reached where those of implementing an emergency stop feature that would stop the countdown when pressed and lift the diffuser out of the mug. The user could then press resume that would continue the countdown and place the diffuser back into the mug. Additionally, it was originally stated that the piTFT would alert when the brewing was complete. In the current design, the piTFT returns to the linux command line when complete. It was not thought to be value added to add in an alert screen when the brewing was complete since there is a visual indication that brewing is complete with the diffuser lifting out of the mug upon completion.
The panic stop and resume button did not end up working due to the steeping action of the continuous motor. This motor was programmed systematically using time.sleep to control the duration of time the motor was actuated. The piTFT did not recognize any touches on the screen when the motor was performing the functions that went through the steeping action of lower and raising the diffuser slightly in the mug during the steeping time. The panic button was considered a lower priority item than the implementation of the steeping motor action which more readily assisted in the process of tea brewing.
Some aspects that can be considered for future work include more refined prototyped parts such as the self-closing ramp and the teavolver. It was incredibly tedious and difficult to refill the teavolver once the tea had been dispensed, especially the green tea cylinder. The green tea cylinder sits at 60 degrees with respect to the motor positions. Due to the motor position and the design of the motor mourning points, there is a gap over the green tea cylinder that is far too small to reasonably refill by hand or by small paper funnel; The refill has to be done a few leaves at a time. This could be solved by redesigning the teavolver to have a standoff connected to the motor instead of the motor being directly attached to the top of the teavolver. Additionally, it would help if the motor mount for the teavolver had some holes in it that would allow one to look down through that area of the system and see the parts below it.
The self-closing ramp also needed the addition of cardboard inserts in order for the diffuser to properly nest inside the mechanism and allow the diffuser to close. Due to the inability to reasonably prototype in real time, the cardboard additions were the best solution given the circumstances and as such the whole part should be redesigned with the inclusion of the cardboard geometries.
Project Contribution: All aspects in totality.