Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory...

52
INOM EXAMENSARBETE MASKINTEKNIK, GRUNDNIVÅ, 15 HP , STOCKHOLM SVERIGE 2020 Claw Machine Tivoliautomaten DELAL ACAR, KARIN SVENSSON KTH SKOLAN FÖR INDUSTRIELL TEKNIK OCH MANAGEMENT

Transcript of Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory...

Page 1: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

INOM EXAMENSARBETE MASKINTEKNIK,GRUNDNIVÅ, 15 HP

, STOCKHOLM SVERIGE 2020

Claw Machine Tivoliautomaten

DELAL ACAR, KARIN SVENSSON

KTHSKOLAN FÖR INDUSTRIELL TEKNIK OCH MANAGEMENT

Page 2: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 3: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Claw Machine

Thesis WIP

DELAL ACAR

KARIN SVENSSON

Bachelor’s Thesis at ITMSupervisor: Nihad SubasicExaminer: Nihad Subasic

TRITA ITM-EX 2020:31

Page 4: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 5: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

AbstractClaw machines have been around for about a century spread-ing joy and entertainment to people of all ages. They areusually seen in amusement parks and malls.

In this Bachelors Thesis, one version of a claw machinewill be constructed. Di�erent constructing solutions andmotors will be discussed for an easy and optimal claw ma-chine that meet all the requirements given in the project.

This report is divided into four parts, consisting of in-troduction, theory, construction of the machine and results.The first part is an introduction where some backgroundinformation and delimitations of the project are presented.The second part of the report deals with the theory be-hind various selectable motors for this project as well assolutions for the design itself. The third part of the dis-sertation gives a detailed overview of how this particularClaw Machine was designed. Selection of materials, motorsand how everything is connected and how the various partsharmonize with each other are also presented in this part.In the fourth and final part, the results are presented anda discussion of future improvements is provided.

Keywords: Claw, DC-motor, Servomotor, Arduino, Joy-stick.

Page 6: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

ReferatTivoliautomat

Tivoliautomater har snart funnits i ett arhundrade ochhar under flera artionden varit en stor nojesattraktion forsaval gammal som ung. De ar vanligt forekommande i nojes-parker och kopcentrum.

I detta kandidatexamensarbete kommer en sadan tivo-liautomat att konstrueras. Diskussioner kring olika motoreroch konstruktionslosningar kommer att foras, for att slut-ligen uppna en konstruktion som uppfyller de givna direk-tiven for projektet.

Denna rapport ar uppdelad i fyra delar, bestaende avintroduktion, teori, byggandet av maskinen och resultat. Forstadelen ar en introduktion dar grund-laggande fakta samt av-gransningar for projektet presenteras. Andra delen av rap-porten behandlar teorin bakom olika valbara motorer fordetta projekt samt losningar for sjalva konstruktionen. Iavhandlingens tredje del ges en detaljerad genomgang avhur just denna klomaskin konstruerats. Val av material,motorer samt hur allt ar sammankopplat och hur de olikadelarna harmoniserar med varandra presenteras aven i den-na del. I den fjarde och sista delen presenteras resultatet ochen diskussion kring framtida forbattringar tillhandahalls.

Nyckelord: Klo, DC-motor, Servomotor, Arduino, Joy-stick.

Page 7: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Acknowledgements

We would like to thank Nihad Subasic for being a good mentor and setting themood in the course MF133X. The teaching assistants also deserve a great hand fortheir great willingness to help and their answers to our questions.

We would also like to thank Thomas Ostberg for handing us materials and KTHfor financial support for the project. Last but not least we would like to thank StobAB for supplying carpentry tools, material and knowlegde about construction duringthe social distancing era due to Covid-19.

Page 8: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Contents

1 Introduction 31.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Theory 52.1 Electrical Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.1.1 Motor Comparison . . . . . . . . . . . . . . . . . . . . . . . . 52.1.2 DC, Servo or Stepper motor? . . . . . . . . . . . . . . . . . . 62.1.3 Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2 Mechanical Construction . . . . . . . . . . . . . . . . . . . . . . . . . 92.2.1 Constructing the Coordinate System . . . . . . . . . . . . . . 92.2.2 Shape of the Gripping Claw . . . . . . . . . . . . . . . . . . . 102.2.3 Formation of the controller . . . . . . . . . . . . . . . . . . . 10

3 Building the Machine 133.1 Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.1.1 The Coordinate System . . . . . . . . . . . . . . . . . . . . . 143.1.2 The Claw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.1.3 The Framework . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.2 Electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.3 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4 Results 194.1 Final Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.2 Discussion and Future Improvements . . . . . . . . . . . . . . . . . . 21

4.2.1 Obstacles due to Covid-19 . . . . . . . . . . . . . . . . . . . . 21

Bibliography 23

Appendices 23

A Circuit Diagram 25

Page 9: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

B Program Code 27

C Photographs 31

D Rendered photos 35

Page 10: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

List of Figures

2.1 The rotor and the stator creates a force that makes the motor shaftrotate. Picture: [11] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2 The four motors used in this project. Photo: by author. . . . . . . . . 82.3 Arduino UNO. Photo: by author. . . . . . . . . . . . . . . . . . . . . . 92.4 Image presenting the 3D-printers that inspired our construction, using

