my first robot - automatic catapult

22
1 MY FIRST ROBOT - AUTOMATIC CATAPULT

Upload: others

Post on 29-Oct-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MY FIRST ROBOT - AUTOMATIC CATAPULT

1

MY FIRST ROBOT - AUTOMATIC CATAPULT

Page 2: MY FIRST ROBOT - AUTOMATIC CATAPULT

2

Contents Part list .......................................................................................................................................................... 3

Electronics: ................................................................................................................................................ 3

Mechanic parts: ........................................................................................................................................ 5

Shooting mechanism ..................................................................................................................................... 5

About the parts ............................................................................................................................................. 7

Arduino Nano ........................................................................................................................................ 7

Servo motor .......................................................................................................................................... 8

DC motor and L298N driver .................................................................................................................. 8

HC-SR-04 Ultrasonic distance sensor .................................................................................................... 8

Designing mechanical parts .......................................................................................................................... 8

3D-Modelling ............................................................................................................................................ 8

First side and second side ..................................................................................................................... 9

Arm ...................................................................................................................................................... 10

Place for improvements .......................................................................................................................... 10

3D-Printing .................................................................................................................................................. 10

Electric Wiring ............................................................................................................................................. 14

Powersource ........................................................................................................................................... 14

Wiring diagram........................................................................................................................................ 14

Soldering the components ...................................................................................................................... 15

Programing .................................................................................................................................................. 15

Code ........................................................................................................... Error! Bookmark not defined.

Place for improvements ............................................................................. Error! Bookmark not defined.

Casing .......................................................................................................................................................... 16

Place for improvements .......................................................................................................................... 16

Place for improvements ............................................................................. Error! Bookmark not defined.

Finishing the catapult .................................................................................................................................. 21

Page 3: MY FIRST ROBOT - AUTOMATIC CATAPULT

3

PART LIST

ELECTRONICS: 1x Arduino Nano

https://www.partco.fi/fi/arduino/arduino-mallit/17657-

arduino-nano.html

1x RC Car Gear Motor 3-6V

https://www.amazon.com/Cylewet-Motor-Shaft-

Arduino-

CYT1037/dp/B01N9MS3UZ/ref=pd_lpo_sbs_60_t_1?_en

coding=UTF8&psc=1&refRID=MEN5MKB1SQCQRMC2W2

1D

1x MG 996R Servo Motor

https://www.aliexpress.com/item/MG996R-MG995-

Servo-Metal-Gear-Motor-High-Torque-15kg-55g-90-180-

degree-for-Car-

Boat/32838381346.html?spm=2114.search0104.3.96.d6

1e3ac3q38ODw&ws_ab_test=searchweb0_0,searchweb

201602_5_10065_10068_10890_319_10546_317_1054

8_10696_453_10084_454_10083_433_10618_10304_1

0307_10820_537_536_10902_10059_10884_10887_32

1_322_10103,searchweb201603_57,ppcSwitch_0&algo_

expid=ead8e817-b2a9-405a-98a5-85f24f138227-

14&algo_pvid=ead8e817-b2a9-405a-98a5-85f24f138227

1x 3pin-switch

https://www.partco.fi/fi/saehkoemekaniikka/kytkimet/li

ukukytkimet/7283-kyt-liu15.html

Page 4: MY FIRST ROBOT - AUTOMATIC CATAPULT

4

1x HC-SR-04 Ultrasonic distance sensor

https://www.partco.fi/fi/robotit/robottielektroniikkaa/1

9362-hc-sr04.html?search_query=HC-SR&results=24

1x L298N DC motor driver

https://www.aliexpress.com/item/1pcs-L298N-driver-

board-module-L298-stepper-motor-smart-car-robot-

breadboard-peltier-High-

Power/32857475920.html?spm=2114.search0104.3.1.6a

4d7c3aF2j8zs&ws_ab_test=searchweb0_0,searchweb20

1602_3_10065_10068_319_10546_10059_10884_317_

10548_10887_10696_321_322_10084_453_10083_454

_10103_10618_10304_10307_10820_537_536,searchw

eb201603_52,ppcSwitch_0&algo_expid=66191b1d-

312e-48c5-a81c-17d0070f3a12-0&algo_pvid=66191b1d-

