TINKERCAD Motorized Remote Control Nerf Gun
by code_dude03 in Circuits > Arduino
2046 Views, 7 Favorites, 0 Comments
TINKERCAD Motorized Remote Control Nerf Gun
This gun module was designed for a competition robot i created since it can be fully automated or activated remotely. All of the parts are very low cost online and the parts are designed to be printed with minimal or no support and are modular to ensure no filament is wasted and to allow for modifications. The design is intended to work with all standard NERF magazines but in my example i used only 6 darts. The control is done by an arduino nano clone which in my setup is slave to a raspberry pi microcomputer.
All .STL files are in printing section
Supplies
filament + 3d printer
cheap low power laser for aiming (optional) i used a low cost cat toy on ebay and took out the laser diode.
4x aa battery + battery case
two small standard dc motors with flat sides (20mm overall diameter 15mm between flat sides)
an arduino or microbit board with pin breakout or you are able to solder directly into pins
a small h-bridge motor controller board
2 m4 srews 25mm long + 12 nuts (or 4 nuts and spacers)
12 m3x12mm screws and nuts or locking nuts
2 625-zz bearings
2 standard sized servos
Printing
i printed all parts in orientation that the file is with 0.2mm layer height and supports only for the large magazine holder part and dart pusher
Downloads
Assembly
use 2 small self tapping screws (included with servos) to attach the first pivot part to a singular sided servo horn, and screw servo horn onto servo (set servo to about 90 first)
use a m3x12mm screw and locking nut to attach other pivot part using the holes, but dont overtighten since this part needs to rotate
insert the servo into the main pivot holder part and secure with m3 screws that should tap into the holes
use m3 screw to secure servo onto bracket for dart pusher with nut behind and set servo to 0
insert dart pusher from front (where holes are)
push servo adapter onto servo disc and use small self tap screw to secure
use m3 screws and nuts to attach holes at front to back of magazine holder part
insert motors into holder and use self tap screws to attach to front of magazine holder
insert the two bearings into the corresponding holes on main bracket
put m4 screw facing out of holes in magazine holder while holding it between the bearings and secure with nut on outside then more nuts or spacer until it reaches bearing.
Put nut or locking nut outside frame to secure the magazine holder in place - it should rotate back and forward
attach top pivot piece to hole at front of magazine holder using locking nut to allow rotate
glue 4xaa battery case ontop of rear servo to act as counterweight
OPTIONAL:
glue slide adapter to base
attach slide base to intended surface
screw twist locks into slide base
slide the slide adapter into place and twist the locks to hold
Wiring
attach all ground cables to common ground
attach two servo control pins to digital out on arduino
attach two servo vcc to vcc of battery pack
attach vcc of battery pack to VIN pin on arduino to regulate it to 5v or use external 5v supply or usb
attach vcc of laser diode to vcc battery pack and ground to ground via appropriate resistor (diodes vary)
on my setup i also have 3 control wires connected to digital pins to signal changes in motor state from the master controller raspberry pi (and a common ground cable)
attach motors into h-bridge (same connection) and h bridge vcc to battery and ground to common ground and control pins to arduino digital pins
Programming
use import servo in c++ to then map servo pins and send values.
here is the program i use for control via raspberry pi:
// turret control file shoot file
#include <Servo.h>
int pinMotors = 7;
int pinSignal = 11;
int pinServUp = 6;
int pinServDown = 4;
//int pinLaserControl = 10;
//int pinLaser = 11;
int angleval;
Servo gun;
Servo angle;
void setup()
{
pinMode(pinMotors, OUTPUT);
pinMode(pinSignal, INPUT);
pinMode(pinServUp, INPUT);
pinMode(pinServDown, INPUT);
// pinMode(pinLaserControl, INPUT);
// pinMode(pinLaser, OUTPUT);
gun.attach(9);
angle.attach(2 );
gun.write(0);
angle.write(50);
}
void loop()
{
//digitalWrite(pinLaser, HIGH;)
if (digitalRead(pinSignal) == HIGH) {
digitalWrite(pinMotors, LOW);
delay(2000);
gun.write(180);
delay(1000);
gun.write(0);
digitalWrite(pinMotors, HIGH);
delay(2000);
}
else {
digitalWrite(pinMotors, HIGH);
}
if (digitalRead(pinServUp) == HIGH) {
angleval = angleval + 1;
if (angleval > 50) {
angleval = 50;
}
angle.write(angleval);
delay(25);
}
else if (digitalRead(pinServDown) == HIGH) {
angleval = angleval - 1;
if (angleval < 0) {
angleval = 0;
}
angle.write(angleval);
delay(25);
}
}
ENJOY :)
if you havent already watched it i embedded a demo video of the gun in action to see what yours should do