belts for transmission. Photo: by author . . . . . . . . . . . . . . . . . . 102.5 The claw from thingiverse.se that was the inspiration for the claw used

in the Claw Machine. Picture: [10]. . . . . . . . . . . . . . . . . . . . . . 11

3.1 The three partial systems of he construction. The coordinate system inblue, the claw in red and the framework in yellow. Picture: CAD byauthor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.2 The construction of the coordinate system. Picture: CAD by author. . . 143.3 The claw when it goes from closed to open. The figure also emphasises

the names of the di�erent components, of which the claw is constructed.Picture: CAD by author. . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.4 The framework that stabilizes the construction. Picture: CAD by author. 16

4.1 Rendered photo of the finished CAD. The electronics is not shown in theCAD version, but can be seen in the real photography of the construc-tion. More renders of the Claw Machine can be found in Appendix D.Picture: CAD by author. . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.2 Photography of the finished Claw Machine. More photos are presentedin Appendix C. Picture: By author. . . . . . . . . . . . . . . . . . . . . 20

Page 11: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Abbreviations

DC - Direct currentPWM - Pulse width modulationRpm - Revolutions per minuteKEXPO - Exhibition for the bachelors work in mechatronics at KTHIDE - Integrated development environment

1

Page 12: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 13: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Chapter 1

Introduction

This chapter will discuss the fundamental idea of what is to be accomplished duringthis mechatronics project. It will present the background, purpose, and scope ofthe project.

1.1 Background

Claw machines are usually seen in places like amusement parks, movie theaters andshopping malls where the users get a chance to win a prize in exchange for money.The prize varies but the most common prize is probably stu�ed animals. The clawmachine’s main function is to bring money to the owner while it gives entertainmentand suspense to people of all ages that uses the machine. The construction can varyand on the internet di�erent solutions can be found, from homemade hydraulic pow-ered claw machines to electric power reliant solutions. They are often very colourfuland equipped with blinking lights and sound e�ects. Instead of stu�ed animals thisClaw Machine will be filled with small chocolate bars. The final construction will bepresented at the KEXPO, which is the exhibition at KTH where the mechatronicswork is presented and hopefully bring an entertaining atmosphere.

1.2 Purpose

The purpose of this project is to analyze in what way the Claw Machine can beconstructed by using a microcontroller. The concept behind the microcontrollerwill be discussed in the theory chapter in this report. The best suited motors andcomponents for creating a simple machine that fulfills the basic functions of a clawmachine is to be investigated. Throughout this report the following questions willbe analysed and answered:

• What kinds of motors are best suited for this kind of machine’s di�erent parts?

• How will the mechanical parts be constructed for an easy and reliable navi-gation of the claw?

3

Page 14: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

CHAPTER 1. INTRODUCTION

• What is the optimal shape and configuration of the claw for easy manufactur-ing and good gripping abilities?

1.3 Scope

The instructions given for this project demonstrated three di�erent requirements.Those include one mechanical part, one electrical part and a software. The givenrequirements reduced the possible solutions that did not include those three parts.Due to limited time frame the Claw Machine will be able to execute the basicfunctions, as picking up objects from the container via a control system controlledby the user of the machine. Playful e�ects like blinking lights will be added if timeallows. An automated processes for the claw, from lowering itself til dropping theprize in the prize box, will also be evaluated and added if there is time. Otherwisethe machine will be steered manually with direct response from the user.

The budget for purchases of supplementary parts was 1000 SEK. Except for thetime frame the budget also limits the amount of extra e�ects that can be built in.The Claw Machine will be a miniature of the machines found in amusement parksto facilitate the building process and provide an easy storage. It will also help tonot exceed the budget. The results of this project will be shown at the KEXPO-exhibition. There will also be an oral presentation and a video of the construction.

1.4 Method

The project was initiated by formulating questions that were to be researched duringthe project. A prototype of an existing claw was 3D-printed and after analysingthe result a new one was made in Solid edge with improvements. Other parts likethe di�erent fixings was also made and 3D-printed to fit the required dimensionswhile the joystick, buttons and similar parts was ordered. When all the parts weregathered and ready, the construction of the Machine could begin. The programmingwas then initiated to enable the desired movements, and finally the electrical wireswere connected. After that the Claw Machine could be tested and used.

4

Page 15: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Chapter 2

Theory

In this chapter the theory behind the concept of the Claw Machine will be discussedand some of the questions brought up in the section Purpose will be answered.

2.1 Electrical Theory

To enable the motion of the Claw Machine, motors are required to convert electricalenergy into mechanical energy [1]. In this project we could choose from di�erentelectric motors. There were three types presented in the beginning of the course -DC motors, servo motors and stepper motors [2]. The factors that will be taken intoconsideration when choosing the motors are mainly cost, speed, torque, accelerationand ability to regulate the motion. By using an Arduino the di�erent parts andmotors will be connected and controlled by programming the Arduino hardware.

2.1.1 Motor Comparison

