Introduction: Aegis Security Systems

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)

I called this project Aegis, similar to the combat communication weapon system used in the military in that it uses an ultrasonic sensor to detect movement and can also be activated by remote control to launch the catapult. I built this project as a prank to use against my friends and it works great.

Does require quite a bit of soldering as a heads up.

Supplies

Arduino Uno

Arduino Ultrasonic Sensor

9V battery and connector

MG995 Servo Motor

Arduino IR Receiver/Remote Control

ON/OFF Switch

Rubber Band

3D printer

Step 1: Body and Movable Parts

Most of this can printed in one shot, outside the moving parts. The Body takes about 10 hours and a few hours for the rest: cover, catapult arm, etc.… (See images 1-5 above). Getting the electronics to fit snuggly in the body was the beast of this project and the wiring was a little time consuming. The design was done on a free CAD program called Tinker and I ended up buying the Ender Pro 3 Printer for about $250 which has been working great. I wish I had found a tiny breadboard for the ground and 5V rail that can use the Arduino wires, but I had to strip a bunch of these frail wires and solder them to together and wrap it in electric tape. You can see this below in the block diagram to the right of the Arduino board labeled VCC and GND.

Step 2: Block Diagram

I color coated the wires red for VCC and black for GND in the block diagram. The image of the wiring in the body looks a little daunting but there isn't that many connections. I will go through this step by step. In the bottom left of the diagram you'll see that you have to solder the ON/OFF switch directly to the DC Power connector. We'll start here since this was a bit of pain.
Helpful Hint: Be sure to have plenty resin flux when you're soldering to the connectors and wires, makes a big difference.

Step 3: ON/OFF Switch

3. ON/OFF switch - 2 wires stripped and tined

First strip and tin both sides of the wires. Solder to the ON/OFF switch first. From the image below you'll see how it fits in through a tiny slot at the base of the body into the area where the Arduino sits. Next cut the black connector off the 9V battery connecter as shown in the image above. Now solder the red wire to one of the wires on the ON/OFF switch and then solder the black wire of the 9V battery to the ground of the DC power connector on the Arduino. The other wire connected to the ON/OFF switch will be soldered directly to the positive side of the DC power connector.

Step 4: Utrasonic Sensor

4. Ultrasonic Sensor - 4 wires stripped and soldered to the connector on the HC-SR04

Here you can either remove the connector and solder to the breadboard or solder directly to the connector, both are a little tough and I didn't have a vise or helpful hand to facilitate this so it was even harder. After you've soldered the wires to the Ultrasonic Sensor, from the block diagram you'll see that I used 3 wires to insert directly into the Arduino digital i/o's and stripped and tined the positive wire to attach to the positive wire on the servo motor and IR Receiver, creating a rail for 5V.

Step 5: IR Receiver

5. IR Receiver - connector removed and 3 wires stripped and soldered to GRY through-holes.

In this step I cut the connector directly off the breadboard cause it would not have fit correctly into the cover. There are no screws holding breadboard in the cover. I did a trial run of a few printed parts just a little bigger than the IR board itself and then when I got it right I put those dimensions into the cover itself so that it would fit securely in there without any screws. So similar to the ultrasonic sensor, solder directly to the breadboard, and after this strip and tin the Ground and VCC to eventually be soldered to the 5V rail and Ground rail. Refer to block diagram for visual.

Step 6: Servo Motor

6. Servo Motor - Insert 3 wires into female end and strip and tin two for VCC and GND

The MG955 motor I had to purchase outside the Arduino kit for a little more torque, especially if you want to use smaller rubber bands that can get you more tension and distance. Here we install the motor and also use Movable Part Number 5 from the first step to slide in front of the motor and keep it in place. There are little grooves for this piece to fit in place. Once you insert 3 Arduino wires into the female end of the motor connector, strip and tin the Ground and VCC. This will eventually be soldered to each rail. Refer to Block Diagram.

Step 7: Arduino Uno

7. Arduino Uno - Now we are ready to connect everything to the Arduino and solder the rails.

This part takes some finesse. By now the battery and ON/OFF switch is installed and soldered together. The Ultrasonic Sensor has been soldered and installed into position. The IR Receiver is installed and wires soldered to breadboard, and the Servo motor is installed and wires connected. Here we finally solder all the 5V and Ground rails together, wrap those in electric tape and connect the wires to the appropriate digital i/o's. Once everything is in place, carefully place the cover on top and screw it down, though you may want to turn on the switch before you screw it down just to be sure it works. I used the screws form the SG90 Servo Motor which I have a few of and they worked great. And we are in business!, now on to the code, a far simpler endeavor.

Step 8: Code

The code for this project requires the Servo library and IRremote library, which you can download from Github.
The code is not very long and should be quite easy to understand since most of it is commented. Here in the beginning we are simply defining the pins we want to use on the Arduino, creating the servo object and defining a couple variables for the the distance of the sensor.
Under void setup, we’re identifying the input and outputs of the Servo motor, ultrasonic sensor and IR receiver. We're also using the serial monitor in this code to track the distance of the ultrasonic sensor and the functionality of the remote, so that’s why you’ll see the Serial.println command in the code.
In the void loop section we are setting up the trigger/echo timing of the ultrasonic sensor and doing some calculations for the Serial Monitor to print. This will give the precise distance of an object in front of it. Here we'll set the sensor to activate the catapult within 60 inches. You can obviously change this distance to whatever you like, though the max distance is about 400cm(13 feet). The final piece of the code is for the IR Receiver. This will require you to run a separate program so you can get the hexadecimal code that is transmitted for each button on the remote control. In my code I used number 2 on the remote to activate the catapult.

Step 9: