<<

C-4P5 Filling Machine

Aaron Landy

December 3, 2013

University of Florida

Department of Electrical and Computer Engineering

EEL 5666 – IMDL – Formal Proposal

A. Antonio Arroyo, Eric M. Schwartz

TA Andrew Gray

1

1. Abstract 3 2. Executive Summary 4 3. Introduction 5 4. Integrated System 6 5. Platform 9 6. Actuation 11 7. Sensors 13 8. Behaviors 20 9. Conclusion 20

2

1. ABSTRACT This report details the design, operation, and development of a machine to automate bottling homebrewed . This stationary machine is composed of a grasping claw that traverses a horizontal track seeking empty . When a bottle is found it is dragged into position beneath several filling and capping actuators in turn. The system is controlled by a master Raspberry Pi development board and two Arduino Mega microcontrollers. The platform is composed of a wooden structure to suspend actuators above the bottles, along with several linear motion axes based on Makerslide aluminum extrusion rails.

3

2. EXECUTIVE SUMMARY This report details the design, operation, and development of the C-4P5 beer bottle filling and capping machine. This machine automates the labor intensive but necessary task of bottling homebrewed beer. Cleaned, sanitized bottles are retrieved in turn, filled with beer, and then capped. The machine is stationary. A grasping claw traverses a horizontal track using a camera and a laser “tripwire” to find a bottle along the path of the track. When a bottle is found, the claw grasps the bottle and pulls it to the filling position beneath the filling and capping mechanisms. It retrieves each bottle in turn until all are filled and then returns to a waiting position. Bottles can be one of two standard sizes, 12 or 22 oz. A camera is used to determine the size of the bottle by calculating the cross-sectional area of the bottle's image and extrapolating volume and height.