A DC motor consists of a rotor and a stator. The co-operation between the magneticfield of the stator and the current through the rotor generates a force that createsthe rotation of the motor[3]. A simple visualization of the mechanics of an electricmotor is shown in figure 2.1. Because of it’s simple construction the DC motor isthe most common type used in tools, toys and other appliances. To alter the speedof the motor the current can be adjusted, but to regulate the desired movement youwill need a feedback function. This function can for example consist of buttons,switches or a joystick. Another profit from using a DC motor would be that it ischeap and has a high starting torque.

Servo motors are fundamentally a DC motor with a control circuit, a gearingset and a potentiometer. This gives the motor the ability to give a high precision inposition feedback [4]. Hence, the major di�erence between a servo motor and a DCmotor is that the former allows a more precise control of the position, which makesit more expensive than the regular DC motor. It is often used in areas where thetasks require a motor position that is more precise, like in robotic arms. The motor

5

Page 16: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

CHAPTER 2. THEORY

Figure 2.1. The rotor and the stator creates a force that makes the motor shaft

rotate. Picture: [11]

shaft of a servo motor can rotate up to 180 degrees, 90 degrees in each direction.With a servo motor you can specify what position you want it to go to, and it willgo there with full power no matter what obstacles you put in front of it.

Stepper motors utilizes multiple notched electromagnets arranged around a cen-tral equipment to describe the machines position. In other words the stepper motorhas the ability to know it’s own position[5]. This makes the stepper motors superiorof the DC motors and the servo motors in this area. Stepper motors are mainlyused in appliances where the position needs to be exact, for instance in 3D-printers.Because of it’s preciseness it is the most expensive of the three options mentionedin this report.

2.1.2 DC, Servo or Stepper motor?

For a fully functioning Claw Machine four motors is required. One motor for themotion in the X- and Y-led respectively, which will move the claw backward andforward, as well as right and left. The third motor will control the motion in Z-led,meaning the lowering and hoisting of the claw to reach the prize. The fourth motorwill be in charge of the opening and closing of the claw.

For this project there is no need to control the position of the claw very preciselysince the only purpose of the Claw Machine is to bring amusement to people. Sincethe user of the Claw Machine will be in control of the movement in the X- and Y-

6

Page 17: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

2.1. ELECTRICAL THEORY

led, and give orders with direct response from the motors, the motors themselves donot need to know their position. Also, the preciseness in these X- and Y-directionsis not fundamental. The user can start and stop the movement of the claw as itpleases by pushing the joystick in the direction the claw should be moved. Hence,the vital characteristic of the motor required for the positioning of the claw in theX- and Y-led is that it responds quick to the commands made with the joystick.For those reasons, the price is what determined the choice and the most suitablefor this project was two DC motors - one for each direction, X- and Y-led.

If an automated process for the claw is realized, the movement in Z-led is moresignificant since the controlling of how far the claw will drop and how far it willrise on the way up has to be limited. That would give two options: either using aservomotor that would be able to control the length of the drop, or a DC motor thatwill stop with direct response from the user. In the claw machines that are foundon the market there is often a scam built in which makes the claw drop the prizeon it’s way to the opening. This also gave the option to automatize the process byusing a DC-motor and program the number of rotations the motor should do beforeit would stop and start going the other direction. This would give an uncertainty inthe movement of the claw, which would serve the purpose of a scam and make thegame more exciting. This was why the DC motor was preferred, even if the processwas to be automatized or not.

For the claw to open and close a more precise motor was needed since the clawrequires a smaller moving range and is more fragile than the other parts. In otherwords, there is no room for float. The motor also have to be able to work with aslower rpm so that the opening and closing of the claw is at a stable pace. Theslower pace will also give an excitement for the user while waiting to see if themachine catches a prize. With all this in mind there were two options available:the servomotor or the stepper motor. The servo motor was chosen since it servesthe purpose without any redundant attributes.

Motor Characteristics

The next step was to estimate what capacity the chosen DC motors and the servomotor must possess to have the power to lift the prize. The weight of the prize isvery light - the chocolate bars we aim to use weighs somewhere between 10 and 50grams. The claw, that is 3D-printed, is also very light. Likewise, the servo motorthat drives the claw is very light. This all allows the assumption that the motorsdo not have to have a high torque to be able to move the claw, since the torque iscalculated by the following equation:

M = F · r = g · m · r

where M is the torque, F is the force measured in Newton and r is the radius ofthe motor shaft in meter. The motors inertia is neglected. The force is calculatedby multiplying the weight, m, and the gravitational constant, g. [6]

7

Page 18: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

CHAPTER 2. THEORY

When gathering information about DC motors in general, the torque for similarmotors to the ones available at school was approximated to 0,5-15 kgcm. Since theradius of the motor shaft will not exceed 1 cm, and the weight will most definitelynot exceed 15 kg, the motors torque capacity is more than enough.

The DC motors used in this project has a capacity of 24 V and a speed of123 rpm. The servo motor requires 5 V and the motor shaft can rotate up to 180degrees. The motors are shown in figure 2.2.

Figure 2.2. The four motors used in this project. Photo: by author.

2.1.3 Arduino

