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

Full-Auto 3D-Printed Brushless Nerf Blaster Arduino Control © GPL3+

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

  • 250 views
  • 0 comments
  • 5 respects

Components and supplies

Screenshot 2019 06 14 15 28 58 udl6wzcwho
Arduino Nano Every
Arduino Nano Every Is very compact to fit within a Nerf gun while retaining all of the functionality you need.
×1
20m1028 40
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
15n8321 40
Microswitch, Miniature
Any generic microswitch. Does not have to be high current.
×2
Fairchild semiconductor fqu13n06ltu image 75px
Power MOSFET N-Channel
Make sure it's logic level! N Channel >20V >15A Drain-to-Source @5V gate voltage.
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
R3 in schematic - Prevents floating voltage at MOSFET gate.
×1
95w7697 40
Through Hole Resistor, 4.7 kohm
R1 in schematic to pull up MS2 microswitch.
×1
4415447
Through Hole Resistor, 150 ohm
For LED's (value depends on your setup).
×1
4415447 jg5sklyzsj
Resistor 220 ohm
R2 in schematic to limit current from MOSFET gate. This could be optional, though I have not tested without.
×1
Fairchild semiconductor 1n4004. image
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
Panasonic eca2am101
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
Kemet c320c104k5r5ta image
Capacitor 100 nF
This acts as a noise/interference filter for Arduino power input. C2 in schematic.
×1

Necessary tools and machines

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

About this project

I've always enjoyed building and creating things, so I've decided to created props and replicas from objects found within movies and video games. Bringing a virtual object into reality, then sharing my techniques with those who have similar interests.

My latest and greatest creation is the Kang Tao, a smart gun featured in the upcoming video game Cyberpunk 2077. To create such a complex object, a 3D printer was used to achieve the aesthetics and mechanical fitment of parts.

A static object would be too easy though, I wanted a challenge. So I designed it as a functional Nerf Blaster.

To achieve this functionality, It needed to control a solenoid and ESCs for brushless motors. Relays and time delays etc would be too cumbersome and so an Arduino was a more practical solution.

This write up will be focused on the Arduino and electrica circuit aspect of this project (since this is an Arduino site). I labelled this 'easy' as the Arduino portion is quite simple. The mechanical design and 3D printing is advanced though. If you want to control a Brushless ESC, Brushless Motors and Solenoid with Arduino for Nerf Blasters, this guide is for you!

CAD Design, 3D Printing etc are explained here:http://nerfhaven.com/forums/topic/28493-cyberpunk-2077-kang-tao-3d-printed-nerf-gun/

or here: https://www.reddit.com/r/nerfhomemades/comments/djmyu0/3d_printed_kang_tao_nerf_blaster_from_cyberpunk/

Video build tutorials here: https://www.youtube.com/channel/UCP3j3nmdL5VLFy1indyyzAA/featured?view_as=subscriber

The schematic (refer schematic section) was drawn to illustrate how everything is connected. An Arduino Nano is used because of it's small size. This should work with a Uno and others too.

Refer to schematic for the below terminologies MS1, C2 etc.

Refer to Code section on explanation of how the code works.

Triggers with Flywheels & Solenoid

The way the code works, is that when MS2 (secondary microswitch trigger) is held, the brushless motors rev up.

When MS1 (primary microswitch trigger) is pressed or held, a signal is sent to the MOSFET gate to fire the Solenoid (S) repeatedly. The solenoid pushes the Nerf dart out of the mag and into the flywheels (M1 & M2) which then accelerate the dart out of the barrel.

However, MS1 only activates while MS2 is held. This helps prevent jams in case a dart gets pushed into non-spinning flywheels. In the code (refer code section), it is where '&&' is used.

Power supplied to the brushless motors and solenoid do not travel through the microswitches. This means you do not need high current rated microswitches.

Brushless Motors

I'm not going to explain how brushless differs from brushed motors here, you can search for some great explanations.

There are inrunner and outrunner brushless motors. You want an outrunner motor since they are flatter in shape so you don't have ugly cans sticking out the side of your Nerf blaster. Outrunner motors also have a portion of the external can rotate with the shaft. This makes it easy to 3D print flywheels to go over the motor.

Get a motor with rear mounting holes.

Voltages of motors should handle at least 12.6V (3s lipo).

Current of motor should not exceed Brushless ESC current rating.

Power of motors should be >60W. This project uses 12.6V supply voltage x measured 7A motor draw = ~80W each.

RPM of brushless motors should be ~25k and are determined by kV rating x Voltage. This project uses 2600kV motors @ 12.6V. Therefore 2600 x 12.6 = ~32, 760RPM. I only run the motors at half throttle and darts fly 25m / 82ft!

Brushless ESCs

These basically control the power of the brushless motors.

Brushless motors don't work with brushed ESCs, get brushless.

You need one ESC per motor. Otherwise the back EMF from two motors connected to one ESC will mess up the ESC timing and damage said ESC and / or motors.

Current rating of ESC needs to be higher than current draw of motor. Motor in this case was measured at 7A each. Recommend ESC is 20A or higher.

