Introduction: Pi Catapult

Every year on the last Saturday in October, the Cantigny Historical Museum holds an amateur catapult contest. This is a wonderful contest that allows all comers to build and fire a catapult while competing in up to 3 different categories: distance, shot grouping, and accuracy. For more information on the contest please visit their website at https://www.fdmuseum.org/event/cantigny-catapult-c... For this years contest my team, the Pi Throwers, decided to use a Raspberry Pi to help with the release portion of our throw.

In our design, we have a set of sensors being monitored by a Raspberry Pi Zero Wireless. After arming the catapult and pulling the release, the Raspberry Pi controls when the baseball will be released. Using this simple process, we were able to come in second place with a distance of 186 feet.

This Instructable will discuss the design, development, and implementation of the Raspberry Pi controller and associated electronics. Although I do not cover the building of this years catapult, look for an instructable after the start of the new year about the design and building of next years catapult.

Just for fun, I have included a video of our 186 foot shot. I hope you enjoy.

I would also like to thank my team mates this year: Steven Bob and Gus Menoudakis.

Step 1: Overall Design

Picture of Overall Design

During last years contest we had a fair amount of trouble getting consistent releases for our catapult. Being a big geek, according to my wife, I decided to use my skills with electronics and the extremely low cost of a Raspberry Pi Zero ($5) to add computer control.

Here is the overall process of firing the catapult. First, turn on the Pi. Second, connect to the Pi's wireless hot spot with my iPhone and start up my Catapult App. Next, wind up the catapult and set the release. Load the catapult and set the trigger. Arm the catapult with the app. When you are ready to fire the catapult, pull the release. Now the Pi, using the embedded sensors, releases the trigger at just the right time and the ball is released.

Step 2: Raspberry Pi Zero Setup

Picture of Raspberry Pi Zero Setup

There are three main steps needed to setup the Raspberry Pi for use in the catapult. The first is to add connections to the power pads located on the back of the Pi. The second is to setup the Pi as a hot spot. The final step is to develop a program in Python that will interact with the control app, read the sensors, and fire the catapult when needed.

Power Connections

  1. Fire up your soldering iron.
  2. Grab a set of 16-18 gauge wire for the power connection. I always use red wire for the positive connection. I also use wire that has a connector on one end so that I can remove the pine from the catapult.
  3. Strip a small amount of wire and tin the ends.
  4. Pre-solder the pads where you will connect power. I don't know the pad numbers but I have indicated which pads to use in the picture.
  5. Solder the wires to the Pi. I find this step is easy if you secure the Pi and hold one wire over the pad to be soldered. I then apply the soldering iron to the wire while pressing down on the pad. Once you feel the solder on the wire melt, release pressure.
  6. Repeat with the second wire.
  7. Check for any shorts. A short exists if the wires or solder from both pads touch each other. If this happens, heat up the solder, remove the wires and try again.

Hot Spot

While I could go through all of the steps to setup a hot spot there are others that have done a better job. I have listed a couple of sites with step by step instructions.

RaspberryPi.org

Frillip.com

Python Program

A Python program is used to control the configuration and firing of the catapult. The program, located below, is run on the Pi and allows you to configure and control the catapult. This program is added to the local user directory and run every time the Pi is powered up by adding an entry in /etc/rc.local. This program sets up a network server that I connect to using an app developed for my iPhone. You can also use telnet and connect to port 9999 on the Pi. You can then use text commands to the same affect as my app.

Node-Red Program

As an addition to the Python program, I have created a Node-Red program with similar functionality but it uses a web interface. Since Rasbian, the recommended OS for the Raspberry Pi, includes Node-Red as part of the installation, I thought this might be a good addition. Copy the contents of the catapult.json file into your clipboard, open Node-Red on the Pi that you intend to use for your catapult, select Import->Clipboard from the menu on the right, and paste the code there. Now all you need to do is deploy the code and connect to the IP address of your Pi for the user interface. In my case it is http://192.168.1.103/:1880/ui/#/0, your IP address will very.

Step 3: Wiring Up the Parts

Picture of Wiring Up the Parts

Although it looks like a mess, the actual wiring of the system is pretty straight forward. The poorly done PowerPoint schematic shows all of the connections. The parts needed are listed below.

Parts list

  1. Raspberry Pi Zero Wireless - $5
  2. 16 GB micro SD card - $8-10
  3. Uxcell DC12V 25N Force 2-Wires Pull Push Solenoid, Electromagnet, 10 mm Actuator - $18
  4. eBoot 6 Pack LM2596 DC to DC Buck Converter 3.0-40V to 1.5-35V Power Supply Step Down Module - $2
  5. Floureon 2 Packs 3S 11.1V 1500mAh 35C RC Lipo Battery with XT60 Plug for RC Car, Skylark m4-fpv250, Mini Shredder 200, Qav250, Vortex, Drone and FPV (2.91 x 1.46 x 1.08 Inch) - $27
  6. Toggle switch - $2-10 per switch, I had an old one that I used
  7. Finware 6 Pairs XT60 XT-60 Male Female Bullet Connectors Power Plugs with Heat Shrink for RC Lipo Battery - $7.50
  8. Cylewet 15Pcs Reed Switch with Gilded Lead Normally Open (N/O) Magnetic Induction Switch Electromagnetic for Arduino (Pack of 15) CYT1065 - $10
  9. Tolako 5v Relay Module for Arduino ARM PIC AVR MCU 5V Indicator Light LED 1 Channel Relay Module Works with Official Arduino Boards - $6. You could get a relay that operates at 3.3v and bypass the NPN transistor, I would have if I had ordered the correct one to start with.
  10. 100 x 2N2222 NPN TO-92 Plastic-Encapsulate Power Transistors 75V 600mA - $2
  11. Wire and misc parts - this includes some 20mm magnets.