Arduino, that is the microcontroller used in this project, is an open-source electron-ics platform consisting of both a hardware and a software that complement eachother. The Arduino hardware that will be used for this project is the Arduino Uno,see figure 2.3. Arduino Uno has 14 digital in- and outputs that is used for pluggingin the motors, joystick, buttons and lights if wanted. Six of these can be used asPWM-outputs which means that the motor’s rpm can be adjusted by lowering thecurrent. [7]

The Arduino will be programmed via the software Arduino IDE. The programcode will determine whether the output pins should be set to HIGH or LOW -i.e. if they should transmit current or not. The PWM-outputs can also be setsomewhere in between for a desired rpm [8]. Feedback from the joystick and thebuttons will be processed in the code and set a combination of HIGH’s and LOW’s.Depending on the combinations of HIGH’s and LOW’s the motors will perform

8

Page 19: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

2.2. MECHANICAL CONSTRUCTION

Figure 2.3. Arduino UNO. Photo: by author.

di�erent movements. The orders will be made via the joystick and the buttonsmounted on the steering platform. The program code will steer what will happenwhen a certain button is pushed or if the joystick is moved in a certain direction.

2.2 Mechanical Construction

In this section the construction plan for the Claw Machine will be described. Al-ternative solutions that was not chosen will also be discussed.

2.2.1 Constructing the Coordinate System

In the search for inspiration for the construction of the movement in the X- and Y-plane an observation of machines with similar performance and motion was made.This included 3D-printers, printers and other homemade claw machines, mainlyon YouTube. One of the observed 3D-printers is shown in figure 2.4. A relevantpreviously made bachelor theses was a Braille-printer made in 2018 [9], also inspiredby 3D-printers using belts for transmission.

The main decision was if belts or wheels were to be used to transmit the motorpower to plane motion of the claw. Since the Claw Machine will be in a smaller sizeand many parts will be 3D-printed the construction will be fairly light. This mightnot give enough friction for the wheels to drive the claw without starting to spin.Spinning wheels will not make the correspondence as good as desired. This lead tothe decision of using belts for the transmission.

As can be seen in figure 2.4 the motors rotation is transmitted to the billets viashorter belts and gears. The longer belts in turn transfer the motion to the otherbillets and make them move synchronized. The crossing billets, which holds thefixture of the claw and can be seen in the left picture in figure 2.4, are attachedto the longer belts running along the sides. The movement of the belts thereforeenables the motion of the claw in the X- and Y-led.

9

Page 20: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

CHAPTER 2. THEORY

Figure 2.4. Image presenting the 3D-printers that inspired our construction, using

belts for transmission. Photo: by author

The inspiration for the motion in z-led was not taken from the 3D-printer sincethe Claw Machine requires a faster motion, with less preciseness than the 3D-printer. Instead the claw will be hoisted by a wire that is rolled up on a cylindricalconstruction, almost like a thread roll, directly connected to the motor shaft. Thisseems to be the most common solution for existing home made claw machines.

2.2.2 Shape of the Gripping Claw

The shape of the gripping claw had to be adapted to the purpose of picking upsmall candy bars. Previously made constructions of claws were found at the websiteThingiverse.com [10], see figure 2.5. After test printing and analyzing one of theconstructions on the site, a claw was made in Solid Edge with improvements to bemore 3D-printer friendly and scaled for candy bars.

The claw consists of four arms connected to a main hub which in turn connectsvia a stick to an upper hub that can glide up and down to generate the opening andclosing motion of the claw. The servomotor that creates the movement for grippingis attached to the upper hub and the motor shaft moves maximum 180 degrees, oruntil the claw is fully opened or closed. The number of degrees can be specified inthe Arduino program code.

2.2.3 Formation of the controller

To be able to control the motion of the claw, inputs would have to be given to theArduino. This could be given either via the computer, buttons or a joystick. Sincethe Claw Machine is supposed to be a toy the decision came to be a joystick for thesteering in X- and Y-led, and buttons to manage the vertical movement as well asthe gripping of the claw.

The joystick will be controlling the X- and Y-movement with instant feedback,which means that when the user stops pushing the joystick the claw will stop. Themovement in the z-led will be controlled by two buttons, one for each direction.

10

Page 21: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

2.2. MECHANICAL CONSTRUCTION

Figure 2.5. The claw from thingiverse.se that was the inspiration for the claw used

in the Claw Machine. Picture: [10].

These buttons will have the same function as the joystick, meaning that the motionwill stop once the button is released. Likewise, the claw will be steered by twobuttons, one for opening and one for closing it.

11

Page 22: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 23: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Chapter 3

Building the Machine

In this chapter the approach for building the Claw Machine will be demonstratedand discussed.

3.1 Mechanics

The Claw Machine can be divided into three partial systems - the coordinate system,the claw and the framework, figure 3.1. The following sections will go deeper intothe methods used to produce them.

Figure 3.1. The three partial systems of he construction. The coordinate system in

blue, the claw in red and the framework in yellow. Picture: CAD by author.

13

Page 24: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

CHAPTER 3. BUILDING THE MACHINE

3.1.1 The Coordinate System