312e-48c5-a81c-17d0070f3a12

8x AA battery Found at normal grocery stores

1x 8 AA Battery casing

https://www.partco.fi/fi/akut-ja-

paristot/paristopitimet/9941-parpid-8xaa-

n.html?search_query=AA+paristo&results=292

1x 9V battery snap for battery casing

https://www.partco.fi/fi/akut-ja-

paristot/paristopitimet/9947-neppari-

i.html?search_query=9v+paristo&results=64

Page 5: MY FIRST ROBOT - AUTOMATIC CATAPULT

5

1x Prototyping board

https://www.aliexpress.com/item/86036-Free-shipping-

10pcs-Double-Side-Prototype-PCB-diy-Universal-Printed-

Circuit-Board-

4x6cm/32656277833.html?spm=2114.search0104.3.15.

3f75852aNuvjK3&ws_ab_test=searchweb0_0,searchweb

201602_5_10065_10068_10890_319_10546_317_1054

8_10696_10084_453_454_10083_10618_10304_10307

_10820_537_536_10902_10059_10884_10887_321_32

2_10103,searchweb201603_57,ppcSwitch_0&algo_expi

d=ce85c8d1-578a-46f7-94c6-1b8970bd38ee-

5&algo_pvid=ce85c8d1-578a-46f7-94c6-1b8970bd38ee

MECHANIC PARTS: Parts can be found at K3 or Design factory

Plywood

4x M5 60mm bolts

4x M5 nuts

4x M5 washers

2x M3 10mm screws

Hot glue

Foam rubber

Rubber band

SHOOTING MECHANISM

The idea for the shooting mechanism of the automatic catapult was innovated from traditional torsion

catapults. Arm of catapult is attached on a spring mechanism which is loaded to launch projectiles from

bucket of arm. The arm is locked with a restraining mechanism to keep the spring mechanism loaded,

easy!

Page 6: MY FIRST ROBOT - AUTOMATIC CATAPULT

6

The automatic catapult uses a DC motor and a servo motor to operate locking, reloading and shooting. A

rubber band is used as spring mechanism for the catapult. In addition, an ultrasound distance sensor is

used as a trigger for the reloading and shooting mechanism. This means that when an object is brought

near the sensor catapult reload and shoots.

Reloading and shooting consists of 4 phases:

1. When an object is brought near ultrasound sensor DC motor starts to reel and stretch the

rubber band while servo motor is at lock-position.

2. servomotor undocks arm and spring mechanism is released. The arm hits beam of the catapult

throwing projectiles away.

Page 7: MY FIRST ROBOT - AUTOMATIC CATAPULT

7

3. DC motor unreels the rubber band and the arm goes back to resting position.

4. Servo locks the arm of the catapult. Catapult is back to its starting position.

ABOUT THE PARTS

ARDUINO NANO Basically, Arduino Nano is a more compact version of Arduino Uno. The main difference between Nano

and Uno is size and number of pins. An Arduino Uno is much bigger than an Arduino Nano and an Uno

has only 2 analog pins more than a Nano. Since analog pins are not used in this project, a smaller

Arduino Nano was better choice for the catapult.

Page 8: MY FIRST ROBOT - AUTOMATIC CATAPULT

8

SERVO MOTOR Servo Motor operates as a locking unit for the catapult. There are two main reasons why servo motor is

perfect for the task. Firstly, servo motors are rather easy to control with help of Servo library in Arduino

Ide. Only a position angle command must be sent to servo’s signal pin and the servo will rotate to that

position. Non-continuous servo motors can only turn 90° in either direction for a total of 180° which is

more than enough for a locking mechanism. Secondly, servo motors have an absolute position. This

means that servos move back to the same position every time when servos are switched on. For this

reason, resetting position of the locking mechanism is easier.

DC MOTOR AND L298N DRIVER As mentioned earlier, it is DC motor’s job to reload and release the catapult’s arm. This means that the

DC motor must rotate clockwise and anticlockwise. A H-bridge is needed to make both directions of

rotations possible. In this project a L298N motor controller is used as a H-bridge.

HC-SR-04 ULTRASONIC DISTANCE SENSOR At start the idea was to use ultrasonic distance sensor to spot a target within a defined range. However,

