In England, there is a common saying that rings especially true for me: “An Englishman’s home is his castle.” Unlike our cousins, home defence is somewhat limited in the UK. Guns are illegal, and even sharp pointy objects are questionable. Strangely enough, it turns out that catapults are not illegal!
In an effort to better protect my home from invaders, in this Gentleman Maker episode, we will build a smart home defence system that uses a trebuchet to take on unwanted visitors!
- 2 x Photon boards
- 1 x Ultrasonic module
- 2 x PWM servos
- 2 x 9V batteries
- 2 x 7805 regulators
- 2 x 100nF capacitors
- 2 x 100uF capacitors
- Wood, glue, staples, and a workshop for the trebuchet
You can check out the full Scheme-It schematic for this trebuchet project here.
The Sensor Array
Detecting the presence of intruders can be done using different types of sensors. One method involves the use of ultrasonic range modules that can determine the distance of an object, while another method uses IR detectors to look for changes in IR (such as body heat and reflected sunlight).
For this project, we will take advantage of ultrasonic modules for detecting intruders, but we will add some interest to our detectors! The detectors, based on the Photon, are equipped with 2.4GHz Wi-Fi transceivers and servos—so they can act as scanning rangefinders, which report back their current angle and the current distance measurement to an MQTT server.
Central control is a standard PC that runs a Python program, which monitors the incoming sensor data. The screen has a radar output window for each sensor (up to two for this project), and if any readings have gone beyond the trigger range, the software will send the firing command to the trebuchet via MQTT.
The code for this trebuchet project is fairly straightforward, and some of the pieces for it can be found on Particle's web IDE. You will need to make an account to access these bits, but as I mentioned in the video, there is very nearly nothing to dislike about the Particle Photon.
You can find the trebuchet's trigger code here and you can find the ultrasonic sensor code here. The remaining code for the project is coded in Python and you can download that at the end of this article.
Building the Trebuchet
The trebuchet is a medieval gravity catapult that takes advantage of a counterweight to launch a projectile. Unlike normal catapults, the trebuchet uses a sling instead of a fixed container to hold the ammunition, which improves the range of the trebuchet.
Unlike medieval trebuchets, this one is electronically fired using a simple servo to hold the firing pin. When a firing message is sent from central control, the solenoid is activated, which turns the servo and therefore releases the firing mechanism.
Trebuchets are not the easiest things to aim, so it’s important to place the trebuchet the correct distance from the ultrasonic sensors. Additionally, it would not be unwise to have multiple trebuchets pointed in different directions.
With that, you’re ready to properly defend your home. Just watch out for friendly neighborhood dogs or innocent garden fixtures!
Ready for more Gentleman Maker? Check out the rest of the series here on All About Circuits:
- Protect Your Summer Harvest with the Gentleman Maker’s Raspberry Pi and Arduino Dog Corrector
- Feeling Flashy? Tone It Down with the Gentleman Maker’s Raspberry Pi Colorboringizer
- Take a Gander at Wildlife with Your Raspberry Pi: The Gentleman Maker’s Life-Cam!
- Save for Your Own Royal Wedding (of Sorts) with the Gentleman Maker’s Savings Incentivizer
- The Gentleman Maker’s Sun Informer Lets Homebodies Safely Enjoy Intermittent Sunshine
- The Gentleman Maker’s Auto-Apologizer: A Clever, Polite Device for the Everyday Brit
- How to Make an IoT Teapot so You Can Put the Kettle on from Your Smartphone