As mentioned above, the inspiration for the construction of the coordinate systemwas taken from existing 3D-printers. The motion in the X- and Y-led was madepossible with a set of billets driven by belts that were connected to the motors withgears, see figure 3.2 below.

Both sides of the machine are synchronised through another pair of belts. Fourside fixings glide on the billets along the sides which drive the two inner billetsattached to the fixings. Where the inner billets cross a box was placed, which ismoved according to the side fixings. The box holds the third motor that controlsthe motion of the claw in Z-led by rolling in and out the wire the claw is attachedto.

Figure 3.2. The construction of the coordinate system. Picture: CAD by author.

3.1.2 The Claw

The claw was, as mentioned in the previous chapter, developed from an existing3D-printed model, but to adjust it to this projects aim some changes had to bemade. The most prominent change was the formation of the arms of the claw. Tobe able to pick up small candy pieces or bars, the arms had to be made wider andin a slightly di�erent shape.

The original claw, where inspiration was obtained from, turned out not to beoptimal for the chosen manufacturing method, which was 3D-printing. This wasbecause it had many curved surfaces that required unnecessary work post productionsuch as removing support from areas hard to reach. Therefore, the remade clawwas made to have at least one straight surface to lie on during the printing process.

14

Page 25: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

3.1. MECHANICS

The remaining parts of the claw was also redesigned in CAD in a suitable size andshape to fit in this Claw Machine. The dimensions of the fixing for the servomotoron the upper hub had to be customized to fit the motor available for this project.The shape of the lever arms, which links the upper hub with the arms of the claw,was also redesigned. These were made in a curved shape, instead of straight, to geta shorter total length of the claw and to avoid collisions with the lower hub. Thefinal result of the entire claw construction can be seen in figure 3.3.

Figure 3.3. The claw when it goes from closed to open. The figure also emphasises

the names of the di�erent components, of which the claw is constructed. Picture:

CAD by author.

3.1.3 The Framework

To connect the di�erent mechanical parts of the construction a solid framework hadto be built. Di�erent ways to construct it were discussed and evaluated before thefinal method and materials were decided. Among the contemplated materials wereplywood, plexiglass and steel.

The final choice of construction came to be a wooden frame in shape of a rectan-gular cube. The frame’s purpose was to create a stable surface where the four wallsmade out of plexiglass could be attached. The decision to use plexiglass was basedon the willingness to display all the electronics, and make it more comprehensibleto the user. The rest of the components, such as fixings for the motors and billets,were then either attached to the frame or directly to the plexiglass. A renderedpicture from CAD can be seen in figure 3.4.

15

Page 26: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

CHAPTER 3. BUILDING THE MACHINE

Figure 3.4. The framework that stabilizes the construction. Picture: CAD by

author.

3.2 Electronics

The next step was to connect all the di�erent parts. The joystick, the buttons,the motors, the Arduino and the claw had to connect through electricity to deliverthe proper entertainment. For the machine to work as desired and to react when acertain move is made with the joystick for example, all the parts had to be connectedto the Arduino since the Arduino is the part that can be programmed.

The Arduino Uno, that was used in this case, has 14 digital pins and 6 analogpins, that where distrubuted as follows: 2 pins for each DC motor, 1 pin for theservo motor, 4 pins for the joystick and 4 pins for the buttons. That sums up to atotal use of 15 pins. Since the digital pins were not enough, the buttons were allconnected to the analog pins on the Arduino. To make them work as digital inputsit had to be specified in the code. A complete circuit schedule that shows all theconnections can be seen in Appendix A.

All the used components also had to be connected to power and ground. TheDC motors requires 24 V power and were connected to a power supply of 24 V.The rest of the components only needed 5 V, therefore they could all share the 5V from the Arduino. Everything mentioned above was also connected to ground.Since the power supply, the 5 V pin and the ground pin from the Arduino had tobe connected to several components, the connections were made via breadboards.

16

Page 27: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

3.3. SOFTWARE

3.3 Software

The programming of the Arduino was made by using the Arduino IDE software.In this program the coding language C is used. The code is built up by di�erentscenarios, one for each directive that can be made by the user. Since joystick isused to control the movement of the claw in both X- and Y-led, it was programmedto steer two of the DC-motors, one for each led. If the user pulls the joystick to theleft the code decides what the response from the motors will be, i.e how fast and inwhat direction they should spin. To make the claw move in the opposite directionwhen playing, the motor rotation was programmed to change direction when thejoystick is pulled the opposite way. The same principle goes for the DC-motor thatis in charge of lowering and lifting the claw, except these are controlled by buttonsinstead of a joystick. Depending on the combination of motion from the di�erentmotors the outcome of what the machine will do will vary.

The servo motor that controls the opening and closing of the claw is also steeredby two buttons, one for each function. The code used for this was a little bit morecomplicated than for the DC motors. Toverlehe angle of the movement of the motorshaft could have been specified in the code, but since the opening motion is madein direct response from the user, no angular restrictions were needed in this case.The pace of the motion however had to be adjusted since the claw consist of quitedelicate parts. The full program code can be seen in Appendix B.

17

Page 28: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 29: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Chapter 4

Results

This chapter will present an overview of the final solution, and also discuss areas offuture improvement.

4.1 Final Result

The final construction, that is shown as a render made in Solid Edge in figure 4.1,came to be a yellow frame with plexiglass around to make the electronics visible forthe user. The glass makes it easier for the user to understand the theory behindthe electronics of the machine since the cords are all visible and connected to theArduino at the bottom part of the machine.

Figure 4.1. Rendered photo of the finished CAD. The electronics is not shown in

the CAD version, but can be seen in the real photography of the construction. More

renders of the Claw Machine can be found in Appendix D. Picture: CAD by author.

19

Page 30: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

CHAPTER 4. RESULTS

The motors used for this Claw Machine are three DC motors to enable themotion of the claw in X- Y- and Z-led. These were the cheapest and most e�ectivealternative because it only requires the direct response from the user. In the finaland real version of the Claw Machine, the DC-motor that enables the motion inX-led was placed on top of the framework instead of inside the box. This was dueto the DC-motor that controls the motion in X-led is connected to one of the upperbillets. The prioritization of a bigger playing area made it more suitable to placethe motor above the construction, instead of moving the lower billets closer to themiddle of the construction, to make room for the belt from the DC-motor to reachthe upper billet. The placement of the two DC-motors that controls the motion inX- and Y-led can be seen in the photography of the finished Claw Machine in figure4.2.

For the opening and closing of the claw a servomotor was used since the claw is abit more fragile and requires a more precise control. It also provides the possibilityto automatize the gripping motion of the claw if desired in the future, since theservo motor enables to specify the exact angle for opening and closing the claw toprevent any damage to its fragile parts.

The resulting claw consists of four arms, respectively attached to a lever armand the lower hub. The lever arms are in turn attached to the upper hub whichenables the opening and closing of the claw when gliding on the shaft attached tothe lower hub. By having a curved shape, the lever arms avoid collisions with thelower hub and minimizes the total length of the claw.

Figure 4.2. Photography of the finished Claw Machine. More photos are presented

in Appendix C. Picture: By author.

20

Page 31: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

4.2. DISCUSSION AND FUTURE IMPROVEMENTS

4.2 Discussion and Future Improvements

The final result of this project is a fully functioning, manual Claw Machine withmany possible development opportunities to proceed with if desired. Since thespread of Covid-19 a�ected the access to school and proper equipment, some com-promises had to be done during the construction phase.

One of the possible development would be to program an automated processprom picking the candy and dropping it over the winning box that leads the prizeto the user. For that, switches would be needed placed on two sides of the middlefixing which the claw is attached to. That is necessary when the direct feedbackfrom the user is eliminated since the DC-motors do not know their own positionand need some kind of feedback to react. This would give an even more excitingexperience since the game becomes even more uncertain. For an automated openingand closing of the claw, no additional parts would be needed but some changes inthe code. The servo motor would have to be programmed to open to a certaindegree within the limits of its capacity. This means that the four buttons usedwould have to be replaced with one that starts the automated process.

Another improvement would be to add lights and sound e�ects. These could forinstance go on when a prize is dropped through the winning box, or when the clawgets a hold of the prize. To make this possible some kind of sensors or switcheswould be required, and the light- and sound e�ects would have to be programmedto respond to the sensors or switches.

If the Claw Machine would be rebuilt, but still be working the same way withno improvements, the 3D-printed parts might have been modeled slightly di�erent.When the contruction was put together some deficiencies were discovered. Amongthese were the formation of the fixings for the billets, that was U-shaped for thebillet to rest inside and an easy assembly. They would have been better if they wereO-shaped to fixate the billet even more. That would have resulted in a more stableconstruction, not so sensitive to displacement. The same goes for a few other partsas well.

4.2.1 Obstacles due to Covid-19

As mentioned above, this project was implemented during the spread of Covid-19.Since this during the semester escalated into a pandemic and all universities inSweden closed, all the remaining work had to be done from home. The closingof KTH was declared halfway through the project, which meant that we were inthe early construction phase. With only the frame assembled, and the rest of thematerial in separate parts, we had to leave school and continue from home. Thisled to di�cutlies since we now did not have the possibility to readjust and remakeour parts when defects were discovered. A list of all the parts required had to besent to the assistants, who still had access to school, for them to print, lasercut andthen ship it to our homes. Further no prototypes could be made and tested, whichlead to some of the fixings etc. not being optimal.

21

Page 32: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 33: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Bibliography

[1] Ngabonziza Nyampame, C. (2011). Drivning av Likstromsmotor med MOSFET:DC Motor control by MOSFET. Available: DIVA, id:diva2:407935

[2] Subasic, N., ”MF133X F4 Motors.pdf” (2020). Available: https://kth.

instructure.com/courses/17324/files/2504809?module_item_id=192475

[3] Salutskij, M., ”Elmotorn – sa fungerar den”, (2014) [Online]. Available: https:

//teknikensvarld.se/elmotorn-sa-fungerar-den-116707/ (accessed Jan.24, 2020)

[4] [Online]. Available: DIVA, id: diva2:1200521

[5] de Vasconcelos Oliveira, A-M., ”Robotgripdon for kartongsortering”, (2019)[Online]. DiVA, id: diva2:1349115