HC-SR-04 was unreliable with longer ranges. For this reason, ultrasonic distance sensor is used as a

trigger for reloading and shooting mechanism in a smaller range.

DESIGNING MECHANICAL PARTS

Catapult parts were modelled with SolidWorks 3D-modelling software. Parts can be saved as .STL files in

SolidWorks which can be compiled to machine language with Ultimaker Cura software. Since catapult

parts were designed for 3D printing, parts had to model which has minimal amount of sharp edges.

Filament is used in case where edges exceeds 45 degrees. This is problematic because filaments must be

manually removed from 3D print.

3D-MODELLING

The catapult consists of 3 parts:

1. First side of the catapult

2. Second side of the catapult

3. Arm of the catapult

Page 9: MY FIRST ROBOT - AUTOMATIC CATAPULT

9

2D model of the catapult. Made with SolidWorks

FIRST SIDE AND SECOND SIDE

At start, size of the catapult had to decided. The height and width of the catapult was determined to be

only 10.5cm and 7.46cm and thickness 1cm. The catapult parts were designed small because 3D printing

bigger parts would take too much time.

Afterwards holes were extruded to sides for axle of the arm. Diameter of axle of the arm was designed

to be slightly smaller than axle holes of the sides so that axle can rotate without rubbing against the

holes.

Then the beam of catapult was extruded on the second side of catapult to cut the amount of parts.

Diameter of hole for attaching beam was designed to be slightly bigger than the beam so the beam

could fit inside the hole.

Curvature of sides is made for minimizing 3D printing time and material. In addition, a bottom

attachment point is for supporting catapult from vertical force.

Page 10: MY FIRST ROBOT - AUTOMATIC CATAPULT

10

Both sides of the catapult. Unit of measure is centimetres.

ARM Diameter and length of the arm’s axle was concluded while designing the sides of the catapult.

The bucket of the arm was placed above the beam of the catapult, so the bucket nor projectiles won’t

hit the beam.

Tumbler of bucket was designed as a docking point for locking mechanism. Thirdly, the arc is made as

rubber band holder.

The arc had to be in right place on the arm, so it won’t hit the beam.

The arm of the catapult. Unit of measure is centimetres.

PLACE FOR IMPROVEMENTS The design of the catapult parts is far from perfect. Firstly, the reel of rubber band is not supported from

the other side of axle at all. This causes reel to bend the axle of DC motor and slowly breaking it. In

addition, the catapults power is limited because it breaks the axle of DC motor if the rubber band is

stretched too much. Secondly, the axle of the arm doesn’t have bearings. This causes the axle to rub

against the axle holes. In some occasions, the rubbing causes the arm to be stuck in vertical position

after launch which must be manually repaired before next launch. Thirdly, the axle holes of the arm

should’ve been closed. This would’ve removed need to glue stoppers oppose the axle holes to hold the

arm horizontally. Lastly, it was not optimal to include the beam in one of the side’s print because

3D-PRINTING 3D printing a 3D-model comes in X steps:

1. Save 3D model as .STL file

2. Open Ultimaker Cura software

Download: https://ultimaker.com/en/blog/52831-simplify-3d-printing-with-ultimaker-cura-40

Page 11: MY FIRST ROBOT - AUTOMATIC CATAPULT

11

3. Open .STL files.

4. Select parts you want to print and click “open”. Multiple files can be opened at same time if

parts are printed at same time.

Page 12: MY FIRST ROBOT - AUTOMATIC CATAPULT

12

5. Place and rotate the parts on the print platform. Note that 3D printers print 3D models from

bottom to top. For this reason, orientation of models matters.

6. Adjust the printing settings. The catapult was printed with default settings with 40% infill

Page 13: MY FIRST ROBOT - AUTOMATIC CATAPULT

13

7. Click “Slice” button at bottom right corner

8. Check the preview to see how filaments are made. Finish the process by clicking “Save to file”

button to export g.code file.

Page 14: MY FIRST ROBOT - AUTOMATIC CATAPULT

14

9. Move the g.code file to a 3D-printer with a USB-stick or via Wifi

10. Select the the 3D model file in 3D-printer user interface.

11. Start printing!

ELECTRIC WIRING

