Group members:
Date: 4/16/2024
The purpose of this project was to create a functional claw machine. As a group, we worked to decide what functions to include in our project. We concluded that our claw machine should have the following functions: A functional claw, user control over the claw, a mechanism to sense “coin” placement to play the game, and a structure to house the game. The result of this project was a small functional claw machine. This project was completed over several steps, the first step was to create the box that was housing the game. The next step was to create the gantry system as well as the claw, this led to coding each aspect in Arduino IDE (claw movement, drop, and closing). Followed by the integration of our code into an app and the addition of the “coin” sensor to signal the game to start.
During this project, we were also introduced to “scrum”. Scrum is commonly used in settings where groups are working on a large project together. Scrum encourages communication and frequent project updates between team members which in turn can increase the efficiency of teamwork. As a result, we were able to practice efficient communication as a team. Being able to communicate interpersonally is an important skill for many jobs, so practicing it now was a valuable experience.
Project Video Description: BAE 305 Final Project - Claw Machine
||
|:—:|
| Figure 1. Box assembly procedure|
![]() |
---|
Figure 2. Box assembly procedure |
![]() |
Figure 3. Box assembly procedure |
Figure 4. Gantry |
Figure 5. Gantry assembly procedure |
Figure 6. Gantry assembly procedure |
Figure 7. Gantry assembly procedure |
Figure 8. Final gantry assembly |
This project used two arduinos, both of which were wired similarly to the diagram below, but the switch is not included in either circuit. For the first arduino, wire the circuit according to the diagram below for both motors. Also incorporate a line sensor and connect it to a digital pin, ground, and the voltage source; make sure that the wiring matches the labels on the sensor. For the second arduino, wire the circuit according to the diagram below for only one motor. Add a servo motor by connecting it to a PWM digital pin (via the attached white wire), ground (black wire), and voltage (red wire). Finally, connect the arduinos by connecting a digital pin in arduino 1 to a digital pin in arduino 2; we used pin 4 in arduino 1 and pin 2 in arduino 2. Also connect both the arduinos through ground.
Figure 9. Wiring diagram |
The codes for the claw machine were built partially based off of codes from our prior labs which utilized the motors. Additions were made to account for the communication between the two arduinos, to use the line sensor to detect a coin, and to move a servo to open and close the claw. The final working codes are included in the depository files. Claw1 code runs the first arduino, which is connected the line sensor and X and Y axis motors (gantry) and also communicates to the second arduino and the app. ClawMachine2 code runs the second arduino which controls the Z axis motor and the servo motor for operating the claw. Make sure that the pins used in the code match with the actual circuit in order for the system to run properly.
![]() |
---|
Figure 10. App user interface |
![]() |
---|
Figure 11. Blocks used to build app |
The only properties of the box that required testing were physical capabilities. This was tested after the glue had finished drying. We casually tested our physical capabilities by applying pressure in different areas.
Test procedures for the claw included creating several claws physically.
Our first claw was 3D printed, we tested this claw by wiring it and having it physically open and close. From this short test, we determined that the width this claw opened was too small to reliably grab objects in our game. So, we created a claw with greater grip strength and mobility.
The second claw was provided to us by Dr. Jarro. We were unable to use this claw because it was difficult to incorporate a servo motor into it.
Finally, we created a third claw. To test its capabilities, we wired it and coded it to open and close. This claw had the ability to fully open which is what we were looking for. This was done using Arduino IDE and a red board.
When assembling the system, we needed to test how far the claw needed to drop, this was done by adjusting the motor parameters to ensure that when the claw dropped it did not collide with the floor of the game. Another parameter we needed to test with the claw before adding it to the system was how far the claw would open and close, as well as what the servo considered to be “home.” Both of these were done using trial and error.
To make sure the gantry functioned properly, we had to test that the motor was powerful enough to pull the whole system along the rods, that the bearings could slide easily over the rods, and that the motor could move in a straight line along the rubber band from one end of the box to the other in both the x and y directions.
To ensure that the system could meet these requirements, we tested these features continuously as we were building it. The most challenging part was keeping both sets of rods and bearings perfectly straight at any points where they were glued down. Otherwise, the motors could not slide on them. Our tests showed that connecting the gantry to the box affected how the rods were positioned, and we therefore settled on a design that allowed us to remove the gantry from the box and adjust it if needed.
We tested each motor on its own before testing them together by isolating the part of the code that ran the motors. We then tested them again once the gantry had been incorporated into the box and attached to the claw so we could see how the added weight would affect their function. This test also showed whether the motors could stay on track along the rubber bands, and move smoothly across the rods.
To test our wiring capabilities, we connected each component individually and operated them one at a time. For the motors in the gantry, this involved determining if moving them created movement along the rubber band. As well as testing the claw drop capabilities, if the motor did its job. We used the same process for the claw’s servo motor.
Dr. Jarro assisted us with the line sensor. To determine what would trigger the beginning of the game we tested what would and wouldn’t trigger the line sensor. This was done by utilizing a modified blink code to ensure that the sensor would detect the coin.
To sum up our testing procedure we worked with each component individually prior to incorporating them into our full system. This made it clear immediately if a single component would have an issue with the entire system. The codes used to test individual are included as files in this repository. For testing:
For our coding approach, our testing procedure could be described as trial and error. If we attached a component and it did not work with the code we problem solved until the component properly worked.
To test the entire system we also used a trial and error approach. To test the functionality of the system we went ahead and attempted to use it and if parts had issues working we worked to find the issue and correct it.
The functionality that we looked for in the entire system was a working gantry, a working claw drop button, a claw that closed on time, and that the claw would return to the toy drop area before opening.
Most importantly we wanted to make sure it was possible to win the game.
When making the box we decided to use a laser cutter to cut the pieces out, this meant we also had to use Adobe Illustrator to create the design files for the box. Laser cutting was chosen because it provides precise and accurate cuts at a high speed.
Before creating the boxes design, we decided on a few key components. The box had to have area for a gantry, and we also wanted it to be easy to take apart and reassemble so it would be easy to work on the wiring for the project. To begin, we decided on the size of the box. We wanted the product to be medium so there was enough space inside the box to wire the mechanism. Afterward we decided on window size, and placement. When choosing the placement of the windows we chose to have a 2-inch cover on the top of the box to help hide electronics from the users.
One of the most important design components was the supports on the inside of the box. These supports are used to hold up the game floor without gluing it to the box. It was also necessary to include any holes in the design when laser cutting. The holes included in the design are for the toy drop, the line sensor, and a hole in the back for the wiring of the Arduinos. This design also hides most of the circuitry, helping it look cleaner than if the circuits were visible in the final design. We also cut a hole in the floor to string the wiring through, this was so we could wire it from the base to the top of the box where the gantry is located.
To secure the pieces of the box together, we chose to use glue instead of hardware because wood glue provides a strong bond. This decision caused the box’s construction to take longer because it was necessary to hold the pieces in place while the box dried.
To design the claw, we wanted to use what we already had to reduce costs. What we had on hand was a mini servo which was included in our spark fun kits, we also had access to various hardware pieces, and scrap wood. The necessary function for a claw is to open and close on command so this worked with the servo motor.
We chose to use a gear system for the claws opening and closing mechanism. This is because with gears if we move one gear then the other gear will move as well, allowing the claw to open and close with one gear.
Apart from the fact that the servo motor was available to us, servo motors are also efficient and are capable of operating with high efficiency. This was attractive to use with a claw where we wanted to design how far to open and close it. Servo motors are also relatively easy to code in comparison to some other motors.
As the gantry was the most mechanically complicated part of this project, we looked at a lot of different designs from different creators online. Most designs required pretty specialized materials that we did not have the budget for, so we were limited in our design options. For our first attempt, we used the laser cutter to cut out wooden wheels to glue to the motor, and wooden tracks for them to “drive” across. However, this design was unstable and we had difficulty keeping the motors on track and supporting the weight of the claw. Therefore, we switched to a design from Liberman on YouTube that used rods with bearings, rubber bands, and cardboard. After building an initial test of this design, it was clear that it would be much more stable and effective than our first design.
In this design, there are two motors, one for movement in the x direction, and one for movement in the y direction. The motors are anchored to bearings which can slide freely along two sets of metal rods. The rubber bands act as tracks that the motors follow as they spin, pulling the entire apparatus in whichever way either motor is spinning. One issue we had with this design was that once the claw was attached, it was harder for the mechanism to slide along the rods, so we added some lubricant to solve this issue.
Before creating our wiring system, we decided on what was necessary to include to create a functioning system. We concluded that we needed to use three brush motors. Two motors were used to create movement along the gantry system, one motor was used to control the claw drop. We also needed to wire the servo motor which was used to open and close the claw. Finally, we added a line sensor to help trigger the beginning of the game.
Because of these requirements, we needed to use two breadboards for this project. This was because one breadboard did not have enough pins to run more than two motors. Because we used two Arduinos, we had to work to connect them so they could communicate.
Physically we hid the Arduinos underneath the game’s flooring to give the project a cleaner look. We wired the gantry through a small hole in the floor of the game.
We decided to use an app for this project to avoid creating a physical control system. A physical control system would have involved creating a controller for claw movement, and this would have been more difficult than using code to control the motors. We were also familiar with coding motor movement because we used this skill for a few of our labs. Similarly, we used MIT app inventor to create our app because it had been introduced to us in lab.
In addition to the Open Serial button, which starts serial communication between the app and the arduino, our app included five buttons including forward, backward, right, left, and drop. Each button controlled the claw’s position. The buttons we chose to include in our app were relatively simple, this was to create a clean interface and prevent confusion on the user’s end. There is also a label which will turn green if the serial is open and red if the serial is not open.
When the “Drop Claw” button is pressed on the app, the servo on the claw opens, then the unravels the string for a set amount of time, then the servo closes the claw, and the motor rewinds the string to bring the claw back up while closed.
The result of testing the claw opening was that it worked best when it was open 12 degrees to closes at 1o degrees.
We found to drop the claw it had to go down about 5.5 inches which required the motor to be turned for 1.1 seconds during the drop duration and 1.25 seconds for the rise back up.
To move along the gantry we used a system where the system would move along the gantry in increments of one second. We also found that moving the claw four times was about the width of the entire system.
The entire system works together and we were able to play and win our game.