[6] Johansson, H., Tekniska hogskolan i Stockholm, Institutionen for maskinkon-struktion, (2006). Elektroteknik. Stockholm: Institutionen for maskinkon-struktion, Tekniska hogsk. Available: https://www.kth.se/social/upload/

53fb30c9f2765462c888d692/Ellra_13_2_01.pdf

[7] [Online]. Available: https://www.arduino.cc/en/guide/introduction

[8] Warren, J., Adams, J., Molle, H. (2011). Arduino Robotics (1st ed.2011. ed., Technology in action Arduino robotics). [Online]. Avail-able: https://kth-primo.hosted.exlibrisgroup.com/primo-explore/

fulldisplay?docid=46KTH_ALMA_DS51133825410002456&context=L&vid=

46KTH_VU1_L&lang=sv_SE&search_scope=default_scope&adaptor=Local

[9] Ardestam, F., Soltaniah, S., ”Dot Master: Braille printer”, (2018) [Online].Available: diva2:1237295

[10] Swhitney22, ”Servo actuated claw”, (2014) [Online]. Available: https://www.

thingiverse.com/thing:536251

[11] http://www.classicmotor.se/artiklar/experten/20130521/

hur-fungerar-en-elmotor/

23

Page 34: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 35: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Appendix A

Circuit Diagram

Appendix A displays the complete circuit diagram of the Claw Machine.

25

Page 36: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

APPENDIX A. CIRCUIT DIAGRAM

26

Page 37: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Appendix B

Program Code

Appendix B displays the complete code for the Claw Machine.

27

Page 38: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

APPENDIX B. PROGRAM CODE

� �6ZHHS�

�E\�%$55$*$1��KWWS���EDUUDJDQVWXGLR�FRP!�

�7KLV�H[DPSOH�FRGH�LV�LQ�WKH�SXEOLF�GRPDLQ��

��

�PRGLILHG���1RY������

�E\�6FRWW�)LW]JHUDOG�

�KWWS���ZZZ�DUGXLQR�FF�HQ�7XWRULDO�6ZHHS�

��

��

�LQFOXGH��6HUYR�K!�

6HUYR�P\VHUYR�� ���FUHDWH�VHUYR�REMHFW�WR�FRQWURO�D�VHUYR�

LQW�SRV� ��� ���YDULDEOH�WR�VWRUH�WKH�VHUYR�SRVLWLRQ�

��'(),1,1*�,1��$1'�2873876�

YRLG�VHWXS��^ ��2XU�VHWXS�FRGH��UXQV�WKURXJK�RQFH�

��P\VHUYR�DWWDFK����� ��$WWDFKHV�WKH�VHUYR�RQ�SLQ���WR�WKH�VHUYR�REMHFW�

� �

��'&�027256�

��SLQ0RGH�����287387��� ��0RWRU�LQ�;�OHG��ULJKW�OHIW��

��SLQ0RGH�����287387��� ��;�OHG�

��SLQ0RGH�����287387��� ��0RWRU�L�<�OHG��IRUZDUG�EDFNZDUG��

��SLQ0RGH�����287387��� ��<�OHG�

��SLQ0RGH����287387��� ��0RWRU�L�=�OHG��FODZ�XS�GRZQ��

��SLQ0RGH����287387��� ��=�OHG�

��

