• No results found

Claw Machine

N/A
N/A
Protected

Academic year: 2022

Share "Claw Machine"

Copied!
49
0
0

Loading.... (view fulltext now)

Full text

(1)

DEGREE PROJECT IN MECHANICAL ENGINEERING,

FIRST CYCLE, 15 CREDITS STOCKHOLM, SWEDEN 2020

Claw Machine

Bachelors thesis in mechatronics HENRIK GAUFFIN

ISIDOR SÖDERMAN LUNDQVIST

1

(2)
(3)

Claw Machine

Bachelors thesis in mechatronics

HENRIK GAUFFIN, ISIDOR S ¨ODERMAN LUNDQVIST

Bachelor’s Thesis at ITM Supervisor: Nihad Subasic

Examiner: Nihad Subasic

(4)
(5)

Abstract

A simple idea can have many different construction solu- tions and a claw machine is a good machine to try different solutions on. The goal of this thesis was to find out how a claw machine could be created as simple as possible and finding out which parts that were essential in constructing the machine. The claw machine’s shell was built using a laser cutter and details were 3D-printed. With 4 metal rods and two stepper motors the claw machine gantry worked properly. Finally a 3D-printed claw was made and attached to a servo motor and a stepper motor, a functional claw ma- chine had been constructed. The conclusions of this thesis was that stop-sensors were not necessary in the making of the machine as the motors can’t move the claw further than to the edges and risk damaging the machine, step count- ing with proper belts is an alternative. Further conclusions was that 3D-printed bearings creates too much friction and therefore the gantry can’t operate, and using a fixed timing belt instead of a movable one is to prefer.

(6)

Referat

Klomaskin

En enkel id´e kan ha m˚anga olika konstruktionsl¨osningar, en klomaskin ¨ar ett exempel p˚a en s˚adan id´e som kan funge- ra som ett exempel att pr¨ova olika konstruktionsl¨osningar p˚a. M˚alet med det h¨ar kandidatexamensarbetet var att un- ders¨oka hur en klomaskin kan uppn˚a sin funktion genom att ta reda p˚a vilka komponenter som ¨ar viktigast f¨or att konstruera maskinen. Klomaskinens skal lasersk¨ardes och detaljdelar 3D-printades. Med 4 metallst¨anger och stegmo- torer s˚a fungerade klomaskinens st¨allning. Slutligen s˚a var klomaskinen konstruerad. Slutsatser av det h¨ar kandida- texamensarbetet var att stoppsensorer inte var n¨odv¨andiga eftersom motorerna inte kunde f¨ora klon l¨angre ¨an i det be- gr¨ansade omr˚adet och riskera att skada maskinen, stegr¨akning

¨ar ett alternativ med kuggremmar som inte slirar. Andra slutsatser var att 3D-utskrivna lager resulterade i mycket friktion och d¨armed en mekanism som inte fungerade och att anv¨anda en fix kuggrem ¨ar att f¨oredra ¨over en r¨orlig.

Nyckelord: Stegmotorer, Mekatronik, 3D-utskriven-st¨allning, Arduino, Kuggrem, Lager.

(7)

Acknowledgements

We would like to thank Nihad Subasic for his lectures and guidance throughout this project. A special thanks to Seshagopalan Thorapalli Muralidharan for his relentless support and help in this project. We would also like to thank Tomas

¨Ostberg for supplying us with material from the metal workshop.

(8)

Contents

1 Introduction 1

1.1 Background . . . 1

1.2 Purpose . . . 1

1.3 Scope . . . 2

1.4 Method . . . 2

2 Theory 3 2.1 Microcontroller . . . 3

2.2 Stepper motor . . . 3

2.3 Stepper motor driver . . . 4

2.4 180° servo motor . . . 4

2.5 Claw . . . 4

2.6 Gantry . . . 4

2.7 Shell . . . 5

3 Method 7 3.1 Defining the claw machine . . . 7

3.2 Electronics . . . 8

3.2.1 Microcontroller . . . 8

3.2.2 Stepper motor . . . 8

3.2.3 Stepper motor driver . . . 8

3.2.4 180°servomotor . . . 8

3.3 Construction . . . 9

3.3.1 Shell . . . 9

3.3.2 Claw . . . 10

3.3.3 Rods . . . 10

3.3.4 Drive . . . 11

3.3.5 Bearings . . . 11

3.3.6 Display, joystick and buttons . . . 11

3.4 Software . . . 12

4 Results 13 4.1 Essential parts of a claw machine . . . 14

(9)

4.2 Construction . . . 14

4.2.1 Bearings . . . 15

4.2.2 Timing Belt . . . 15

5 Discussion 17 5.1 Gantry . . . 17

5.2 Shell . . . 17

5.3 Electronics . . . 17

5.4 Programming . . . 18

5.5 Recommendations for further development . . . 18

Bibliography 19

Appendices 1

A KH56-JM2-851 Stepper motor 1

B DRV8825 Stepper motor driver 5

C Tower pro MG90S Servo motor 9

(10)

List of Figures

2.1 Schematic of a gripper [10] . . . . 5

3.1 First draft of the overlay, sketched by hand . . . . 7

3.2 Schematic diagram, made in Fritzing . . . . 8

