Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Clark3DPR
Published © GPL3+

Full-Auto 3D-Printed Brushless Nerf Blaster Arduino Control

This project is an Arduino-controlled, 3D-printed functional Nerf replica of the Kang Tao Gun from the upcoming video game Cyberpunk 2077.

BeginnerFull instructions provided24,152
Full-Auto 3D-Printed Brushless Nerf Blaster Arduino Control

Things used in this project

Hardware components

Arduino Nano Every
Arduino Nano Every
Arduino Nano Every Is very compact to fit within a Nerf gun while retaining all of the functionality you need.
×1
Linear Solenoid, 12 VDC
Linear Solenoid, 12 VDC
Make sure you get a 35mm stroke length rated at 12V.
×1
Brushless DC Motor
Nerf Flywheel cages work best with Outrunner type brushless motors. Make sure it can handle 12V (3s Lipo).
×2
Brushless ESC
Make sure the Brushless ESC can handle at least 20% more current than the motor pulls. Make sure it can handle 3s Lipo. One ESC per motor.
×2
Lipo Battery 3S 11.1-12.6V 1300mAh 25C
Make sure the battery discharge rate handles the current draw of everything, plus 20% safety margin. Recommend 1300mAh minimum.
×1
Microswitch, Miniature
Microswitch, Miniature
Any generic microswitch. Does not have to be high current.
×2
Power MOSFET N-Channel
Power MOSFET N-Channel
Make sure it's logic level! N Channel >20V >15A Drain-to-Source @5V gate voltage.
×1
Resistor 10k ohm
Resistor 10k ohm
R3 in schematic - Prevents floating voltage at MOSFET gate.
×1
Through Hole Resistor, 4.7 kohm
Through Hole Resistor, 4.7 kohm
R1 in schematic to pull up MS2 microswitch.
×1
Through Hole Resistor, 150 ohm
Through Hole Resistor, 150 ohm
For LED's (value depends on your setup).
×1
Resistor 220 ohm
Resistor 220 ohm
R2 in schematic to limit current from MOSFET gate. This could be optional, though I have not tested without.
×1
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
Generic diode used as flyback diode D2 to protect MOSFET from back EMF from solenoid. D1 to protect Arduino power input from reverse voltage.
×2
Capacitor 100 µF
Capacitor 100 µF
Reduce voltage sag to Arduino power input - Polarity sensitive, so wire it up the correct way or it goes bang! C1 in schematic.
×1
Capacitor 100 nF
Capacitor 100 nF
This acts as a noise/interference filter for Arduino power input. C2 in schematic.
×1

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
My 3D printer is Evnovo (Artillery) X1 - 300x300x400mm

Story

Read more

Schematics

System Schematic - Clark3DPR

This is how it is all wired up. Pay close attention to diode and capacitor polarities. Drawn with AutoCAD.

Code

Nerf Blaster Brushless Motor & Solenoid Arduino Code - Clark3DPR

Arduino
1. When Arduino is powered on via the safety switch, it runs the arming sequence for the brushless ESC's. My ESC's take 3.7secs (3700 in the code). You may have to increase this value up to 10000 (10secs) depending on your own ESC to get it to exit safe mode.

2. Hold secondary microswitch to rev flywheels, then press or hold primary microswitch to fire.

2. Change throttle.write(92) to increase/decrease motor idling speed or turn them off. By default motors will spin at low speed to decrease spin up time. (Value depends on your motor / ESC)
Change throttle.write(97) to change motor top speed and dart velocity. (Value depends on your motor / ESC)

Change delay(90) and delay(100) to increase/decrease fire rate of solenoid.

4. When Microswitch is released, ESC PWM signal for flywheels & signal to MOSET gate for solenoid stops spinning/activating.

5. When ESC's lose signal from Arduino (when safety switch is on and Arduino powered off), the ESC's revert to safe mode and turn off motors.
const int buttonPinF = 2;      // Flywheel Rev microswitch pin number
const int buttonPinS = 5;      // Solenoid microswitch pin number
int buttonStateF = 0;             // Variable for reading the Flywheel Rev microswitch status
int buttonStateS = 0;             // Variable for reading the Solenoid microswitch status
int solenoidPin = 4;              // Solenoid MOSFET Gate pin number

#include <Servo.h>

Servo throttle;

int pos = 0;
int pin = 3;                            // ESC signal pin

void setup() {
  
   pinMode(buttonPinF, INPUT); 	       // Initialize the Flywheel microswitch pin as an input
   pinMode(buttonPinS, INPUT); 	       // Initialize the Solenoid microswitch pin as an input
   throttle.attach(pin);
   pinMode(solenoidPin, OUTPUT);         // Sets Solenoid MOSFET Gate pin as an output
    
 // ESC Arming Sequence
   for (pos = 90; pos <= 91; pos += 1) { 
      throttle.write(pos);             
      delay(3700);                                         // Wait for ESC to arm / Exit safety mode

// Increase this 3700 value depending on how long it takes for your ESC to arm

   }
}

void loop() {
  
    buttonStateF = digitalRead(buttonPinF);  // Read state of Flywheel microswitch value
 
    if (buttonStateF == HIGH) {  // Check microswitch pressed, if so Flywheel buttonState is HIGH
    throttle.write(92);                 // <(92) = Motor off / (92) = Idle speed
  } else {
    throttle.write(97);                // Motor on (92) = Idle speed / ~(115) = Max speed
  }

buttonStateS = digitalRead(buttonPinS);    // Read state of Solenoid microswitch value

  if (buttonStateF == LOW && buttonStateS == LOW) {
  digitalWrite(solenoidPin, HIGH);           // Switch Solenoid ON
  delay(90);                                                // ON duration
  digitalWrite(solenoidPin, LOW);           // Switch Solenoid OFF
  delay(100);                                             // OFF duration
   } else {
      digitalWrite(solenoidPin, LOW);      // Switch Solenoid OFF
  }
}

Credits

Clark3DPR
0 projects • 13 followers
Contact

Comments

Please log in or sign up to comment.