# Automatic Ball-thrower for Dogs

440

1

1

We both have dogs, and as everyone knows, dogs could spend all day playing ball. That's why, we thought of a way to build an automatic ball-thrower

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Materials for the Circuit

First of all, to create the electronic part of the project we need the following components:

An arduino plate

Two servo motors

A resistance of 1 ohm

A photoresistor

A PCB board

Jumpers

## Step 2: Circuit Creation

To create the circuit, the components have to be connected, in this case the photoresistor and the two servomotors, suitably according to the ground cable and the cable that provides the bolting.

## Step 3: How the Product Works

The operation of the product is the following:

When the dog leaves the ball in the bucket, the photoresistor detects that there is less light in it, then servomotor 1 releases the "catapult" and launches the ball. When the ball has already been thrown, the servomotor 2 moves the "catapult" to the initial position, and finally, the servomotor1 holds it, in order to be able to perform the same movement in the future.

## Step 4: The Code

#include

int photoresistor = A0; Servo servo_9; Servo servo_8;

int photoresistorvalue; int pos1 = 0 ; int pos2 = 0;

void setup() {

servo_9.attach(9); servo_8.attach(8); Serial.begin(9600); }

void loop() {

int photoresistorvalue = analogRead (photoresistor); Serial.println(photoresistorvalue); if (photoresistorvalue < 150) { //for (pos1 = 0; pos1 <= 90; pos1 += 1) { servo_9.write(90); delay(2000);

//for (pos2 = 0; pos2 <= 90; pos2 += 1) { servo_8.write(100); delay(2000);

//for (pos1 = 90; pos1 <= 0; pos1 -= 1) { servo_9.write(0); delay(2000);

//for (pos2 = 90; pos2 <= 0; pos2 -= 1) { servo_8.write(0); delay(2000); } }

## Step 5: Materials for the Structure and Its Creation

For the creation of the structure we have used three A4 sheets of PET, and we cut this drawing with a laser cutting machine to obtain all the pieces of our module.

Two of the sheets are the base and support of the structure. The pieces with the number 1 are placed in the base to make a space between the first sheet and the second that will allow placing all the arduino and electric devices.

To create the catapult we need the pieces 2, 3 and 4. The pieces number two, they are stick in the base, and hold and allow the spin of the catapult. The longest one is the principal structure of the catapult, the pieces number 3 are stick to the end of the catapult, surrounding the circular space where the photoresistor will go, to hold the ball in that place.

The number 5 pieces are for the servos, so that they reach further space and allows to perform its function better.

Now that we have all the structure almost finished we have to put the rubber bands that will produce the necessary tension for the shot. (It’s important to be careful with the rubber bands because if the hooks are not strong enough, and the material is fragile, the structure could break. )

## Step 6: The Final Product

This is our final product.

Hope you like it!

## Recommendations

• ### Internet of Things Class

22,791 Enrolled