3.3 Early version of the Claw machine shell, made in Solid Edge. . . . 9

3.4 3D-printed Claw with the servo mounted, photo taken with Huawei P20 10 3.5 3D-printed bearing to the left and 3D-printed housing for linear bearing to the right . . . 11

3.6 Flow chart for the code, made in Draw.io. . . 12

4.1 Picture of the final construction of the claw machine, photo taken with iPhone XS . . . 13

4.2 3D-render of the shell and gantry made in Keyshot 7 . . . 14

4.3 The bar diagram displays the A-weighted decibel level of the two timing belts. Made in Matlab . . . 15

(11)

List of abbreviations

DC-Motor Direct Current motor LCD Liquid Crystal Display

3-D Three Dimensional

LED Light Emitting Diode

Arduino-IDE Arduino Integrated Development Environment

CAD Computer Aided Design

USB Universal Serial Bus PMMA Poly(methyl methacrylate)

(12)
(13)

Chapter 1

Introduction

A simple idea can have a multitude of different construction solutions that give it different features depending on the choices made. An example of this is a claw machine. A claw machine has a multitude of different construction options, for example, should the shell be 3D-printed, should it be laser cut or cut by hand.

Should the gantry be constructed with metal rods or with PVC-plastics. These are only a fraction of the construction options available. Is there construction options that are more time and or money saving than others? Furthermore will these money saving construction options function. These questions will be researched and discussed in this thesis.

1.1 Background

This project considers the entire construction of a claw machine. The aim was to research how one optimally could create a claw machine to see what construction options work best. The results of this thesis could be used for similar constructions in the future to save time and effort.

1.2 Purpose

The objective of this project was to create a claw machine that could by human direction, seek out a coordinate, grab an object at the coordinate and return it to a certain point. The purpose of this project was to learn basic programming, design and mechanics in mechatronics by building a claw machine. Realizing that the Arduino Uno comes with a limited amount of pins, compromises will have to be made to construct a working machine that is operated with a joystick. This thesis strives to answer the following research questions:

• How can a claw machine be created using a microcontroller, and which parts are most essential together with an Arduino Uno to get a working claw ma- chine?

(14)

• How can the construction of a claw machine be as simple and optimal as possible?

1.3 Scope

The focus in this project was to implement a joystick-controlled system that could accurately reach the positions that the operator wished. The main limitations of this project is the budget of 1000 Swedish kronor (SEK) and the limited amount of time, there was a need of finding cheap components from a limited amount of retailers but also finding a construction that can be completed within four months.

The mechanical system only needed to hold its own weight and as a consequence there is little to no need of solid mechanics calculations. Due to the ongoing pan- demic, Covid-19, a lot of compromises had to be made. Especially the time between designing prototypes and getting them from the lab was substantially longer than it would have been with free access which meant more down time where no con- structing could be done while waiting for crucial parts.

1.4 Method

First some sketches were drawn to get a general idea of how the machine was going to be built. These sketches were later implemented into CAD, more specifically Solid Edge[1]. Where the casing for the box was created, dimensions were set and the claw was constructed in detail[2]. The gantry on which the claw was mounted on made up the X,Y-plane. This enabled the claw to move in the designated plane similar to a 3D-printer[3]. After the dimensions and the claw were composed, an iterative programming process took place. The software for the machine was created with a flow chart and a schematic view of the electronics. The research questions were answered by trying different construction options while constructing the claw machine. In the following phase the prototype construction began, until a claw machine was created, that was operational.

2

(15)

Chapter 2

Theory

2.1 Microcontroller

In most electronic devices there is at least one microcontroller, in a vehicle such as a car there is often seven[4]. A microcontroller is basically a tiny computer that is designed for a specific purpose. Microcontrollers are characterized by:

• They are embedded in a device so that they can control the features and actions of the device

• They are dedicated to one task

• They are often low power devices

• They have a dedicated input device

If a computer matches most of these characteristics it is most likely a microcon- troller. [4]

An example of a microcontroller is the Arduino Uno. The Arduino Uno has several output and input outlets, and also a input for a USB which allows easy access to a computer. The Arduino Uno has thirteen digital pins and five analog pins which enables it to control other components by plugging them into the pins.

It also has a 5 volt outlet to allow the arduino to be powered without USB-outlet nearby. [5]

2.2 Stepper motor

A stepper motor is a brushless direct current electric motor that divides a full rotation into a large number of equal steps. It rotates a specific distance for each step and each step corresponds to a specific code, therefore it’s possible to keep track of the position of the motor or what it’s driving. Stepper motors can with high precision control how far and how fast the stepper motor will rotate. The

(16)

amount of steps the motor executes is the same amount as the number of input signals given by the micro controller. [6]

2.3 Stepper motor driver

A stepper motor driver is used to control a stepper motor. It adjusts the current in the motor and also which phase of the motor that is active. There are four different ways to power the motor; wave drive, two-phase on, one-two-phase on drive and micro stepping. Full step in particular provides good torque while Micro stepping provides finer motion than the other drive types. [7]

2.4 180° servo motor

A servo motor can be used to turn a claw, in this instance, a specific amount of degrees. It allows for high precision in angular motion as well as velocity and acceleration. It’s made up by a Direct Current-motor, a gear system, a position sensor as well as a control circuit.[8]