Three mechanisms perform the filling and capping. First is a stainless steel connected to the filling valve output. This tube is moved vertically (the machine's z-axis) into and out of the bottle. The second mechanism is a magnet. Before bottles are placed in the waiting line, each is manually sanitized and a cap is be placed over the top to prevent airborne contaminants from entering the bottle. Sanitizing and cap dispensing is done manually by the operator before starting the machine. Before filling, the magnet, mounted on a moving z-axis, is lowered into contact with the cap and then energized to pick the cap off the top of the bottle. After filling, the electromagnet is lowered back to the height of the bottle and de-energized, replacing the cap on top of the bottle. The final mechanism is a high-force linear actuator, also mounted on a moving z-axis. A capping bell will be mounted to the end of the actuator. When the actuator is engaged, the bell will be forced down around the cap, crimping it onto the top of the bottle. After filling and capping have completed, the finished bottle is moved out of position and the grasping claw searches for another bottle.

C-4P5 is controlled by a master Raspberry Pi SoC board, which also drives two Arduino Mega 2560 slave controllers. A python application running on the Raspberry Pi handles serial communication between each microcontroller and provides user feedback through the Raspberry Pi’s LCD screen. Communication is conducted via well-formed serial packets through a tree- style master-slave network. The Raspberry Pi Camera Module, along with OpenCV-based C++ software, is used for bottle detection. The two primary linear motion axes are based on Makerslide extruded aluminum rails. A recycled ATX power supply unit (5V and 12V) and laptop charger (20V) provide power to the system.

4

3. INTRODUCTION Home beer is a fun and rewarding hobby, but bottling beer can be a difficult and frustrating process. Many brewers quickly shun bottles in favor of kegging their beer, but not even those brewers that do can avoid bottling the occasional batch. The bottling process begins with cleaning and sanitizing each bottle. Then each bottle is filled by lowering a filling wand into the bottle until the level reaches the top. The wand is then removed (leaving a precise head space) and a cap is placed on the bottle. Next, a capper is used to crimp the cap on the bottle. Finally all bottles need to be cleaned, dried, marked or labeled, and stored for aging. While the all-day brewing process is creative and rewarding, bottling is a repetitive, dreary, repetitive task better left to machines than time-crunched hobbyists.

To simplify the bottling process, I designed and built a beer bottle filling and capping robot. The objectives of this machine are to fill and cap each bottle with a precise amount of beer without contamination, oxidizing, or otherwise damaging or wasting the beer. Because homebrewers recycle bottles from different sources to keep costs low, the machine must accept bottles of varying size and shape, filling each with the Figure 2 Manual wing capper Figure 1 correct volume of beer. To ensure the Manual filling process is automated, the machine must find and retrieve bottles autonomously to free the brewer from feeding each bottle one at a time. This machine is stationary but mechanically complex, requiring several primary actuators, each mounted on moving linear axes.

While large scale commercial bottling machines are commonplace in the beverage manufacturing industry, there are few examples of automated bottling equipment available to home consumers. However, while the overall system design is unique, the design relies heavily on open-source hardware and software systems which aided significantly in the design process and budgeting. Examples of these open systems include Arduino, Raspberry Pi, the Makerslide linear motion system, among others.

This report details the design and operation of the C-4P5 automated beer bottle filling and capping machine. The report details the design and operation of the overall system, the physical platform, actuators, sensors, and autonomous behaviors.

5

4. INTEGRATED SYSTEM This machine is stationary. A grasping claw moves along a horizontal track (the machine's x- axis), using a camera, infrared range finder, laser tripwire to find a bottle along the path of the track. When a bottle is found, the claw grasps the bottle and pulls it to the filling position beneath the filling and capping mechanisms. It retrieves each bottle in turn until all are filled and then returns to a waiting position.

Bottles can be one of two sizes, 12 or 22 oz. A camera is used to determine the size of the bottle by calculating the cross-sectional area of the bottle's image and extrapolating volume. This also determines the height of the bottle for later correct positioning of the capping mechanisms. Beer is fed from a large plastic bucket with a port in the bottom. A 12V solenoid valve opens and closes during filling. Fill volume will be determined based on calibrated flow rate.

Three mechanisms perform the filling and capping. First is a stainless steel tube connected by flexible food-grade tubing to the filling valve. This tube is moved vertically (the machine's z- axis) into and out of the bottle. Because beer must be dispensed into the bottle with minimal agitation to prevent oxidation or contamination, the open end of the filling tube must be as close as possible to the interior bottom of the bottle.

Filling Wand

Varying bottle size: 12 oz or 22 oz

Cap Bottle Electromagnet Claw

Figure 3 Block diagram of physical design and operation

6

The second mechanism is a magnet. Before bottles are placed in the waiting line, each is manually sanitized using an acid-based food grade sanitizer and a cap is placed over the top to prevent airborne contaminants from entering the bottle. Sanitizing and cap dispensing is done manually by the operator before starting the machine. Before filling, the magnet, also mounted on a moving z-axis, is lowered into contact with the cap and then energized to pick the cap off the top of the bottle. After filling, the magnet is lowered back to the height of the bottle and de- energized, replacing the cap on top of the bottle.

The final mechanism is a high-force linear actuator, also mounted on a moving z-axis. A capping is mounted to the end of the actuator. When the actuator is engaged, the bell is forced down around the cap, crimping it onto the top of the bottle.

After filling and capping have completed, the finished bottle is moved out of position and the grasping claw searches for another bottle. When no bottles remain the claw returns to its starting position to await a start command.

The block diagram below illustrates the overall design of C-4P5’s electronic systems. The Raspberry Pi SoC handles primary system control and image processing. It controls and communicates with two Arduino Mega 2650 microcontrollers, connected via USB. A python server handles master-slave communication, including forwarding commands from one Arduino to the other. The Raspberry Pi also executes a C++ OpenCV application to detect bottle size.

Arduino boards were chosen for their rich feature and peripheral set, as well as ease and familiarity of development and availability of support. Each Arduino runs a nearly identical software platform. This platform is based on the standard Arduino bootloader and development environment, with the addition of the open source real-time operating system NILRTOS. This is an extremely small, statically allocated threaded operating system, which enables easy scheduling of concurrent real-time tasks.

The final design of the software and electronics systems successfully meets the needs of the system’s objectives. While not a lean or simple design, the multi-controller design approach offers many advantages to a single-controller design. Use of discreet controllers for discreet physical system components enables easily modularizing the system. This modular design allowed development to proceed independently for all elements of the system, critical to development a complex system in a short time period. Additionally, the use of standardized devices, software, and communication schemes allowed quick development cycles and easy final integration of the overall platform. This easy integration simplified the final design and calibration of complex behaviors.

7

Ctrl Stepper Ctrl Drive 20 V Driver Motor 12 V Ctrl Claw Driver Ctrl Claw/Motor

Sig Sharp IR 5 V Rangefinder Arduino Mega LASER ATmega2560 Pwr En 12 V Bottle Detect Horizontal Axis Emitter Controller

CDs Cell Signal 5 V Bottle Detect Receiver 10K Power Supply

5 V ATX PSU 5 V l a r t

t 12 V a C

D 3.3 V -12 V 5 V

Ctrl HV PSU Raspberry Pi Raspberry Pi USB 20 V Main Controller Img Camera C a t t r a l D

Ctrl Stepper Ctrl Drive 20 V Driver Motor Capper 12 V Ctrl Capper Driver Ctrl Arduino Actuator Leonardo Pwr En ATmega32U4 Cap Magnet 12 V Vertical Axis Controller Pwr En Fill Valve

5 V

Figure 4 System and electronics block diagram

8

5. PLATFORM The C-4P5 platform is constructed primarily of wood boards, steel hardware, and machined aluminum brackets and structures. The primary components of the platform are the claw cart, an H-shaped tower, and the bottle track.

The claw cart module is responsible for searching for, retrieving, and handling bottles. This module is the system’s primary autonomous actuator and sensor platform. The figure below shows the final design of the claw cart. The cart is composed of an aluminum baseplate with Makerslide v-groove wheels. This platform rides freely on the Makerslide rails. Mounted to the baseplate is a Vex Robotics mechanical claw and claw drive motor, a driving stepper motor, and a raised aluminum electronics-mounting platform. This structure was hand machined from aluminum brackets. Mounted to the top of the platform is a stepper motor driver, Ardunio Mega, and DC motor driver. Raised above the other electronics, the primary Raspberry Pi and Raspberry Pi camera are mounted with a clear view of the bottles and bottle track. A single rubber wheel is mated the shaft of the stepper motor. This wheel spins against a raised aluminum raceway and is responsible for moving the cart and bottles along the track.

Figure 5 Front side angle of actuator tower

9

Figure 6 Rear side angle of actuator tower

The tower suspends the filling and capping actuators over the bottle track. This tower is the most structurally critical element in the design; it must be precisely aligned to ensure that bottles are properly positioned under fill tube and capping actuator. Additionally, the tower must withstand the capping force applied to the bottle and cap without damaging itself.

Mounted to the tower is a second Makerslide platform which positions the fill tube and magnet. This platform has a similar configuration, including Ardunio Mega, stepper motor, and stepper motor driver, to the claw cart. However, rather than a wheel based motion system, the vertical actuation is performed by screw drive. The stepper motor is mounted shaft parallel to the axis and is mated to a 5/16 inch threaded rod. This rod is threaded through a plate mounted at the top of the axis. As the motor turns the screw the platform is raised of lowered, enabling the fill tube to be raised and lowered into place.

The most challenging elements of the platform design were designing a large platform stable enough to reliably support heavy actuators in a real-world environment, while also portable and capable of withstanding the internal forces applied by the capping actuator. This required several additions of steel reinforcements at the critical energy transfer points in the structure.

In the end the design met the needs of the operating objectives, however some improvements could be made. An ideal platform would be entirely metal and machined by computer control,

10 preventing the difficulty of aligning all system elements using hand machined wood and metal pieces.

6. ACTUATION The system’s primary actuators include the capper, , claw, magnet, and drive motors. Actuator selection was critical to ensure that the machine would operate correctly under the strain of real-world forces. Because size, weight, and power were less significant in a non-mobile design, most actuators were chosen with resiliency, reliability, and over-performance in mind. Because of the large forces involved in capping and the careful movement of heavy bottles and liquids, component ratings were chosen to well exceed minimum tolerances whenever possible. The capping actuator was purchased on eBay as industrial surplus. It operates at 24V and is rated to apply a 2000N force. This actuator was difficult to mount, and required an extremely complex aluminum structure to be added to successfully mate to the capping bell. While the large force was necessary to ensure successful capping, design of the platform to withstand the force was also a difficult design challenge.

Figure 7 Capping actuator

Stepper Motors drive each linear motion axis. Stepper motors were chosen to enable exact positioning of each actuator and provide strong holding torque to hold actuator positions. Two identical stepper motor and driver pairs are used in the system. The motors are rated for a holding torque of 62 Oz-in at 1.68 A per phase. The motors are NEMA 17 sized.

11

Figure 8 NEMA 17 stepper motor

The grasping claw was purchased from Vexbotix. It is mated to a DC motor which opens and closes the mechanism. This claw replaced an earlier purchased claw from Sparkfun Electronics that was unable to open large enough to accommodate bottles. The drive motor mated to the claw frequently stalled when faced with the high torque of moving the claw from a stationary position. This requires the control software to slowly open the claw to prevent stalling. The claw motor is driven with 12V by an L298H based DC motor driver.

Figure 9 Vexbotix claw and drive motor mounted to front of platform

12

The cap electromagnet was purchased from eBay. It operates at 12V and is rated to lift 55 kg. It is driven by a single high-power MOSFET.

Figure 10 Cap electromagnet

7. SENSORS The sensors in the design are intended to locate bottles and provide position feedback. These sensors include the Raspberry Pi Camera Module, bump switches, a laser tripwire, Infrared Rangefinders, and an infrared reflectance sensor. A “laser tripwire” is used to detect bottles entering range of the claw. A CDs cell, connected to a 10 KOhm pull-up resistor and an Arduino analog input pin, is excited by a 5 mW red laser diode driven at 12V. When no bottle is present, the laser shines directly on the cell, fully exciting it and lowering its resistance and correspondingly the voltage applied to the analog input pin. When a bottle is encountered the beam is blocked, the resistance of the cell increases and the corresponding analog voltage increases. By monitoring the analog value the software can detect a bottle and respond accordingly, such as by closing the claw.

13

Figure 11 "Laser tripwire" composed of CDs cell and laser diode

An optical encoder is used to accurately track the position of the claw cart through the system. In order to correctly position bottles under each actuator, exact position of the claw must be known. To this end a Fairchild Semiconductor QRD1114 infrared reflectance sensor is mounted to the claw platform 2 mm above the track. The QRD1114 consists of a matched pair of 940 nm optical transistor and LED. The LED is excited and when objects enter proximity of the sensor a portion of the emitted light is reflected back to the transistor. The transistor output is connected to an Arduino analog input pin. The surface of the track is lined with an alternating pattern of black and white 2.5 mm bars. As the sensor passes over each alternating bar, the reflectance of the track varies. When passing over a white bar, higher reflectance decreases the voltage on the analog pin. When passing over a black bar, lower reflectance increases the voltage on the analog pin. By periodic monitoring of the analog pin, the software can detect each black to white or white to black transition and is thereby able to precisely determine traversed distance.

14

Figure 12 QRD1114 Infrared Reflectance sensor mounted to the rear of the claw platform above the pattern of alternating black and white 2.5 mm bars

A Sharp GP2Y0A02YK0F Infrared Proximity Sensor purchased from Sparkfun Electronics is mounted to the moving claw platform and used to measure position of the claw platform by determining range to a fixed backdrop. This sensor provides the range necessary to allow for a large number of bottles to be prepared for the machine. This sensor provides one of several complementary methods of determining claw platform position along the track. Because of the shape and optical properties of the glass bottles, these sensors are not able to accurately range distance to a bottle, precluding their use directly in identifying bottles as originally intended.

Figure 13 Sharp GP2Y0A02YK0F Infrared Proximity Sensor

15

This robot’s special sensor system is a camera used to measure the volume, height, and position of empty bottles in the bottle feed line. The objective of the sensor is to identify the presence or absence of bottles in the bottle feed line. If a bottle is detected, the bottle’s 2D cross-sectional area is to be computed and extrapolated to categorize the bottle’s volume. This data is also used to determine the height of the bottle to enable exact positioning of filling mechanisms.

This system is composed of a Raspberry Pi SoC board with a Raspberry Pi Camera Module, mounted rotated 90 degrees to a raised “periscope” position at the back of the moving claw platform. This position and orientation centers the frame to the desired position and enables fitting tall bottles fully into frame. This module was chosen for its good image quality, as well as the ease of development when used with a Raspberry Pi development board. This module is interfaced using a direct hardware camera interface provided by the Raspberry Pi’s BCM2835 system-on-chip.

Figure 14 Raspberry Pi Camera Module

16

Figure 15 Raspberry Pi and camera "periscope" mount above claw platform electronics mounting structure

The Raspberry Pi Camera Module is composed of a smartphone class image sensor mounted to a small daughter board that connects via ribbon cable to a dedicated Camera Serial Interface (CSI) port. This direct interface to the Raspberry Pi SoC enables video streaming without requiring USB transfers, a common bottleneck in embedded image processing applications.

The Raspberry Pi Camera Module is supported by open source drivers released by the Raspberry Pi Foundation. These drivers have been modified to directly pass frames capture from the camera into an OpenCV application at rates near 10 to 20 frames per second. This frame rate well exceeds the requirements for this application.

All processing for this sensor is performed using OpenCV. OpenCV was chosen for its rich feature set, familiarity, and availability of tutorial and reference material. Two alternative approaches to processing the images are being developed simultaneously.

The first processing approach involves is a simple filtering and pixel summing. When the OpenCV application receives a grayscale frame from the camera driver, an inverse binary threshold is applied, converting the image to a binary bitmap, ideally with all pixels within the bottles equal to ‘1’, and all other pixels ‘0’. This is accomplished using a calibrated threshold value dependent on ambient light conditions. The series of images below shows two bottle images with several different threshold levels. The resulting binary matrix is then summed, yielding a count of all non-zero pixels. If thresholding is properly calibrated, this value should be an estimate of the bottle’s cross-sectional area. This image can also be used to measure the span of non-zero pixels to determine the bottle’s height.

17

The second processing approach makes use of OpenCV’s out-of-the- advanced processing features, specifically the SimpleBlobDetector module of the feature extraction framework. This detector identifies blobs in each image through first successive binary thresholding to produce several filtered binary images. Then contour finding is performed using Canny edge detection and used to extract connected components in the image. Found components are grouped according to keypoint centers across each binary image to determine blob centers and dimensions.

Figure 16 Example of various threshold levels on bottle detection

18

Figure 17 Examples of detected bottles and their sizes for three different bottle shapes. The two bottles at left are both 12 oz, while the bottle at right is 22 oz.

Both approaches take as input a grayscale frame from the camera and return an estimation of bottle area and height. The simple approach is less computationally demanding, enabling higher frame rates or reduced CPU load. The second approach is potentially a more robust system, more likely to fail due to an obstruction or unexpected error. The final design will likely employ a hybrid approach.

At this stage, the resulting area and height estimate are measured in pixels. This pixel value must then be correlated to physical measurements. This conversion is performed using the known position of the moving camera and must be calibrated according to varying bottle shape. The following procedure will be performed to calibrate measurement conversion:

1. Place a bottle of known size and height at known position on the track.

2. Allow the camera to move across its entire range

3. Record area and height pixel measurements at regular intervals during cart motion

4. Repeat for all available bottle sizes at multiple positions.

5. Use recorded data points to characterize conversion operation.

19

The sensor system is able to calculate the 2D pixel area of a bottle image at a rate near 5 frames per second.

8. BEHAVIORS Because C-4P5 is an extremely large and complex mechanical system built entirely by hand, absolute precision construction was not possible. To overcome physical tolerances, C-4P5 was designed to be self-calibrating. Bump switches, the optical encoder, and the bottle-detecting tripwire are all used to calibrate the positions of the filling and capping actuators with respect to each end of the track. Calibration is performed as follows: before searching for bottles, the claw platform begins by reversing until reaching the start of the track (detected by bump switch). The encoder position is reset to zero, and the platform then traverses forward until reaching the end of the track (also detected by bump). The total length of the track as measured by the encoder is then recorded. The platform then returns to the start; once there, the capper is lowered to its lowest position. The platform then traverses forward until the capper interrupts the laser tripwire, where it stops and records its position. Using this information a complete map of the track can be calibrated. 9. CONCLUSION The C-4P5 automated bottle filling and capping machine frees the homebrewer from the chore of filling and capping beer bottles by hand. Bottles staged along a track are retrieved in turn by a bottle seeking claw, which then moves the bottles into position where other actuators fill and then cap the bottle. While nearly all elements of the system were completed and function properly, time constraints prevented completing all tasks. The design and construction of the physical platform and systems was completed. All physical and electronic elements successfully perform their function independently. Due to the complexity and size of the physical platform, less development time was available for software design. Although the software systems generally function properly, some bugs still remain and not all desired software features are fully implemented. However, the finished system is capable of sustained and reliable communication between all controllers and is capable of performing all required tasks in sequence. The image processing system is capable of determining the size of a bottle in its view and based on camera position deciding if that bottle is 12 oz or 22 oz. However, the robustness of this system has not been tested and would likely be easily confused by unexpected scene elements. The most pressing enhancement I would choose to make to this design would be to replace all wooden elements with a machined metal structure. Additionally, a bottle ejection system would enable the system to operate with greater autonomy. Fully automatic “turn-key” operation should also be finalized, as operation currently requires several steps to begin properly. Ideally, the system could simply be powered on, after which it would self calibrate, requiring the operator to simply line up bottles, connect a source bucket, and press a “Go” button.

20