Voltage rating of ESC needs to be at least 12.6V (3s Lipo).

ESC does not need a built-in BEC. You can use 'OPTO' ESCs. If you have an ESC with BEC, connect the ground and signal cables to Arduino as shown in the schematic. Do NOT connect the ESC 5V Red cable to anything. (Unless you have a specific purpose for it and know what you're doing).

Battery

A single battery to power everything. I recommend using a XT60 connector.

Voltage is 12.6V 3S Lipo Battery.

Capacity is 1300mAH minimum recommended.

Current Discharge Rating of battery should be enough for the power draw of all loads. In this project, load current is ~25A.

Max discharge rate of battery is calculated by Discharge Rate (25C) x Capacity in Ah (1, 300mAh = 1.3Ah).

Therefore 25 x 1.3 = 32A max discharge rate for the battery. You should be able to find these numbers in the battery specs.

MOSFET

Powering a 12V / 8A Solenoid straight from an Arduino will cause magic smoke (Arduino dies). Solution? MOSFET.

The power MOSFET is used as an on / off switch for the Solenoid. It basically interrupts the ground that powers the Solenoid. This is known as a N-Channel MOSFET. Make sure you get a N-Channel.

The MOSFET knows when to turn on and off because of a signal sent to the MOSFET gate pin from an Arduino output pin (D4 in this case). Arduino's put out 5V, and the gate should be fully on at 5V. For this to work it needs to be a Logic Level MOSFET.

Current draw from Solenoid is rated at 8A. Make sure the MOSFET has a higher max current rating. This project uses a 30A max rated MOSFET.

Voltage though the MOSFET is 12.6V to power the solenoid. This MOSFET is rated at 60V max which is plenty of headroom.

Temperature of the MOSFET is less than 35°C in this case. This is achieved because the MOSFET is rated for 30A, though there is only ~8A of load being pulled through it. The other reason is the load (Solenoid) is only powered on momentarily before switching off, instead of powered on constantly. A heat sink is not necessary in this case.

Solenoid

This pushes the dart into the flywheels. All you want is a 12V rated Solenoid with 35mm stroke length. Shorter strokes will not push the full length type Nerf darts far enough.

Upgrade it's spring to 0.9mm diameter wire, 14mmOD & 40mm length to prevent jams.

Because the Solenoid is powered on momentarily as opposed to constantly, it should only get mildly warm ~40°C and therefore not require cooling.

These solenoids are relatively cheap and generic. They can be found on Ebay, Aliexpress etc.

Safety Switch

SW safety switch is simply a 2 position slider switch. It has 3 contacts, though only 2 are used. Powers off Arduino when safety is on, preventing flywheels & solenoid from activating.

Protection Circuitry

This section explains how to prevent frying your electronics!

C1 33μF (100μF recommended) & C2 100nF (0.1µF) reduces voltage fluctuation to the Arduino power input.

Caution: C1 is polarity sensitive, striped side is negative, else it goes bang!

D1 prevents reverse voltage to Arduino VIN. Take note of it's polarity.

D2 is a fly-back / freewheeling diode. It prevents the solenoid (or other inductors) from creating back EMF. This back EMF could otherwise damage the MOSFET. Take note of it's polarity.

R1 & R2 are 4.7kΩ pull-up resistors for MS1 & MS2. This prevents floating voltage at the microswitches.

R3 is a 10kΩ pull-down resistor to prevent floating voltage at the gate of the MOSFET.

R4 is a 150kΩ for the optional LED's. My LED's are 2 in series at 2.4V / 50mA each. Your resistor value may vary. These LED's flash on and off in sync with the solenoid to replicate muzzle flash!

Video explanation & test firing below!

There's an entire playlist on the Kang Tao Build

That sums up this guide, any questions leave a comment below :)

Code

Nerf Blaster Brushless Motor & Solenoid Arduino Code - Clark3DPRArduino
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
  }
}

Schematics

System Schematic - Clark3DPR
This is how it is all wired up. Pay close attention to diode and capacitor polarities. Drawn with AutoCAD.
Motor control v9 9xogksxcds

Comments

Similar projects you might like

Littlearm 2C: Build a 3D Printed Arduino Robot Arm

Project tutorial by Slant Concepts

  • 6,609 views
  • 1 comment
  • 45 respects

3D Printed Case for a RaspPi 3, an Arduino and a 5" Display

Project tutorial by Jeremy Lindsay

  • 1,756 views
  • 0 comments
  • 7 respects

Tertiarm - 3d Printed Robot Arm

Project tutorial by Karagad

  • 9,277 views
  • 2 comments
  • 20 respects

3D Printed Lunar Phase Clock

Project tutorial by G4lile0

  • 7,028 views
  • 6 comments
  • 56 respects

Servo Control Panel

Project tutorial by dancili

  • 2,152 views
  • 2 comments
  • 7 respects

3D Printed Christmas Tree with Animation

Project tutorial by TheTNR

  • 1,246 views
  • 2 comments
  • 6 respects
Add projectSign up / Login