2.5 Claw

There are a lot of different grippers, depending on the power source and the con- struction but they all have similarities. There are vacuum, hydraulic, pneumatic, servo-electric grippers. Since the grippers all have different benefits and drawbacks, it’s important to define what the gripper is for and in what environment it will be used in. Servo-electric grippers are easy to control, the grippers are flexible which allows gripping of delicate items, they are also the most cost effective of the four and require little to no maintenance. [9]

For the servo-electric gripper an input signal is sent from a robot control unit.

With most electric-grippers the signal can be a force, speed or a position. The signal is received by the module responsible for driving the gripper’s motor. The servo-electric motor reacts to the signal. And the module will begin to execute the received signal. Some grippers can send status signals back to the robot control unit. [10] This schematic is shown in figure 2.1

2.6 Gantry

To get full reach in the designated plane, a co-ordinate system on which the claw could move along was needed. A gantry system similar to a 3D-printer, where the X and Y-axis are built up by two pairs of rails each was designed. These are powered by a stepper motor each, with an additional motor for movement in the Z-axis which is a string with the claw attached to it. The gantrys fundamentals was inspired by a project which had a similar foundation for movement in the X- and Y-axis. [11]

4

(17)

Figure 2.1. Schematic of a gripper [10]

2.7 Shell

The building material for the shell depends on mechanical strength, weight as well as availability. The idea for the shell is to be laser cut. The main options in the lab are acrylic plastic and plywood. The Elastic modulus of PMMA is 3000 MPa [13]

while plywood depending on quality is between 500 up to 14000 MPa [14]. Plywood is preferred if possible since it’s easy to work with tools like saws and drills and should be stiffer if the quality is good.

(18)
(19)

Chapter 3

Method

3.1 Defining the claw machine

The construction phase started with sketching a rough draft of the overlaying con- struction. The result is shown in figure 3.1, which was used as a reference point for the CAD-modelling. The sketch shows how the claw were supposed to move around on rods. The box in the front displays where the joystick as well as the LCD were placed.

Figure 3.1. First draft of the overlay, sketched by hand

(20)

3.2 Electronics

3.2.1 Microcontroller

To enable the usage of components, all of the devices were plugged into an Arduino Uno, if not directly, indirectly. The schematic diagram is shown in figure 3.2.

Figure 3.2. Schematic diagram, made in Fritzing

3.2.2 Stepper motor

The gantry’s movement was controlled by three stepper motors, model KH56JM2- 851, data sheet can be seen in Appendix A. The reason why a stepper motor was chosen instead of a DC motor is because of a higher precision in the stepper mo- tor compared to a regular DC motor, but also because these stepper motors were available at KTH.

3.2.3 Stepper motor driver

The Stepper motor driver chosen was the model DRV8825, data sheet in Appendix B. One was needed for each stepper motor to control the current and which phase was active. This translates into which direction the motor is spinning as well as torque and speed.

3.2.4 180°servomotor

The servo motor that powered the claw was a Tower pro MG90S, data sheet in Appendix C. The reasoning behind choosing a small servo motor was that the claw needs to be supple so it wouldn’t get stuck when moving, but also because it needed to be lightweight because this was one of the most critical places considering stress load. An 180°servo was decided upon since the claw used a gripping motion which only turned a maximum of 180°.

8

(21)

3.3 Construction

3.3.1 Shell

The shell schematics were made in CAD, first draft pictured in figure 3.3. The original idea was using plywood but because of limitations when choosing material, the shell was made in 3 mm acrylic. The material is stiff and easily worked with a drill or a saw which made it possible to modify after laser cutting. The parts were then bolted together with some 3D-printed brackets.

Figure 3.3. Early version of the Claw machine shell, made in Solid Edge.

(22)

3.3.2 Claw

The claw was found on thingiverse[15], a website where people upload their designs, for mechatronic projects, amongst other things. This claw was meant to be a testing device but it ended up working so well that it was kept in the final construction.

The parts were 3D-printed and mounted together with bolts, nuts and washers size M2. A problem occurred where the nuts shook off the bolts. Therefor loctite was acquired and added to the bolts so they would stay in place. This also meant they didn’t have to be tightened down so hard which made the movement of the claw smoother. The final claw is pictured in figure 3.4.

Figure 3.4. 3D-printed Claw with the servo mounted, photo taken with Huawei P20

3.3.3 Rods

Rods were used to create a XY-plane, where the claw would could move. These rods were supplied by the metal workshop at KTH. A semi-smooth rod was acquired, cut into 4 pieces, sandpapered down to get rid of rust and other impurities and to create a lower friction over the area. They were also greased up using canola oil in order to get even less friction. These rods are an essential part of the gantry.

10

(23)

3.3.4 Drive

To be able to move in the X-,Y- and Z-direction a timing belt and cogs were needed to mount on the stepper motor’s rods to be able to move the gantry. The Y-axis timing belt was fixed, and the X-axis timing belt was move able to find out which solution of the two works best.

3.3.5 Bearings

To be able to answer how the construction could be as simple as possible, two different bearings were used in this thesis. One pair that were 3D-printed in plastic, which can be seen in figure 3.5 to the left. One pair that were linear bearings, which can be seen in figure 3.5 to the right.

