## Projectile Launcher

**Lesson Objectives:**

- Students will build a catapult using an EV3 and LEGO pieces.
- Students will understand how to apply projectile motion physics in real world programming using Python.

Materials:

Materials:

- EV3 Lego Robotics Kit w/Wifi Dongle and SD card
- Laptop & wifi connection
- Cup & Ball
- Any other LEGO pieces needed to build the catapult

**Let's Get Started!**

The link for the build instructions and other relevant information is provided above. Feel free to incorporate your own designs and ideas into the design.

This next part requires you to understand projectile motion. Encourage the advanced students to derive the formula for the required velocity of a projectile that is launched from a certain height and needs to land at a certain x distance. For those who haven't learned this yet, you can do so now! Here is a link to some helpful equations to get students started on the derivation.

You should end up with something that looks like this:

Now that we have an equation that tells us how fast the ball needs to go, we can begin writing our code!

The first step, as always, is to define the sensors and motors we will be using. We then want to collect the distance readings from the ultrasonic sensor and the vertical distance from the ultrasonic distance to the launcher, and then plug these numbers into the formula above.

An example code is provided below.

The first step, as always, is to define the sensors and motors we will be using. We then want to collect the distance readings from the ultrasonic sensor and the vertical distance from the ultrasonic distance to the launcher, and then plug these numbers into the formula above.

An example code is provided below.

As you can see, the formula we used looks similar to the derived one above but has been modified. This was the result of numerous tests and the changes made were to account for issues such as the friction in the motors and the inaccuracies in the ultrasonic sensor to name a few. This would be a good way to teach students to adapt to real world conditions.

Here's a video of the projectile launcher we made!