��6(592�02725�

��SLQ0RGH����287387��� ��6HUYR�PRWRU��GHILQHG�DV�DQ�RXWSXW�

��

��-2<67,&.��'(),1('�$6�,1387�

��SLQ0RGH����,1387B38//83��� ��-R\VWLFN�IRUZDUG�

��SLQ0RGH����,1387B38//83��� ��-R\VWLFN�EDFNZDUG�

��SLQ0RGH����,1387B38//83��� ��-R\VWLFN�ULJKW�

��SLQ0RGH����,1387B38//83��� ��-R\VWLFN�OHIW�

��

��%877216��'(),1('�$6�,13876�

��SLQ0RGH�$���,1387B38//83��� ��%XWWRQ����FODZ�JRHV�XS�

��SLQ0RGH�$���,1387B38//83��� ��.QDSS�����FODZ�JRHV�GRZQ�

��SLQ0RGH�$���,1387B38//83��� ��.QDSS�����RSHQ�WKH�FODZ��

��SLQ0RGH�$���,1387B38//83��� ��NQDSS�����FORVLQJ�WKH�FODZ��

28

Page 39: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

`�

��

��&2'(�7+$7�/2236�7+528*+�',))(5(17�6&(1$5,26�

YRLG�ORRS��^�

���02725�,1�;�/('�'2(6�127�029(�

��LI�GLJLWDO5HDG���� ����GLJLWDO5HDG���� ���^�

����GLJLWDO:ULWH�����/2:���

����GLJLWDO:ULWH�����/2:����

��`�

��

��027,21�,1�;�/('�72�7+(�5,*+7�

��LI�GLJLWDO5HDG���� ���^� ��,I�WKH�MR\VWLFN�LV�SXVKHG�ULJKW�

����GLJLWDO:ULWH�����+,*+����������'HFLGHV�ZKDW�GLUHFWLRQ�WKH�PRWRU�URWDWHV�

����GLJLWDO:ULWH�����/2:���

��`�

��

��027,21�,1�;�/('�72�7+(�/()7�

��LI�GLJLWDO5HDG���� ���^� ��,I�WKH�MR\VWLFN�LV�SXVKHG�WR�OHIW�

����GLJLWDO:ULWH�����/2:�����������'HFLGHV�ZKDW�GLUHFWLRQ�WKH�PRWRU�URWDWHV�

����GLJLWDO:ULWH�����+,*+���

��`�

��

���02725�,1�<�/('�'2(6�127�029(�

��LI�GLJLWDO5HDG���� ����GLJLWDO5HDG���� ���^�

����GLJLWDO:ULWH�����/2:���

����GLJLWDO:ULWH�����/2:����

��`�

��

��027,21�,1�<�/('�)25:$5'�

��LI�GLJLWDO5HDG���� ���^� ��LI�WKH�MR\VWLFN�LV�SXVKHG�IRUZDUG�

����GLJLWDO:ULWH�����/2:�����������'HFLGHV�ZKDW�GLUHFWLRQ�WKH�PRWRU�URWDWHV�

����GLJLWDO:ULWH�����+,*+���

��`�

��

��5g5(/6(�,�<�5,.71,1*�%$.c7�

��LI�GLJLWDO5HDG���� ���^� ��LI�WKH�MR\VWLFN�LV�SXOOHG�EDFNZDUGV�

����GLJLWDO:ULWH�����+,*+����������'HFLGHV�ZKDW�GLUHFWLRQ�WKH�PRWRU�URWDWHV�

����GLJLWDO:ULWH�����/2:���

��`�

29

Page 40: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

APPENDIX B. PROGRAM CODE

��02725�,1�=�/('�'2(6�127�029(�

��LI�GLJLWDO5HDG�$��� ����GLJLWDO5HDG�$��� ���^�

����GLJLWDO:ULWH����/2:���

����GLJLWDO:ULWH����/2:����

��`�

��

��027,21�,1�=�/('�'2:1�

��LI�GLJLWDO5HDG�$��� ���^� ��EXWWRQ�IRZ�ORZHULQJ�WKH�FODZ�LV�SXFKHG�

����GLJLWDO:ULWH����+,*+��� ��'HFLGHV�ZKDW�GLUHFWLRQ�WKH�PRWRU�URWDWHV�

����GLJLWDO:ULWH����/2:���

��`�

��

��027,21�,1�=�/('�83�

��LI�GLJLWDO5HDG�$��� ���^� ��%XWWRQ�IRU�KHLVWLQJ�WKH�FODZ�LV�SXVKHG�

����GLJLWDO:ULWH����/2:��� ��0RYLQJ�XSZDUGV�

����GLJLWDO:ULWH����+,*+���

��`�

� �

��6(59202725�23(1�&/26(�&/$:��

��LI�GLJLWDO5HDG�$��� �����SRV�! ����SRV�� �����^ ��2SHQLQJ�EXWWRQ�SXVKHG�

����P\VHUYR�ZULWH�SRV����������������WHOO�VHUYR�WR�JR�WR�SRVLWLRQ�LQ�YDULDEOH�SRV�

����GHOD\������� ���ZDLWV����PV�IRU�WKH�VHUYR�WR�UHDFK�WKH�SRVLWLRQ�

����SRV����

��`�

��

��LI�GLJLWDO5HDG�$��� ����GLJLWDO5HDG�$��� ���^� ��QR�EXWWRQ�SXVKHG�

����P\VHUYR�ZULWH�SRV���

��`�

��

��LI�GLJLWDO5HDG�$��� �����SRV�! ����SRV�� �����^ ��&ORVLQJ�EXWWRQ�SXVKHG�

����P\VHUYR�ZULWH�SRV����������������WHOO�VHUYR�WR�JR�WR�SRVLWLRQ�LQ�YDULDEOH�SRV�

����GHOD\���������������������������ZDLWV���PV�IRU�WKH�VHUYR�WR�UHDFK�WKH�SRVLWLRQ�

����SRV����

��`�

`�

30

Page 41: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Appendix C

Photographs

Pictures of the finished Claw Machine taken by the author. There may be deviationsfrom the rendered photos from the CAD, because of changes made due to thecircumstances.

31

Page 42: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

APPENDIX C. PHOTOGRAPHS

32

Page 43: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

33

Page 44: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

APPENDIX C. PHOTOGRAPHS

34

Page 45: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

Appendix D

Rendered photos

Rendered pictures of the finished Claw Machine CAD taken by the author.

35

Page 46: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

APPENDIX D. RENDERED PHOTOS

36

Page 47: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

37

Page 48: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

APPENDIX D. RENDERED PHOTOS

38

Page 49: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

39

Page 50: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 51: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple
Page 52: Claw Machine TivoliautomatenThe concept behind the microcontroller will be discussed in the theory chapter in this report. The best suited motors and components for creating a simple

TRITA TRITA-ITM-EX 2020:31

www.kth.se