Figure 3.5. 3D-printed bearing to the left and 3D-printed housing for linear bearing to the right

3.3.6 Display, joystick and buttons

The display was supposed to be a 4x20 LCD display with a blue and white LED but because of limitations with the pins in the arduino, a 16x2 lCD screen with a I2C bridge was used instead, because it only uses 4 pins from the Arduino, therefore two buttons could be plugged in instead of a single one.

The joystick that is used is an arcade joystick from Luxorparts, the choice was made to create a more retro feeling to the claw machine.

(24)

3.4 Software

To program the Arduino Uno, Arduino’s own software the Arduino IDE was used which is a software to write code in, and it is very similar to C or C++. The code is then uploaded to the Arduino through a USB cable. The code can be located in Appendix D, the flow chart in figure 3.6 was used as a stepping stone for the code.

Figure 3.6. Flow chart for the code, made in Draw.io.

12

(25)

Chapter 4

Results

The Claw machine was operational with some of the construction options that were tested. See picture in figure 4.1.

Figure 4.1. Picture of the final construction of the claw machine, photo taken with iPhone XS

(26)

4.1 Essential parts of a claw machine

Movement has to be achieved for the machine to operate properly and stepper motors filled this need. Stepper motors were decided upon because they’re very accurate and they have the ability to count steps, this made the claw’s position known at all times. The mounts for the stepper motors were also very sleek which makes maintenance easy. A timing belt attached to the stepper motors with a cog mounted on the stepper motors rods, resulted in linear movement on the X- and Y-axis. Proper linear bearings are also necessary for smooth movement and lesser wear. Since the machine was supposed to be operated with a joystick there were only a few options left considering the amount of pins on the Arduino. Buttons were used to control the movement in the Z-direction and the opening and closing of the claw. The first button hoisted down the claw, closed it and went back up.

The other button opened the claw. A 16x2 LCD-screen was used instead of the planned 20x4 LCD because a I2C bridge had been soldered onto the smaller one, therefore it only required 2 pins on the Arduino Uno. A considered option was to use a time counter to program the claw entirely but buttons were used instead because it involved the user more in the controlling of the machine.

4.2 Construction

A final rendering of the CAD model of the claw machine can be seen in figure 4.2 where all the parts that were made in Solid Edge are present.

Figure 4.2. 3D-render of the shell and gantry made in Keyshot 7

14

(27)

4.2.1 Bearings

The different bearings that were used gave different results. The 3D-printed plastic bearings couldn’t glide at all because of the friction and the skew. When first tested, they glided great individually which indicates a sufficient friction coefficient. Later on, when the bearings were applied on the gantry, a shearing effect appeared where the bearings locked onto the rods and cancelled all movement. The timing belt was mounted on one of the bearings which leads to an uneven torque that attempts to shear the gantry, this is likely the biggest factor that the 3D-printed bearings weren’t able to move. The linear bearings that were tested after the 3D-printed bearings, roll on small balls that can’t latch onto the edges and lock the movement compared to the hard edges of the 3D-printed bearings. They also fit the axles better than the 3D-printed bearings did. Therefore linear bearings were used in the construction.

4.2.2 Timing Belt

Using a timing belt that is fixed resulted in a much smoother movement with less friction, this is seen in figure 4.3 where A-weighted decibel measurements were done at four separate occasions. The higher sounds level indicates more friction. The X-axis created a higher decibel measurement than the Y-axis.

The move able timing belt made it necessary to acquire more bearings while the fixed timing belt just required a tight tension in the belt as long as it lined up with the cog on the motor. Furthermore the move able timing belt required holes in the bottom shelf and this increases the risk of the timing belt getting stuck. A timing belt that is fixed yields the best results in this testing.

Figure 4.3. The bar diagram displays the A-weighted decibel level of the two timing belts. Made in Matlab

(28)
(29)

Chapter 5

Discussion

5.1 Gantry

The original idea with 3D-printing bearings for the gantry ended up being a bad solution, since they were prone to lock up the gantry and couldn’t move at all. A decision to instead get hold of proper linear bearings resulted in a move able gantry.

If the linear bearings are gonna be used, there seems to be no need to sand paper the semi smooth rods and oil them up. The bearings will work just fine.

5.2 Shell

The shell was originally supposed to be made in 5 mm plywood but it ended up being made in 3 mm acrylic. There had to be some changes in the construction to get enough rigidity in the shell like removing holes where there were supposed to be glass panels. A key difference in the construction compared to the original idea was the use of bolts when mounting the side plates together instead of gluing.

It made maintenance easier as well as further modifications easier to make. For a permanent solution glue could be used, but for this purpose, bolting them together is by far the best solution. The material chosen is a bit too flexible, high quality plywood is likely a better material considering it’s stiffer, but for these purposes it’s a sufficient material. A thicker acrylic could have been used as well but it’s costlier and wasn’t available in the quantity that was needed.

5.3 Electronics

A problem in the construction of this claw machine was missing pins on the Arduino Uno. To build a more robust construction, one could expand using some items that need pins on the Arduino Uno. For example, sensors could be used when the gantry approached the edge of the rods to stop movement. Since all of the pins were already used, this could not be done. Using an Arduino Mega would solve this problem, since it has considerably more pins.