POWERSOURCE A power source is needed to power up Arduino Nano, servo motor and DC motor. Ultrasonic sensor is

powered by Arduino Nano’s 5V output pin. Arduino Nano can be powered with 6-20V unregulated input

voltage to Vin pin (pin 30). The servo motor’s operating voltage is 4.8-7.2V and the DC motors operates

with 6 volts. At first a 9V battery were chosen for powering all the components but the 9V battery

couldn’t power DC motor efficiently enough for reloading task. For this reason, 8 AA batteries were used

instead (12V in series). However, it is not advised to use a voltage supply without regulation to power up

components

WIRING DIAGRAM Wire according to the diagram.

Page 15: MY FIRST ROBOT - AUTOMATIC CATAPULT

15

SOLDERING THE COMPONENTS

Use a prototyping board to solder the components. Wires and pins are connected with solder bridges in

matrix prototyping board as seen in picture.

PROGRAMING Code can be found in attachments.

PLACE FOR IMPROVEMENTS The motors are timed with calibrated delay() commands. There are two things which must be calibrated:

Firstly, the DC motor’s reeling and unreeling time and secondly servos locking and unlocking time. This

means, that with every different rubber band code must be calibrated. The calibration takes a lot of time

which includes frustrating iteration alongside with a lot of test runs. The problem could’ve been solved

either with a proximity sensor or a position sensor. With help of these sensors it would’ve been easier to

define the position of the arm of the catapult. Microprocessor would’ve used the arm’s position

information to run the motors correctly without timers.

Page 16: MY FIRST ROBOT - AUTOMATIC CATAPULT

16

CASING Start by printing the stretches of catapult’s casing parts on a paper. Cut the paper into right parts and stretch parts on a piece of plywood. Cut the plywood with a bandsaw.

The dimensions for the casing parts.

There is few holes which must be made:

Cut a hole to a top piece for the servo motor. Use bandsaw to cut a right piece.

Page 17: MY FIRST ROBOT - AUTOMATIC CATAPULT

17

Drill a hole for DC motor’s wires. 5mm hole is more than enough for the wires.

2x Catapult’s attachment holes must be drilled and filed to correct sizes to fit the attachment points of

the catapult.

Page 18: MY FIRST ROBOT - AUTOMATIC CATAPULT

18

A hole for power switch must be made on one side of the casing.

2x holes for the ultrasonic sensor must be made on front face of casing. Diameter for the holes is 17mm.

Page 19: MY FIRST ROBOT - AUTOMATIC CATAPULT

19

The holes for ultrasonic sensor was drilled with a step drill head. Holes must be filed to correct sizes.

Test size of the holes with the ultrasonic sensor.

A step drill head.

Lastly, 4x holes with must be drilled for the M5 60mm bolts for attaching the bottom. diameter of holes

is 5.1mm. Hole is slightly bigger than the bolt to make fitting bolts through the holes easier. The holes

are not precisely measured. Drill the holes where you think they fit at the 4 corners.

Page 20: MY FIRST ROBOT - AUTOMATIC CATAPULT

20

When the pieces are ready, glue the finished pieces together with hot glue. Hot glue catapult parts on

the right attachment holes. Place the DC motor so that the reel of rubber band is in front of the catapult.

Glue the DC motor on the defined place and position.

Finish the casing by drilling holes for the bottom part for the M5 bolts.

Place the components inside the casing and attach the bottom part with washers and M5 nuts.

PLACE FOR IMPROVEMENTS I would’ve been easier to make grooves to bottom sides of faces for the bottom part. In that case,

bottom part can be slide to the grooves instead of the bolt and nut attachment.

Page 21: MY FIRST ROBOT - AUTOMATIC CATAPULT

21

FINISHING THE CATAPULT There are few things what must be done after every component and part is on place.

Firstly, stoppers must be glued on the sides of the arm’s axle holes to prevent the arm from slipping.

Secondly, another stopper can be glued on the beam of the catapult to soften the impact. The stopper

also defines the launching angle for the catapult.

Lastly, attach the servo motor with pair of screws to the casing using a drill set.

Page 22: MY FIRST ROBOT - AUTOMATIC CATAPULT

22

There you have it, a complete catapult. Now you just must tune the timers right to make the catapult

shoot automatically.