Beruflich Dokumente
Kultur Dokumente
Table of Contents
Step 5: Rewiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Author:BrittLiv Find out more about me
I'm a Chemical and Biological Engineering student especially interested in Computational Fluid Dynamics. To balance all the theoretical work I like to make
stuff in my free time.
If you've been browsing through my other instructables, you might have noticed that I am obsessed with Nerf guns. So far, Ive managed to infect just about everyone
around me with the Nerf virus. It is really fun to see how these plastic toys turn grown men into small boys!
My main aim was for it to look awesome; which was difficult to achieve without removing the front part of the gun. But, I managed to accomplish this without removing the
barrel, and Im really happy with how it turned out!
A big thanks goes to Bob who authored an awesome write up on how to build a sentry gun .
Please do not attempt this mod unless you are convinced that you will be able to do it; otherwise you might destroy your gun.
Please follow this link: (embedding a video doesn't seem to be working at the moment)
http://www.youtube.com/watch?v=C70R7oo4jMc
Image Notes
1. not wearing an instructables shirt, being detected and shot
2. wearing an instructables shirt, being safe.
3. A bit hard to see instructables robot.
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 1: Stuff you need
Stuff you need
Electronics
Other
Nerf Vulcan
6 Volt battery pack
5 kg replacement spring for the Vulcan
Optional: Paint and plastic primer for the gun
3 mm lead pearls or something similar as a counter weight
6V 3700mAh battery pack
9.6V 2000mAh battery pack
Tools
Things like a scroll saw and a powerful drill are useful, but not a 100% necessary. I finished the whole tilt axis with just a fret saw and a cordless drill which was far too
weak to drill the 28mm hole (I used the fret saw instead).
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 2: Take the Vulcan apart
Taking the Vulcan apart is certainly not an easy task, so be careful and try not to snap any plastic pieces.
Start by taking the handle off. You won't have to loosen any screws. Just hold the gun down and pull it to the side, as shown in the first picture.
Remove the screws from the belt retainer and take out the plastic inserts. Afterwards you can just pull it off.
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 3: Take the Vulcan apart
Use a claw hammer, to pry off the bolt head.
Remove the battery tray cover, as well as the battery tray.
Depending on the age of your Vulcan, there might be a sticker.
If there is a sticker, you will then have to cut it in half.
Now remove all the screws from the main part of the blaster.
You dont need to take the screws off which hold the barrel together unless you plan on painting the blaster.
Carefully pry the pieces apart.
Be careful that you dont damage the wires.
Image Notes
1. take all these screws out
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 4: Optional: Replace the spring
I recommend changing the spring at this point, but that decision is up to you. When you use battery packs with higher voltage, it will increase the firing rate, but not the
strength of the shot.
In my opinion, a 5 kg spring works best (the original one is a two kilo spring). I tried a 7 kilo spring in one, and although it was strong, it resulted in a lot of mis-firing.
In the last picture you can see how the firing speed improved. To give you an idea of the guns speed after the replacement - it is about as fast as an unmodified Nerf
Maverick.
I tried to remove the air restrictor, too but noticed no difference in the firing speed, so I just left it where it was originally
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 5: Rewiring
A big advantage of the Nerf Vulcan is that no extra servo is needed to fire it. The Arduino can directly be wired to the motor of the gun.
First solder one wire to the positive side of the motor - as shown in the first picture.
Then solder a second wire to the switch - as shown in the second picture.
Either unscrew the mechanism, or use pliers to place the wire underneath it, as shown in the third picture. Now all that is left to do is to secure the wires with hot glue, as
shown in the fourth picture of this step. I simply connected the two wires; But you can also add a switch, to also enable firing by pulling the trigger.
If you are planning on painting the gun, be sure to avoid painting the plunger head and the internal parts. The paint will only disturb the function and be scraped off after a
time.
I've uploaded a picture to help you reassemble the Nerf gun. Be cautious so you dont snap or break any pieces.
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 6: Turn axis
I originally wanted to use the base plate of the chair, but noticed that it was quite shabby. So after cutting off the cushion I replaced it with a 20x20x1.5 cm plywood plate,
as shown in the pictures.
Cut a slot into the other 20x20x1.5 cm plywood plate, to fit the servo. Make sure that the axis is perfectly centered!
Now you will have to cut a hole into each of the 0.5 cm plywood or MDF plates, in order to fit the axial ball bearing (take a look at step 1 for the measurements). Glue one
to plate holding the servo and the other one to the third plate. Drill a hole into the center of the third plat, which has to be big enough to allow you to screw the servo arm
to the servo.
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 7: Turn axis
Glue the sides to the bottom plate of the box, as shown in the first picture. The piece in the front was supposed to hold the webcam. But after using the gun for the first
time, I noticed that even though the base is really sturdy it moves a bit when the gun stops, which results in false detections. So I just decided to place the camera on the
floor in front of the gun until I'll be able to find the time to build a tripod for the camera.
Before you paint the pieces, you should fill the holes and prime them. Next. , make sure that everything fits and screw the servo in place. In my experience the best way
to position the servo arm is to screw it to the servo and to use two component glue to attach it to the top piece. Before you do so, make sure that the angle the servo can
turn in both directions is the same. After the glue is set, unscrew the arm from the servo and take the plate off. Now you can screw the servo arm to the plate, to give the
connection better strength.
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 8: Tilt axis
Before attaching the pole as shown in this step, I wanted build a platform. The platform should make attaching and removing the Vulcan as easy as possible; but I noticed
that it didn't work. The main reason for this was that even though the center of gravity of the back and the front was pretty well balanced, the top and bottom really wasn't.
So the servo didnt have enough power to move the gun.
I decided that the best way to attach the wooden pole would be through an existing screw hole. Since the gun should be attached in its center of gravity, I had to use
counterweights later on (I didn't want to take the front of the gun off, since I thought it looked good). Otherwise the center of gravity interferes with the ammo belt.
Drill a hole to fit the wooden pole through the screw hole marked in the first picture. Cut a disc with a 6 cm diameter from the 1.5 cm plywood and drill a 12 mm hole into
its center. Paint the disc and place the pole through the hole. Secure it with a screw, as shown in the pictures. I suggest that you paint the pole after you've placed it in the
bearings, otherwise it might not fit. Place the pole through the Nerf gun and glue the wooden disc to the plastic. Use two more screws to secure it.
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 9: Tilt axis
Cut a wooden disc to fit the arm of the Hitec HS805BB servo. Secure it with the provided screws and screw it to the servo. Cut all the pieces from the 9 mm plywood that
are shown in the second step. Be sure to round the top edges of one side, as shown in the last picture. If you dont, your ammo belt might get stuck. Place the two ball
bearings into the two identical side pieces and paint them after filling and priming. Cut a hole into the third piece to fit the servo. Its very important that the axis is
perfectly centered. You should really spend some time on this step, since it will greatly affect how well your gun will work.
Place the wooden pole holding the Nerf Vulcan between the two pieces with the bearings. Now use the 128 mm rectangular block of wood as a spacer (the lower end of
the plates has to face the back of the gun). At first I tried to secure the spacer with glue, but the connection was just not strong enough. So I used M4 x 40mm wood
screws, to secure it in place. It also makes it easier to take the gun apart later should it be necessary.
Glue the 45 mm rectangular block of wood to the bottom of one of the panels and cut the wooden pole to the correct length in order for it to perfectly fit into the wooden
disc which you've build before. Attach the servo and screw the wooden disc to the pole, as well as the servo plate to the spacer.
Then use the brackets, screws and wing nuts to attach the base, as shown in the pictures. Using the wing nuts allows an easy disassembly of the gun and therefore
assures easy transportation.
Use the lead pearls or something similar as a counter weight, until the gun is perfectly in balance. Hot glue works great to hold the pearls in place.
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Step 10: Electronics
Connecting the two servos and the electronic trigger to the Arduino is relatively simple. The wiring is shown in the first picture. The 1k resistor protects the Ardunio from
electric shorts and the diode prevents stray electricity and sparks. You can of course leave your circuit on the breadboard, but I decided to use a perfboard.
The voltage of the battery pack connected to your gun motor controls the firing rate. If you want your gun to shoot faster feel free to use a second battery pack, or one
with a higher voltage rate.
Thanks a lot lo Bob Rudolph for writing the awesome code for the sentry gun (you can also download it here ). Just upload the files to your Arduino. Make sure to adjust
the servo positions to your gun!
/*
-------------------- Project Sentry Gun --------------------
============================================================
----- An Open-Source Project, initiated by Bob Rudolph -----
*/
adjust the values below to the values that work for your gun:
*/
// <=========================================================================>
// Begin custom values - change these servo positions to work with your turret
// <=========================================================================>
// servo positions:
#define panServo_scanningMin 60 // how far side to side you want the
#define panServo_scanningMax 120 // gun to turn while 'scanning'
#define scanningSpeed 3000 // total time for 1 sweep (in milliseconds)
// <=========================================================================>
// End custom values
// <=========================================================================>
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
int panServoPin; // Arduino pin for pan servo
int tiltServoPin; // Arduino pin for tilt servo
//int triggerServoPin; // Arduino pin for trigger servo, or output to trigger MOSFET
int firingIndicatorLEDPin; // Arduino pin for firing indicator LED
int USBIndicatorLEDPin; // Arduino pin for USB indicator LED
int modeIndicatorLEDPin; // Arduino pin for Mode indicator LED
int reloadSwitchPin; // Arduino pin for input from RELOAD switch
int disablePlatePin; // Arduino pin for input from disable plate
int electricTriggerPin; // Arduino pin for output to trigger MOSFET
boolean invertInputs; // TRUE turns on internal pull-ups, use if closed switch connects arduino pin to ground
// pin assignments for each hardware setup are set in the function assignPins() at bottom of code
// Integers
int camWidth;
int camHeight;
int nbDot;
int antSens;
int minBlobArea;
int tolerance;
int effect;
int trackColorTolerance;
int trackColorRed;
int trackColorGreen;
int trackColorBlue;
int safeColorMinSize;
int safeColorTolerance;
int safeColorRed;
int safeColorGreen;
int safeColorBlue;
int idleTime;
// Floats
double propX;
double propY;
double xRatio;
double yRatio;
double xMin;
double xMax;
double yMin;
double yMax;
}
configuration;
configuration configuration1;
#include <Servo.h>
int fireTimer = 0;
int fireSelector = 1; // 1 - semi-automatic firing, auto/semi-auto gun
int idleCounter = 0;
int watchdog = 0;
int watchdogTimeout = 2000;
boolean idle = true;
boolean scanning = false;
boolean scanDirection = true;
boolean disabled = false;
unsigned long int disableEndTime;
int scanXPosition = panServo_scanningMin;
void setup(){
assignPins();
void loop() {
if (Serial.available() >= 10) { // check to see if a new set of commands is available
watchdog = 0;
indicator = Serial.read(); // read first byte in buffer
if(indicator == 'a') { // check for 'a' (indicates start of message)
idle = false;
idleCounter = 0;
digitalWrite(USBIndicatorLEDPin, HIGH); // light up the USB indicator LED
x100byte = Serial.read(); // read the message, byte by byte
x010byte = Serial.read(); //
x001byte = Serial.read(); //
y100byte = Serial.read(); //
y010byte = Serial.read(); //
y001byte = Serial.read(); //
fireByte = Serial.read(); //
fireSelectorByte = Serial.read(); //
fireSelector = int(fireSelectorByte) - 48; // convert byte to integer
scanningByte = Serial.read();
if((int(scanningByte) - 48) == 1) {
scanning = true;
}
else{
scanning = false;
}
}
else if(indicator == 'z'){ // check for command to go idle (sent by computer when program is ended)
idle = true;
}
else if(indicator == 'b'){ // start backup
backup();
}
else if(indicator == 'r'){ // start restore
restore();
}
}
else{
watchdog++;
if(watchdog > watchdogTimeout) {
idle = true;
}
}
if(idle) { // when Arduino is not getting commands from computer...
Serial.write('T'); // tell the computer that Arduino is here
idleCounter++; // periodically blink the USB indicator LED
if(idleCounter > 1000) { //
sequenceLEDs(1, 100);
delay(10);
// digitalWrite(USBIndicatorLEDPin, HIGH); //
// delay(250); //
// digitalWrite(USBIndicatorLEDPin, LOW); //
idleCounter = 0; //
} //
else{ //
digitalWrite(USBIndicatorLEDPin, LOW); //
} //
xPosition = panServo_HomePosition; // keep x axis servo in its home position
yPosition = tiltServo_HomePosition; // keep y axis servo in its home position
fire = 0; // don't fire
}
else{ // when Arduino is getting commands from the computer...
xPosition = (100*(int(x100byte)-48)) + (10*(int(x010byte)-48)) + (int(x001byte)-48); // decode those message bytes into two 3-digit numbers
yPosition = (100*(int(y100byte)-48)) + (10*(int(y010byte)-48)) + (int(y001byte)-48); //
fire = int(fireByte) - 48; // convert byte to integer
}
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
if(scanning) {
digitalWrite(modeIndicatorLEDPin, HIGH);
if(scanDirection) {
scanXPosition += 1;
if(scanXPosition > panServo_scanningMax) {
scanDirection = false;
scanXPosition = panServo_scanningMax;
}
}
else{
scanXPosition -= 1;
if(scanXPosition < panServo_scanningMin) {
scanDirection = true;
scanXPosition = panServo_scanningMin;
}
}
xPosition = scanXPosition;
yPosition = tiltServo_HomePosition;
fire = 0;
delay(scanningSpeed/abs(panServo_scanningMax-panServo_scanningMin));
}
else{
digitalWrite(modeIndicatorLEDPin, LOW);
}
if((digitalRead(disablePlatePin) == HIGH && !invertInputs) || (digitalRead(disablePlatePin) == LOW && invertInputs)) { // check the disable plate to see
disabled = true;
disableEndTime = millis() + disablePlateDelay;
}
if(millis() > disableEndTime) {
disabled = false;
}
if((digitalRead(reloadSwitchPin) == HIGH && !invertInputs) || (digitalRead(reloadSwitchPin) == LOW && invertInputs)) { // check the reload switch to see
shotCounter = 0;
xPosition = panServo_ReloadPosition; // if it is flipped, override computer commands,
yPosition = tiltServo_ReloadPosition; // and send the servos to their reload positions
fire = 0; // don't fire while reloading
digitalWrite(modeIndicatorLEDPin, HIGH);
delay(100);
digitalWrite(modeIndicatorLEDPin, LOW);
delay(100);
}
if(disabled) {
xPosition = panServo_ReloadPosition; // if it is flipped, override computer commands,
yPosition = tiltServo_ReloadPosition; // and send the servos to their reload positions
fire = 0; // don't fire while reloading
digitalWrite(modeIndicatorLEDPin, HIGH);
delay(50);
digitalWrite(modeIndicatorLEDPin, LOW);
delay(50);
}
void Fire(int selector) { // function to fire the gun, based on what firing mode is selected
if(selector == 1) {
fireTimer++;
if(fireTimer >=0 & fireTimer <= triggerTravelMillis) {
digitalWrite(electricTriggerPin, HIGH);
// trigger.write(triggerServo_SqueezedPosition);
digitalWrite(firingIndicatorLEDPin, HIGH);
}
if(fireTimer > triggerTravelMillis & fireTimer < 1.5*triggerTravelMillis) {
digitalWrite(electricTriggerPin, LOW);
// trigger.write(triggerServo_HomePosition);
digitalWrite(firingIndicatorLEDPin, LOW);
}
if(fireTimer >= 1.5*triggerTravelMillis) {
fireTimer = 0;
if(useAmmoCounter) {
shotCounter++; // increment the shot counter
}
}
}
if(selector == 3) {
digitalWrite(electricTriggerPin, HIGH);
// trigger.write(triggerServo_SqueezedPosition);
digitalWrite(firingIndicatorLEDPin, HIGH);
}
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
}
void ceaseFire(int selector) { // function to stop firing the gun, based on what firing mode is selected
if(selector == 1) {
fireTimer = 0;
digitalWrite(electricTriggerPin, LOW);
// trigger.write(triggerServo_HomePosition);
digitalWrite(firingIndicatorLEDPin, LOW);
}
if(selector == 3) { // for my gun, both firing modes cease firing by simply shutting off.
digitalWrite(electricTriggerPin, LOW);
// trigger.write(triggerServo_HomePosition);
digitalWrite(firingIndicatorLEDPin, LOW);
}
}
digitalWrite(USBIndicatorLEDPin, LOW);
digitalWrite(modeIndicatorLEDPin, LOW);
startDelay = millis();
while(millis()-startDelay < delayTime) {
digitalWrite(firingIndicatorLEDPin, HIGH);
}
digitalWrite(firingIndicatorLEDPin, LOW);
startDelay = millis();
while(millis()-startDelay < delayTime) {
digitalWrite(USBIndicatorLEDPin, HIGH);
}
digitalWrite(USBIndicatorLEDPin, LOW);
startDelay = millis();
while(millis()-startDelay < delayTime) {
digitalWrite(modeIndicatorLEDPin, HIGH);
}
digitalWrite(modeIndicatorLEDPin, LOW);
startDelay = millis();
while(millis()-startDelay < delayTime) {
// chill
}
}
}
void assignPins() {
if(type == "Arduino_bare" || type == "Arduino_Bare") {
// pin attachments:
panServoPin = 8; // Arduino pin for pan servo
tiltServoPin = 9; // Arduino pin for tilt servo
// triggerServoPin = 7; // Arduino pin for trigger servo, or output to trigger MOSFET
firingIndicatorLEDPin = 12; // Arduino pin for firing indicator LED
USBIndicatorLEDPin = 11; // Arduino pin for USB indicator LED
modeIndicatorLEDPin = 13; // Arduino pin for Mode indicator LED
reloadSwitchPin = 3; // Arduino pin for input from RELOAD switch
disablePlatePin = 2; // Arduino pin for input from disable plate
electricTriggerPin = 10; // Arduino pin for output to trigger MOSFET
invertInputs = true; // TRUE turns on internal pull-ups, use if closed switch connects arduino pin to ground
}
else if(type == "Shield_v4" || type == "Shield_v6") {
// pin attachments:
panServoPin = 9; // Arduino pin for pan servo
tiltServoPin = 8; // Arduino pin for tilt servo
// triggerServoPin = 7; // Arduino pin for trigger servo, or output to trigger MOSFET
electricTriggerPin = 6; // Arduino pin for output to trigger MOSFET
firingIndicatorLEDPin = 11; // Arduino pin for firing indicator LED
USBIndicatorLEDPin = 12; // Arduino pin for USB indicator LED
modeIndicatorLEDPin = 13; // Arduino pin for Mode indicator LED
reloadSwitchPin = 10; // Arduino pin for input from RELOAD switch
disablePlatePin = 2; // Arduino pin for input from disable plate
invertInputs = true; // TRUE turns on internal pull-ups, use if closed switch connects arduino pin to ground
}
else if(type == "Shield_v7") {
// pin attachments:
panServoPin = 8; // Arduino pin for pan servo
tiltServoPin = 9; // Arduino pin for tilt servo
// triggerServoPin = 10; // Arduino pin for trigger servo, or output to trigger MOSFET
electricTriggerPin = 7; // Arduino pin for output to trigger MOSFET
firingIndicatorLEDPin = 12; // Arduino pin for firing indicator LED
USBIndicatorLEDPin = 6; // Arduino pin for USB indicator LED
modeIndicatorLEDPin = 13; // Arduino pin for Mode indicator LED
reloadSwitchPin = 11; // Arduino pin for input from RELOAD switch
disablePlatePin = 2; // Arduino pin for input from disable plate
invertInputs = true; // TRUE turns on internal pull-ups, use if closed switch connects arduino pin to ground
}
else if(type == "Standalone_v3") {
// pin attachments:
panServoPin = 8; // Arduino pin for pan servo
tiltServoPin = 9; // Arduino pin for tilt servo
// triggerServoPin = 10; // Arduino pin for trigger servo, or output to trigger MOSFET
electricTriggerPin = 7; // Arduino pin for output to trigger MOSFET
firingIndicatorLEDPin = 12; // Arduino pin for firing indicator LED
USBIndicatorLEDPin = 14; // Arduino pin for USB indicator LED
modeIndicatorLEDPin = 13; // Arduino pin for Mode indicator LED
reloadSwitchPin = 11; // Arduino pin for input from RELOAD switch
disablePlatePin = 2; // Arduino pin for input from disable plate
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
invertInputs = true; // TRUE turns on internal pull-ups, use if closed switch connects arduino pin to ground
}
else if(type == "Standalone_v5") {
// pin attachments:
panServoPin = 8; // Arduino pin for pan servo
tiltServoPin = 9; // Arduino pin for tilt servo
// triggerServoPin = 10; // Arduino pin for trigger servo, or output to trigger MOSFET
electricTriggerPin = 7; // Arduino pin for output to trigger MOSFET
firingIndicatorLEDPin = 12; // Arduino pin for firing indicator LED
USBIndicatorLEDPin = 14; // Arduino pin for USB indicator LED
modeIndicatorLEDPin = 13; // Arduino pin for Mode indicator LED
reloadSwitchPin = 11; // Arduino pin for input from RELOAD switch
disablePlatePin = 2; // Arduino pin for input from disable plate
invertInputs = true; // TRUE turns on internal pull-ups, use if closed switch connects arduino pin to ground
}
else if(type == "Standalone_v7") {
// pin attachments:
panServoPin = 8; // Arduino pin for pan servo
tiltServoPin = 9; // Arduino pin for tilt servo
// triggerServoPin = 10; // Arduino pin for trigger servo, or output to trigger MOSFET
electricTriggerPin = 7; // Arduino pin for output to trigger MOSFET
firingIndicatorLEDPin = 12; // Arduino pin for firing indicator LED
USBIndicatorLEDPin = 14; // Arduino pin for USB indicator LED
modeIndicatorLEDPin = 13; // Arduino pin for Mode indicator LED
reloadSwitchPin = 11; // Arduino pin for input from RELOAD switch
disablePlatePin = 2; // Arduino pin for input from disable plate
invertInputs = true; // TRUE turns on internal pull-ups, use if closed switch connects arduino pin to ground
}
else if(type == "Standalone_v8") {
// pin attachments:
panServoPin = 8; // Arduino pin for pan servo
tiltServoPin = 9; // Arduino pin for tilt servo
// triggerServoPin = 10; // Arduino pin for trigger servo, or output to trigger MOSFET
electricTriggerPin = 7; // Arduino pin for output to trigger MOSFET
firingIndicatorLEDPin = 12; // Arduino pin for firing indicator LED
USBIndicatorLEDPin = 14; // Arduino pin for USB indicator LED
modeIndicatorLEDPin = 13; // Arduino pin for Mode indicator LED
reloadSwitchPin = 11; // Arduino pin for input from RELOAD switch
disablePlatePin = 2; // Arduino pin for input from disable plate
invertInputs = true; // TRUE turns on internal pull-ups, use if closed switch connects arduino pin to ground
}
}
Backup:
// contributed by Hugo K.
#include <EEPROM.h>
#include "EEPROMAnything.h"
/*
// Booleans but int
int controlMode;
int safety;
int firingMode;
int scanWhenIdle;
int trackingMotion;
int trackingColor;
int leadTarget;
int safeColor;
int showRestrictedZones;
int showDifferentPixels;
int showTargetBox;
int showCameraView;
int mirrorCam;
int soundEffects;
// Integers
int camWidth;
int camHeight;
int nbDot;
int antSens;
int minBlobArea;
int tolerance;
int effect;
int trackColorTolerance;
int trackColorRed;
int trackColorGreen;
int trackColorBlue;
int safeColorMinSize;
int safeColorTolerance;
int safeColorRed;
int safeColorGreen;
int safeColorBlue;
int idleTime;
// Floats
double propX;
double propY;
double xRatio;
double yRatio;
double xMin;
double xMax;
double yMin;
double yMax;
*/
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
void backup(){
char* Parameter;
char* i;
char BufferSerie[200];
for (int z=0;z<=200;z++) BufferSerie[z]='\0';
byte bufferPos=0;
char ch;
boolean endOfString = false;
while( !endOfString){
if(Serial.available()){
ch = Serial.read();
if(ch != '!'){
BufferSerie[bufferPos++] = ch;
}else{
endOfString = true;
}
}
}
// Booleans
Parameter = strtok_r(BufferSerie, ";", &);
configuration1.controlMode = atoi(Parameter);
// Integers
Parameter = strtok_r(NULL, ";", &);
configuration1.camWidth = atoi(Parameter);
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Parameter = strtok_r(NULL, ";", &);
configuration1.trackColorGreen = atoi(Parameter);
// floats
Parameter = strtok_r(NULL, ";", &);
configuration1.propX = strtod(Parameter,NULL);
delay(20);
void restore(){
delay(20);
//Booleans
Serial.print(configuration1.controlMode);
Serial.print(";");
Serial.print(configuration1.safety);
Serial.print(";");
Serial.print(configuration1.firingMode);
Serial.print(";");
Serial.print(configuration1.scanWhenIdle);
Serial.print(";");
Serial.print(configuration1.trackingMotion);
Serial.print(";");
Serial.print(configuration1.trackingColor);
Serial.print(";");
Serial.print(configuration1.leadTarget);
Serial.print(";");
Serial.print(configuration1.safeColor);
Serial.print(";");
Serial.print(configuration1.showRestrictedZones);
Serial.print(";");
Serial.print(configuration1.showDifferentPixels);
Serial.print(";");
Serial.print(configuration1.showTargetBox);
Serial.print(";");
Serial.print(configuration1.showCameraView);
Serial.print(";");
Serial.print(configuration1.mirrorCam);
Serial.print(";");
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
Serial.print(configuration1.soundEffects);
Serial.print(";");
//Integers
Serial.print(configuration1.camWidth);
Serial.print(";");
Serial.print(configuration1.camHeight);
Serial.print(";");
Serial.print(configuration1.nbDot);
Serial.print(";");
Serial.print(configuration1.antSens);
Serial.print(";");
Serial.print(configuration1.minBlobArea);
Serial.print(";");
Serial.print(configuration1.tolerance);
Serial.print(";");
Serial.print(configuration1.effect);
Serial.print(";");
Serial.print(configuration1.trackColorTolerance);
Serial.print(";");
Serial.print(configuration1.trackColorRed);
Serial.print(";");
Serial.print(configuration1.trackColorGreen);
Serial.print(";");
Serial.print(configuration1.trackColorBlue);
Serial.print(";");
Serial.print(configuration1.safeColorMinSize);
Serial.print(";");
Serial.print(configuration1.safeColorTolerance);
Serial.print(";");
Serial.print(configuration1.safeColorRed);
Serial.print(";");
Serial.print(configuration1.safeColorGreen);
Serial.print(";");
Serial.print(configuration1.safeColorBlue);
Serial.print(";");
Serial.print(configuration1.idleTime);
Serial.print(";");
//Floats
Serial.print(configuration1.propX);
Serial.print(";");
Serial.print(configuration1.propY);
Serial.print(";");
Serial.print(configuration1.xRatio);
Serial.print(";");
Serial.print(configuration1.yRatio);
Serial.print(";");
Serial.print(configuration1.xMin);
Serial.print(";");
Serial.print(configuration1.xMax);
Serial.print(";");
Serial.print(configuration1.yMin);
Serial.print(";");
Serial.print(configuration1.yMax);
Serial.print("!");
EEPROMAnything.h
#include <EEPROM.h>
#include <Arduino.h> // for type definitions
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
for (i = 0; i < sizeof(value); i++)
*p++ = EEPROM.read(ee++);
return i;
}
Create a folder named "Processing" and copy the files provided with this step into it. Furthermore you will have to copy the files in the "copy these into processing root or
system32" folder to your root system.
You can find a detailed description on how the software works on the project sentry gun page here . The only major new thing is the surf classifier to detect the
instructables robot. It can be controlled with these lines:
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/
File Downloads
Related Instructables
Advertisements
Comments
1 comments Add Comment
http://www.instructables.com/id/Nerf-Vulcan-Sentry-Gun/