(30)

5.4 Programming

There is a lot of room for improvement in the programming. The programming mostly consists of if-statements that creates the mobility of the electronics. If one would use a for loop, the if statements would stop working until the for loop was finished. A solution would be to create a switch state function for the different stages the machine is in, this would enable an easy way to involve the screen a lot more instead of only containing instructions.

In the early stages of the project, the goal was to create a claw that would move to the price hatch automatically after the user pressed a button. This was hard to implement because of the movable timing belt. The moving timing belt was not very precise because it got stuck and jumped a bit. This hindered us to implement a step counter in the code, and without the step counter it was hard to keep track of where the gantry was on the X-axis. There is no apparent risk of the machine damaging itself by attempting to go too far except for the risk of the motors or drivers overheating themselves.

5.5 Recommendations for further development

A big restriction was the number of pins on the Arduino Uno. Having access to a larger number of pins would have made it possible to add stop sensors for the respective axes as well as a wheel adjusting the degrees the servo is turning. The machine that was built brings the joy of skillfully lining up the claw and catching something as well as bringing it back. It functions much like intended but it’s not as versatile as it could be. If the motors were to be stronger there would be a risk of the machine damaging itself because it attempts to go further than it can, therefore stop sensors would definitely be an improvement. The plastic acrylic shell is a bit too flexible and could definitely be thicker to add more rigidity to the construction.

For this purpose 3 mm acrylic is fine but for longevity it’s something that could be improved upon. Further improvements could be made with sound effects when hitting the hatch or lights around the edges much like in an arcade. That would require some additional sensors and pins on the Arduino but would certainly make the end product look fancier.

Trying to create a more robust construction would be good to minimise the amount of possible malfunction scenarios that could arise, for example one could use just cut the cables into the whole specified length instead of using shorter ones that are intertwined as we did. Another thing to improve upon is to solder together wires where wires need to be connected instead of using electrical tape. Another problem that occurred was that the cables from the servo got stuck on the bolts on the claw. A solution to this could be to use shorter bolts that don’t stick out as long.

18

(31)

Bibliography

[1] Solid Edge ST10. (2017). Siemens PLM Software.

[2] Antonsson, T. & J¨onsson, S. (2019). Pac-King: Placement of IR Sensors on Line Following Robot and Construction of a Gripper and Lift (Dissertation) Available at: urn:nbn:se:kth:diva-264510

[3] Ardestam, F. & Soltaniah, S. (2018). Dot Master: Braille printer (Dissertation) Available at: urn:nbn:se:kth:diva-230242

[4] Marshall Brain, How Microcontrollers work. 11/9-2000 [Online] Available at:

https://electronics.howstuffworks.com/microcontroller.htm

[5] Arduino Uno. [Online]. Available at: https://store.arduino.cc/arduino-uno-rev3 [Accessed 13/02-2020].

[6] Appelgren, A. (2010). Automated control and test system for long time stess tests of microwave ovens (Dissertation). Available at:

http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-93515

[7] Bergman, J., & Lind, J. (2019). Robot Vacuum cleaner (Dissertation). Available at: http://urn.kb.se/resolve?urn=urn:nbn:se:kth:diva-264502

[8] Servo Motor – Working, Advantages Disadvantages [Online] Available at:

https://www.elprocus.com/servo-motor/ [Accessed 16 Feb 2020]

[9] RobotWorx. (n.d.). Grippers For Robots. [online]. Available at: https://www.

robots.com/articles/grippers-for-robots [Accessed 11 Feb 2020].

[10] Bouchard, S. (2011). Servo-Electric Grippers: How does it Work?. [online]

Robotiq. [Online]. Available at: https://blog.robotiq.com/bid/37839/ Servo- Electric-Grippers-How-does-it-Work [Accessed 11 Feb 2020].

[11] Adeeb, K., & Alveteg, A. (2019). SIYA - Slide Into Your Albums: Design and construction of a controllable dolly camera with object recognition (Dissertation).

Available at: http://urn.kb.se/resolve?urn=urn:nbn:se:kth:diva-264450

[12] B. Earl What is a stepper motor? [Online]. Available at:

https://learn.adafruit.com/all-about-stepper-motors/what-is-a-stepper-motor [Accessed 11 Feb 2020]

(32)

[13] Materialguide polybase [Online]. Available at:

https://www.polybase.se/materialguide [Accessed 6 May 2020]

[14] E. Borgstr¨om, Dimensionering av tr¨akonstruktioner Del 2 utg˚ava 2:2016, ISBN 978-91-981922-7-8 Skogsindustrierna, Svenskt Tr¨a

[15] https://www.thingiverse.com/thing:1814436 [Online] [Accessed 11 May 2020]

20

(33)

Appendix A

KH56-JM2-851 Stepper motor

(34)
(35)
(36)
(37)

Appendix B

DRV8825 Stepper motor driver

(38)

DRV8825

www.ti.com SLVSA73F – APRIL 2010 – REVISED JULY 2014

6 Pin Configuration and Functions

Pin Functions

PIN EXTERNAL COMPONENTS

I/O(1) DESCRIPTION OR CONNECTIONS

NAME NO.

POWER AND GROUND