Connections

As you can see from my horrible electronics diagram, the hookups for the electronics is rather simple. You might wonder why there is a NPN transistor thrown in there, it has to do with the relay operating at 5 volts and the Pi running at 3.3v. Yes, there are 5V pins on the Pi, but they are not for connecting to the GPIO pins. Ask me how I know...

How you connect the components together is your choice. I used old RC servo connectors as they have the correct spacing to use for the GPIO pins on the Raspberry Pi and I have a large collection of them. You could direct solder to the holes/pins on the Pi if you want. You just need to make sure that the connections are secure and unlikely to separate during the violent process that is a catapult launch.

Step 4: Printed Parts

There are three items that I had to print for this project and they are listed below.

  1. Electronics case
  2. Solenoid case
  3. Baseball retention arm

I have included the STL files for each of the parts that I had to print. When printing the arm, I recommend that you use a fill rate of 25-50%. This is to make sure that the arm does not break due to the stresses it is subjected to during the firing.

Step 5: Magnets and Reed Switches

Picture of Magnets and Reed Switches

One of the more important design aspects is determining how to tell where the arm is during the firing of the catapult. There are a couple of different options, Hall Effect sensors, reed switches, and accelerometers are just a few. Originally I had planned to use the Hall Effect sensors but found that they did not work consistently so I switched to reed switches. If you choose to use reed switches, one word of caution, reed switches should be oriented so that they are perpendicular to the centrifugal force. Otherwise it is possible that the reed switches will be forced open/closed by the spinning motion of the arm.

As you can see from the diagram, I used four magnets and two reed switches. Each of the magnets are set 90 degrees apart. This, in combination with the 135 degree off set for the reed switches, allows 8 sensor readings per revolution. With the sensor offset, both of the sensors will not cross a magnet at the same time which allows us the same precision as using a single reed switch and 8 magnets. In either case, every 45 degrees that the arm turns the Pi will get a single pulse.

Each of the magnets are embedded in the base support for the throwing arm. I used a 7/8 inch forstner bit and drilled in about 6 mm to match the magnets height that I had on hand. I then added a little bit of hot glue in the hole and pressed the magnets in place. Each of the magnets should be flush with the surface of the base.

For the reed switches, I first connected the switches to wires that I would later connect to the Pi's GPIO pins. I then drilled a slot for the reed switch on the underside of the throwing arm. This slot should sized to fully enclose your reed switch. I then drilled a hole through the arm at on end of the slot. This hole is how the wire and reed switch are threaded through arm so it should be big enough to handle the both. I then thread the wire connection to the reed switch and glue the reed switch into the slot that was created for it. Since I used wood for my throwing arm, I filled the spaces in the reed switch slot with wood filler. This was a way to make sure that the reed switch is secured and unable to rub on the base.

Step 6: Testing

Testing is a fun process. It is where you go someplace where you will not hurt people or damage property and see if your stuff works. I wish I had done that. On our first test throw the arm release too late and I had a baseball sail over my van, about a 100 feet away. After adjusting the release timing, we tried again. This time the baseball hit my car tire and bounced back to us. I moved my car.

After several more attempts we moved where the rope was attached to the arm so that the arm stopped 90 degrees CCW from straight up. This allowed us to fire shots pretty much straight forward and at a 45 degree angle. Much better. Once we had the release dialed in, we changed the weight and modified the ball sling a couple of times to get our best results.

Step 7: Final Thoughts

I would like to thank all of the people that helped with this years catapult. Steven Bob and Gus Menoudakis, my teammates. My wife, who every year asks why I have to build a different design for a catapult. And Cantigny for having the contest in the first place. It is a blast and really should have a larger crowd.

Thanks for your time and let me know if you have any questions.

Comments

Jake_Makes (author)2017-11-15

That looks awesome! How far does it shoot with what weight? (if I may ask?)

jbutterfield (author)Jake_Makes2017-11-15

158 feet was our 2nd place distance. We hit 300 feet in practice but had sling issues during the competition.

Jake_Makes (author)jbutterfield2017-11-16

That's pretty good! How heavy was the counter weight?

jbutterfield (author)Jake_Makes2017-11-19

60 pounds, although the farthest shots were with 50 pounds. Too much is not always a good thing.

inconceivable1 (author)2017-11-15

ya looks awesome!

MillennialDIYer (author)2017-11-15

All I can do is think about the things I'd like to launch with it...

Swansong (author)2017-11-15

That looks like fun! Awesome job :)

About This Instructable

1,629views

7favorites

License:

Bio: I am a constant tinkerer that has the ability to let the magic blue smoke out of most electronics.
More by jbutterfield:Brick OvenPi Catapult
Add instructable to: