D.A.V.E. the TurretPosted: June 2, 2010 | Author: ilya | Filed under: Arduino | Tags: DAVE the turret, Gun turret, nerf turret | Leave a comment »
A couple of my friends and I took the mechatronics class at our university last year. For our final project we built an autonomous sentry turret capable of picking out people in a room and shooting them down. We called it the Digital Assignation & Violence Entity, or D.A.V.E. for short. We think this is the latest in proactive autonomous personal defense, if you happen to be on a shoe string budget that is.
Some of D.A.V.E.’s features:
- Finds people up to 20 feet away
- 150° scan range
- Holds 20 foam darts at a time
Since this was a class project we were expected to purchase our own supplies for anything we wanted to build. Which meant we where going to build this turret out of whatever supplies we had on hand. We made the frame out of scrapes of wood we had around. The toy gun we purchased at a 60% discount from a KB toys that was going out of business. The fabric covering the base used to be a pair of pants…
How it works
Working with limited funds meant we had to make a few sacrifices right from the start. As much as we would loved to have the turret controlled by a laptop running motion tracking software we didn’t want to spend that kind of money. Instead we opted to use a distance sensor mounted on a servo as our method for finding people in a room.
With the distance sensor, our theory of operation went like this. Make a distance measurement, if the distance is really far (20 feet or more), assume there is no one in front of the sensor. Now rotate the sensor a few degrees and take another reading. If the new distance measurement is less then 20 feet assume that we have found a person. Now we rotate the the turret to the same angle as the sensor and open fire.
This technique worked really well for us when we placed the turret in a wide open area. However, when we placed it anywhere indoors it didn’t work so well. Any wall or object closer then 20 feet away from the turret was automatically seen as a target.
We were able to improve our target acquisition technique by having the turret do an initial scan of the area in front of it before looking for targets. This involved rotating the distance sensor 180 degrees and and taking a distance measurement at each position. This gave us a map of what the room looked like in front of the turret. This allowed the turret to ignore objects that are closer then 20 feet that were already present when the turret was turned on.
For example, with this new method if we take a distance measurement of a wall that is 10 feet away, we would know it’s just a wall that was there before. But when, at that same angle, we get a distance measurement of less then 10 feet we can assume that now there is a person in front of that wall.
This is the target acquisition method we went with in the final version of the turret. It allowed us to plop the turret on a table in any room and have the turret always adapt to it’s surroundings.
Of course getting the turret to work reliably took a lot more effort then we initially thought. The distance sensor worked out, but it was not without its pitfalls. More on that a little later.
Here are some more pictures of the turret. Click on a picture to see a larger version of it.
One limitation of the turret’s targeting system is that the room has to be empty during the initial scan on power up. If there is a person standing in the room during the scan, the map will become unusable when that person walks away. Also if the turret is moved or nudged after it builds the map, that’s going to make the map of the room unusable as well.
Here we see the brains of the operation. An Arduino clone (a USB Boarduino) runs the whole show. We purchased it from adafruit.
Here is a closeup of the breadboard. On the breadboard is a buzzer, a Darlington transistor (which acts as a switch to control the dart propelling motor) and a miniature relay (used to control the trigger mover motor).
Wires from the breadboard lead to this breakout board which houses connectors for the rest of the turret’s electronics to connect to.
This is the trigger motor. As it rotates it moves the trigger forward and back. The toy gun used to be semi-automatic, where one pull of the trigger equaled one shot fired. Now this motor transforms the gun into a fully automatic weapon.
To make the gun shoot faster we removed all the internal springs attached to the trigger. We found that we didn’t need the springs to return the trigger to the starting position since we attached the trigger to the motor using a rigid arm.
We keep track of how many shot we fire thanks to a small magnet glued to the tip of the trigger and a reed switch mounted right under it. Every time the magnet passes over the reed switch we know the trigger made one complete backward-and-forward motion, or in other words, exactly one shot.
The trigger motor is attached to the gun using friendly plastic. When heated to around 70 degrees Celsius, friendly plastic becomes soft and malleable like play-dough. When it cools down to room temperature it becomes an astonishingly rigid and strong plastic. We picked it up from a local art supply store, but you can find plenty of it around the internet.
A servo tilts the gun up and down. It has a custom Lego-gear servo horn which we molded out of Alumilite. In the end we decided not to have the gun tilt at all. We were unable to balance the gun evenly on the axis of rotation and as a result the servo didn’t have enough power to tilt the gun more than 10 degrees up or down.
We removed the servo’s internal potentiometer and soldered an external one in its place. This way the gun’s tilt axis will act as the native shaft of the servo.
Here is a close up of the control panel. The knob sits on a push-button mechanical encoder. You spin the knob to scroll though different menu options and push it to make a selection. The red cancel button brings you back to the main screen. We purchased the LCD screen from sparkfun. Its white text on a black background is extra-fancy, just as advertised =D.
Here is a closeup of the ultrasonic sensor. It’s attached to a servo using a bracket made out of friendly plastic. We went with this distance sensor because it has the longest range out of all the distance sensors we looked at and it is not too expensive (only 30 bucks).
Using an ultrasonic distance sensor as a person tracker gave us a bit of trouble. The sensor measures distance by producing a small, high frequency sound and timing how long it takes for the sound’s echo to return back to the sensor. In theory, sound waves could get distorted or absorbed, which means that in certain environments the sensor’s performance can be less than optimal. In practice, when we would measure the distance to something soft like a set of curtains, or a couch, our distance measurements would fluctuate wildly. Sometimes two subsequent readings to the same curtains would be as much as two feet apart.
Initially when we first tested the turret we would get a lot of false positive targets. While looking for a person in the room, the turret would scan over the curtains and identify them as the target. To filter out the false positives we now take multiple distance reading every time a potential target is in sight of the sensor. If the distance is constantly fluctuating we know we are pointing at a soft object. If the distance remains low we know we are pointing at a person.
The rat’s nest. Breakout board on the top shelf, breadboard on the bottom. Here you can also see part of the 9.6v Ni-Cad battery pack that powers the whole turret.
The battery is rated at 1 amp hour, which is a fairly low amount. To save power the turret stands still until it detects movement using its passive infrared PIR motion sensor. This is the same sensor that is used in automatic light switches, the kind that turns the lights off when you leave the room. Once the PIR motion sensor reports that there is movement the turret wakes up and does an active scan with the servo mounted distance sensor to pinpoint the target.
The top part of the turret disconnects from its base. This makes it convenient to take apart and transport. When the top is connected to the base, it’s held in place securely using good ol’ gravity and a bit of friction.
Here is the connector that connects the base to the top part of the turret. Look how happy it is to be connected properly.
More components are placed around the perimeter of the base. Here you can see the mini breakout board that the base’s electronics connect to. The base holds the components that did not fit on the turret. The top part of the turret will not turn on by itself since the power switch is part of the base.
Here is the bottom of the servo that rotates the ultrasonic sensor. A PIR motion sensor is right in front of it. The motion sensor is attached to the base using a mount made out of friendly plastic.
This is our 5 volt voltage regulator. We got it from DealExtreme. It’s pretty cheap, and works well. To the right of it is the key switch. We bought it from Electroinc Gold Mine. They sell the key switch at a discount because it’s missing the mounting nut. This wasn’t a problem for us, as we were able to make our own nut out of friendly plastic. It’s that white glob around the switch. Friendly plastic FTW, seriously.
We draped fabric over the base to make it look nice. We used a staple gun to attach the fabric.
Closeup of the keyhole. This is the on/off switch for the turret.
Here is the bottom of the turret’s top part. The turret rotates on a lazy susan. Inside the wooden blocks is a standard servo that rotates the turret left and right. On the bottom, there is a channel cut away for the ribbon cable to run through.
The screw sticking out the back acts as the physical end stop to make sure the turret doesn’t rotate too far left or too far right. It’s better to have the screw hit a stop then to have the servo’s internal physical limit reached.
Here is the parts list that shows how much it cost to build this turret.
|Toy gun||$15||1||$15.00||Foam dart gun|
|Fairchild TIP 102||$0.70||2||$1.40||Darlington Transistor|
|Atmel ATmega328||$25||1||$25.00||Microcontroller w/ board|
|Sparkfun LCD-00813||$27||1||$27.00||LCD Screen|
|Hanse Electronics SE-10||$10||1||$10.00||Motion Sensor|
|Panasonic EVQ-WTEF2515B||$1||1||$1.00||Rotary Encoder|
|Maxbotix LV-EZ4||$28||1||$28.00||Ulstrasonic Distance Sensor|
|Hobbywing 5V/6V 3A UBEC||$10||1||$10.00||Voltage Regulator|
|9.6V NiCad Battery Pack||$10||1||$10.00||Battery pack|
|Lazy Susan||$10||1||$10.00||Swivel bearing|
|Radioshack 271-1721||$3||1||$3.00||10k Potentionmeter|
|Radioshack 273-074||$3.50||1||$3.50||Piezo Speaker|