CP1 1 I/O Charge pump flying capacitor

Connect a 0.01-μF 50-V capacitor between CP1 and CP2.

CP2 2 I/O Charge pump flying capacitor

GND 14, 28 Device ground

Connect a 0.1-μF 16-V ceramic capacitor and a 1-MΩ resistor to VCP 3 I/O High-side gate drive voltage

VM.

VMA 4 Bridge A power supply Connect to motor supply (8.2 to 45 V). Both pins must be connected to the same supply, bypassed with a 0.1-µF capacitor VMB 11 Bridge B power supply to GND, and connected to appropriate bulk capacitance.

Bypass to GND with a 0.47-μF 6.3-V ceramic capacitor. Can be V3P3OUT 15 O 3.3-V regulator output

used to supply VREF.

CONTROL

AVREF 12 I Bridge A current set reference input Reference voltage for winding current set. Normally AVREF and BVREF are connected to the same voltage. Can be connected to BVREF 13 I Bridge B current set reference input V3P3OUT.

Low = slow decay, open = mixed decay,

DECAY 19 I Decay mode high = fast decay.

Internal pulldown and pullup.

DIR 20 I Direction input Level sets the direction of stepping. Internal pulldown.

MODE0 24 I Microstep mode 0

MODE0 through MODE2 set the step mode - full, 1/2, 1/4, 1/8/

MODE1 25 I Microstep mode 1

1/16, or 1/32 step. Internal pulldown.

MODE2 26 I Microstep mode 2

NC 23 No connect Leave this pin unconnected.

Logic high to disable device outputs and indexer operation, logic

nENBL 21 I Enable input

low to enable. Internal pulldown.

Active-low reset input initializes the indexer logic and disables the

nRESET 16 I Reset input H-bridge outputs. Internal pulldown.

Logic high to enable device, logic low to enter low-power sleep

nSLEEP 17 I Sleep mode input

mode. Internal pulldown.

Rising edge causes the indexer to move one step. Internal

STEP 22 I Step input pulldown.

STATUS

nFAULT 18 OD Fault Logic low when in fault condition (overtemp, overcurrent)

(1) Directions: I = input, O = output, OD = open-drain output, IO = input/output

Copyright © 2010–2014, Texas Instruments Incorporated Submit Documentation Feedback 3

Product Folder Links:DRV8825

(39)

DRV8825

SLVSA73F – APRIL 2010 – REVISED JULY 2014 www.ti.com

Pin Functions (continued)

PIN EXTERNAL COMPONENTS

I/O(1) DESCRIPTION OR CONNECTIONS

NAME NO.

nHOME 27 OD Home position Logic low when at home state of step table

OUTPUT

AOUT1 5 O Bridge A output 1 Connect to bipolar stepper motor winding A.

Positive current is AOUT1→ AOUT2

AOUT2 7 O Bridge A output 2

BOUT1 10 O Bridge B output 1 Connect to bipolar stepper motor winding B.

Positive current is BOUT1→ BOUT2

BOUT2 8 O Bridge B output 2

ISENA 6 I/O Bridge A ground / Isense Connect to current sense resistor for bridge A.

ISENB 9 I/O Bridge B ground / Isense Connect to current sense resistor for bridge B.

7 Specifications

7.1 Absolute Maximum Ratings(1) (2)

MIN MAX UNIT

Power supply voltage –0.3 47 V

V(VMx)

Power supply ramp rate 1 V/µs

Digital pin voltage –0.5 7 V

V(xVREF) Input voltage –0.3 4 V

ISENSEx pin voltage(3) –0.8 0.8 V

Peak motor drive output current, t < 1μs Internally limited A

Continuous motor drive output current(4) 0 2.5 A

Continuous total power dissipation SeeThermal Information

TJ Operating junction temperature range –40 150 °C

(1) Stresses beyond those listed under Absolute Maximum Ratings may cause permanent damage to the device. These are stress ratings only, and functional operation of the device at these or any other conditions beyond those indicated under Recommended Operating Conditions is not implied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.

(2) All voltage values are with respect to network ground terminal.

(3) Transients of ±1 V for less than 25 ns are acceptable (4) Power dissipation and thermal limits must be observed.

7.2 Handling Ratings

MIN MAX UNIT

Tstg Storage temperature range –60 150 °C

Human body model (HBM), per ANSI/ESDA/JEDEC JS-001, all pins(1) –2000 2000 Electrostatic

V(ESD) discharge Charged device model (CDM), per JEDEC specification JESD22-C101, all pins(2) –500 500 V

(1) JEDEC document JEP155 states that 500-V HBM allows safe manufacturing with a standard ESD control process.

(2) JEDEC document JEP157 states that 250-V CDM allows safe manufacturing with a standard ESD control process.

7.3 Recommended Operating Conditions

MIN NOM MAX UNIT

V(VMx) Motor power supply voltage range(1) 8.2 45 V

V(VREF) VREF input voltage(2) 1 3.5 V

IV3P3 V3P3OUT load current 0 1 mA

(1) All VMpins must be connected to the same supply voltage.

(2) Operational at VREF between 0 to 1 V, but accuracy is degraded.

(40)
(41)

Appendix C

Tower pro MG90S Servo motor

(42)

MG90S servo, Metal gear with one bearing

Tiny and lightweight with high output power, this tiny servo i Helicopter, Quadcopter or Robot.

durability.

Servo can rotate approximately 180 degrees (90 in each direction), and works just like the standard kinds but smaller. You can use any servo code, hardware or library to control these servos. Good for beginners who want to make stuff move without building a motor controller with feedback & gear box, especially si

(arms) and hardware.

Specifications

• Weight: 13.4 g

• Dimension: 22.5 x 12 x 35.5

• Stall torque: 1.8 kgf·cm (4.8V )

• Operating speed: 0.1 s/60 degree

• Operating voltage: 4.8 V -

• Dead band width: 5 µs

MG90S servo, Metal gear with one bearing

Tiny and lightweight with high output power, this tiny servo is perfect for

, Quadcopter or Robot. This servo has metal gears for added strength and

ervo can rotate approximately 180 degrees (90 in each direction), and works just like the . You can use any servo code, hardware or library to control these beginners who want to make stuff move without building a motor controller with feedback & gear box, especially since it will fit in small places. It comes with a

35.5 mm approx.

(4.8V ), 2.2 kgf·cm (6 V)

degree (4.8 V), 0.08 s/60 degree (6 V) 6.0 V

s perfect for RC Airplane, r added strength and

ervo can rotate approximately 180 degrees (90 in each direction), and works just like the

. You can use any servo code, hardware or library to control these

beginners who want to make stuff move without building a motor controller

omes with a 3 horns

(43)

Position "0" (1.5 ms pulse) is middle, "90" (~2 ms pulse) is all the way to the left.

ms pulse) is middle, "90" (~2 ms pulse) is all the way to the right, "

the left.

ms pulse) is all the way to the right, "-90" (~1

(44)
(45)

Appendix D

Arduino Code

/∗KEX 4

∗Claw Machine

∗Datum 12−05−2020

∗ Skriven av : Henrik Gauffin och I s i d o r Lundqvist

∗Examinator : Nihad Subasic

∗TRITA−nr : 2020:24

∗Kurskod : MF133X

∗∗ Kandidatexamensarbete p KTH inom mekatronik

∗Denna kod s t y r en klomaskin med h j l p av en Arduino Uno .

∗∗Det h u v u d s a k l i g a s y f t e t f r koden r a t t s t y r a gantryn i XY−p l a n e t

∗och a t t s t y r a k l o n s g r i p f u n k t i o n och r r e l s e i Z−l e d .

∗∗ A n v n d a r g r n s s n i t t e t som a n v n d s r en j o y s t i c k , en 16 x2 LCD s k r m

∗med en I2C brygga och t v knappar .

∗/

#i n c l u d e <Servo . h> // I n k l u d e r a r o l i k a b i b l i o t e k f r a t t u n d e r l t t a

#i n c l u d e <LiquidCrystal I2C . h> //Programmeringen av v i s s a element

#i n c l u d e <Wire . h>

const i n t servo = 2 ; // Definerar Servo pin

const i n t enable = 3 ; // Blockerar s t r m f l d e f r a t t undvika verhettning . const i n t button1 = 4 ; // Definerar en knapp pin

const i n t button2 = 5 ;

const i n t dirPin1 = 8 ; // Definererar stegmotorpinsen const i n t stepPin1 = 9 ;

const i n t dirPin2 = 10 ;

(46)

const i n t stepPin2 = 1 1;

const i n t dirPin3 = 12 ; const i n t stepPin3 = 1 3;

const i n t jhoger = A0 ; // Definerar j o y s t i c k pinsen . const i n t j v a n s t e r = A1 ;

const i n t jupp = A2 ; const i n t j n e r = A3 ;

i n t x ; // F r a n t a l e t s t e g

Servo Servo1 ; // Definerar en Servo

LiquidCrystal I2C l cd (0 x27 , 16 , 2 ) ; //I2C bryggan a n v n d e r A4 och A5 void setup ( ) {

// Sets the two pins as Outputs

pinMode ( stepPin1 ,OUTPUT) ; // Stegmotors d i r och s t e p som output pinMode ( dirPin1 ,OUTPUT) ;

pinMode ( stepPin2 ,OUTPUT) ; pinMode ( dirPin2 ,OUTPUT) ; pinMode ( stepPin3 ,OUTPUT) ; pinMode ( dirPin3 ,OUTPUT) ; pinMode ( enable ,OUTPUT) ;

pinMode ( jhoger ,INPUT PULLUP ) ; // J o y s t i c k och knapp som input . pinMode ( jvans ter ,INPUT PULLUP ) ;

pinMode ( jupp ,INPUT PULLUP ) ; pinMode ( jner ,INPUT PULLUP ) ; pinMode ( button1 ,INPUT PULLUP ) ; pinMode ( button2 ,INPUT PULLUP ) ;

Servo1 . attach ( servo ) ; // S g e r v i l k e n servopin servon ska arbet a med l c d . i n i t ( ) ; // S t a r t a LCD

l c d . b a c k l i g h t ( ) ; // S t a r t a b a k g r u n d s l j u s e t l c d . setCursor ( 0 , 0 ) ;

l c d . p r i n t ( ”Knapp 1 , Hamta” ) ; l c d . setCursor ( 0 , 1 ) ;

l c d . p r i n t ( ”Knapp 2 , Slapp ” ) ; }

void loop ( ) {

d i g i t a l W r i t e ( enable ,HIGH) ; // Blockera f l d e t f r n s t r m k l l a n i f( d i g i t a l R e a d ( jupp)==0) //Om spaken dras upp . . . .

{

d i g i t a l W r i t e ( enable ,LOW) ; // L t s t r m f l d a in i stegmotordrivaren d i g i t a l W r i t e ( dirPin2 , HIGH) ; // Rotera Clockwise

delayMicroseconds ( 1 0 0 0 ) ;

f o r( x = 0 ; x < 5 0; x++) { //Hur mycket ska den rotera , x<50

d i g i t a l W r i t e ( stepPin2 ,LOW) ; // S t r m m s t e f l d a i en f y r k a n t s v g 14

(47)

delayMicroseconds ( 1 0 0 0 ) ; d i g i t a l W r i t e ( stepPin2 ,HIGH) ; delayMicroseconds ( 1 0 0 0 ) ; }

}

i f( d i g i t a l R e a d ( jhoger )==0) //Om Spaken dras h g e r . . . {

d i g i t a l W r i t e ( enable ,LOW) ; d i g i t a l W r i t e ( dirPin1 , HIGH) ; delayMicroseconds ( 1 0 0 0 ) ; f o r( x = 0 ; x < 5 0; x++) {

d i g i t a l W r i t e ( stepPin1 ,LOW) ; delayMicroseconds ( 1 0 0 0 ) ; d i g i t a l W r i t e ( stepPin1 ,HIGH) ; delayMicroseconds ( 1 0 0 0 ) ; }

}

i f( d i g i t a l R e a d ( j v a n s t e r )==0) {

d i g i t a l W r i t e ( enable ,LOW) ;

d i g i t a l W r i t e ( dirPin1 , LOW) ; // Rotera c o u n t e r c l o c k w i s e delayMicroseconds ( 1 0 0 0 ) ;

f o r( x = 0 ; x < 5 0; x++) { d i g i t a l W r i t e ( stepPin1 ,HIGH) ; delayMicroseconds ( 1 0 0 0 ) ; d i g i t a l W r i t e ( stepPin1 ,LOW) ; delayMicroseconds ( 1 0 0 0 ) ; }

}

i f( d i g i t a l R e a d ( j n e r )==0) {

d i g i t a l W r i t e ( enable ,LOW) ; d i g i t a l W r i t e ( dirPin2 , LOW) ; delayMicroseconds ( 1 0 0 0 ) ; f o r( x = 0 ; x < 5 0; x++) {

d i g i t a l W r i t e ( stepPin2 ,HIGH) ; delayMicroseconds ( 1 0 0 0 ) ; d i g i t a l W r i t e ( stepPin2 ,LOW) ; delayMicroseconds ( 1 0 0 0 ) ; }

}

i f( d i g i t a l R e a d ( button1)==0) {

d i g i t a l W r i t e ( enable ,LOW) ; //om knappen b l i r n e d t r y c k t r o t e r a

(48)

d i g i t a l W r i t e ( dirPin3 ,HIGH) ; //Ned klon delayMicroseconds ( 1 0 0 0 ) ;

f o r( x = 0 ; x < 850; x++) { d i g i t a l W r i t e ( stepPin3 ,HIGH) ; delayMicroseconds ( 1 0 0 0 ) ; d i g i t a l W r i t e ( stepPin3 ,LOW) ; delayMicroseconds ( 1 0 0 0 ) ; }

delay ( 4 0 0 ) ;

Servo1 . write ( 3 0 ) ; // V n t a , k l m klon , v n t a . delay ( 7 0 0 ) ;

d i g i t a l W r i t e ( dirPin3 ,LOW) ; // Rotera upp klon f o r( x = 0 ; x < 850; x++) {

d i g i t a l W r i t e ( stepPin3 ,HIGH) ; delayMicroseconds ( 1 0 0 0 ) ; d i g i t a l W r i t e ( stepPin3 ,LOW) ; delayMicroseconds ( 1 0 0 0 ) ; }

}

i f( d i g i t a l R e a d ( button2)==0) {

Servo1 . write ( 1 0 0 ) ; // ppna klon om knappen r n e d t r y c k t }

}

(49)

TRITA -ITM-EX 2020:24

References

Related documents

In the paper, I have discussed the line as medium to express the physical forces at of gravity, magnetism, velocity and sound and how they are connected to the

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in

Parallellmarknader innebär dock inte en drivkraft för en grön omställning Ökad andel direktförsäljning räddar många lokala producenter och kan tyckas utgöra en drivkraft

The operator has to verify if the folding beam tools will not hit the two flanges and if the clamping beam tool fits alongside the extension of the metal sheet that has not been

The plots suggest that some averaging estimators generate smaller risk than single model methods, seeing as both regularization path averaging and LASSO-GLM hybrid averaging

p.21). I have learned to move my arm, and every new piece of information about what I can do with it will add to my arm-moving-knowledge, and intuition is the modality through

The movement cues used by observers to distinguish performances with different emotional intentions from each other have clear similarities to the audio cues found in music