High DPS Nerf Blaster
Background
This blaster was built as a class project for ME 507 (Advanced Control System Design) at Cal Poly SLO. The goal of the class is to create a system that uses actuators and sensors controlled by a custom PCB with an embedded microcontroller. I worked on this project with my partner Andrew Whitacre, and together we actually built two blasters, one for each of us. Both blasters were designed, built, and programmed in ~8 weeks.
Functionality and Components
The blaster consists of the various components shown below. These include two 1950kV Brushless Motors driving custom machined aluminum flywheels. These launch the darts, which are pushed out of the magazines by two solenoids. 4 beam break sensors detect the positioning of the solenoids to determine whether they are forward, back, or somewhere in between their travel. A safety switch is located on the bottom for easy access.
Two side mounted potentiometers allow the user to control the speed of the flywheels and fire rate of the solenoids. The trigger itself has two switches inside it. When the first switch is released, the flywheels spin up. When the second switch is pressed, the solenoids are actuated based on the current fire mode.
Two user buttons located towards the top of the blaster allow the user to select between 1 of 12 different modes. The mode is readable using the individually addressable LEDs mounted in a 4x3 grid. The entire system is run off two 12V drill batteries, which are wired in series to create 24V. This 24V is stepped down to 5V using a buck converter to power the low voltage components.
The blaster has 12 different firing patterns available, based on both the firing modes and types. The firing modes include the individual left and right magazines, an alternating mode, and a mode where both magazines fire at once. The firing types include single fire, 4-round burst, and fully automatic. The blaster can be in any combination of modes using the user interface on the top of the blaster.
Flywheels
The high speed motors necessitated the use of high quality flywheels. Each double barrel flywheel had its outside profile turned from 1.375in 7075 aluminum round stock on the Mustang 60 TL1 CNC Lathe. The internal boring and mounting holes were then done on the Mustang 60 VF4 CNC Mill in softjaws. While admittedly not perfect, this resulted in a fairly balanced set of flywheels suitable for our needs.
First Op done on the lathe to create the outer contours
Second and Third Ops to bore the inside and drill mounting holes
Motors were a very light press fit into the flywheel
Base Plates
The core of the blaster is the base plate, onto which the solenoids and outward facing 3D prints mount. This was CNC machined from 0.5in thick 6061 aluminum plate. The final product is full of tapped M3 and M4 holes used to mount the various components. This gives the blaster a very rigid base, which results in structural integrity and a quality feel.
First Op in talon grips
Second Op
Thrid and Fourth Ops for drilling/tapping side holes
Two completed base plates, one for each blaster
Custom PCBs
We designed a custom microcontroller PCB for this project. The goal was that this PCB would regulate power from 24V to 5V and 3.3V, as well as mount the 12 indicator LEDs, 2 user buttons, and house the 4 beam break sensors.
Unpopulated PCB
Component Placement setup
Carefully populating all surface mount components
Hot plate reflowing the solder
The intended controller for this project was a custom PCB with an STM32F411CEU6. However, there were numerous problems with this circuit board. Firstly, during the creation of the custom footprint for the beam breaks, the emitter diode pins were swapped, causing them to not emit at all. Additionally, the voltage divider of the buck converter had to be adjusted as it was originally outputting 6V rather than 5V. This is where the known issues end, and the unknown issues begin.
Only 1 of these LEDs should be on...
We built two custom MCU boards, each a duplicate of the other. However, they each had different issues. On one board, the 5V and 3.3V power lines were somehow tied together, likely internally through an IC. Likely culprits include 4 mosfets used to light LEDs and a few level shifters used to convert 5V signals to 3.3V for the MCU. The other board had functioning 3.3V and 5V lines, but the MCU became extremely hot when powered. No solder bridges were visible, so we swapped the MCU on this board, thinking that the original may have been damaged. The second MCU also became extremely hot, indicating that our short circuit was somewhere else on the board.
Having shorted 3 different MCUs, we decided to cut our losses and used a BlackPill development board instead. This caused us to have to remap all our pins to allow for clean(ish) wire routing. The beam break sensors received a new mounting system and then wires had to be hand soldered to each as shown below.
BlackPill Development Board soldered to a perfboard
Hand Soldered Beam Break Sensors
Ultimately, the hand soldering of the system using a BlackPill resulted in a functional final project, but not an exceptionally robust one. With many wire connections being made purely with solder and no other mechanical connection, connections break with extended use due to the violent vibrations of the solenoids. We also continuously had problems holding the beam break sensors in place. They kept wanting to lift up and away from the flags attached to the solenoids.
H Bridge Board
We were able to use our separate 24V board for this project. This 24V board included 4 half bridge drivers in order to create 2 full H-Bridge drivers used to control the solenoids. This board also included power distribution to the ESCs used to drive the brushless flywheel motors, and power distribution to the external buck converter. This board was designed to have no components on the backside so it could be placed flat against the aluminum plate that forms the blasters base. This provides a heat sink to the board, which is important due to the high current running through this PCB. This solenoid driver board has 4 layers, each with 1oz copper. This helps reduce the trace width needed as compared to a typical 1oz external/0.5oz internal board.
This 24V board worked exceptionally well for the application and allowed us to drive the solenoids at an extremely fast rate of fire. This is done through “Solenoid Clamping” which rapidly decays the current generated by the solenoid when returning using the spring. This allows the solenoid to return much quicker than if the current was just freewheeling through a diode. The diagram below shows how this H-bridge configuration works for solenoid fast discharge circuits.
Blaster Assembly
Some pictures and videos of the blasters in progress
Trigger Assembly
Base Plate attached to grip
Here's what the front of the solenoids look like. The aluminum flags trigger the beam break sensors mounted above
Flywheel "Cage"
Flywheel Cage Installed
Potentiometer and safety switch wiring
You can just barely see the aluminum flags mounted to the solenoid in this view
Programming the stm32 required the programming board, which has to be connected each time. Saves space, but makes programming painful
Spaghetti proof of concept. First time launching darts was a success.
TSMFC
Software
The blaster has 3 different firing types: Single, 4 shot burst, and Full Auto. These are complemented by 4 different firing modes: Left, Alternating, Both, and Right. This results in 12 different firing patterns. The Left and Right modes only use the left or right solenoid respectively. The alternating mode switches between the left and right solenoid every shot, and always starts on the opposite of whichever was last fired. The “both” mode always fires both solenoids at the same time, resulting in two darts launched per actuation. These modes and types are displayed on an individually addressable LED grid, which shows the currently selected mode and type through a crosshair.
Andrew showing the firing patterns during the ME 507 demonstration day. Here “Both + 4 Shot Burst” is the pattern selected
The blaster is able to execute each firing pattern due to the use of the beam break sensors. These give feedback to the microcontroller which allows it to only actuate a solenoid when it has completed an entire stroke. This way the control of the solenoids is not dependent on the time constant of the solenoids, which changes based on friction or battery voltage. The friction is an especially important aspect, since the force from the spring loaded magazines changes based on how many darts are loaded.
Our software was primarily written in C++, with the use of the RC receiver class we made in a previous lab. The logic to control the firing patterns is implemented through multiple finite state machines (FSMs) that use a combination of timing, a dart counter, user inputs, and the beam breaks to trigger the transitions that fire the darts.
Debounce was an issue we ran into several times throughout the project, which required additional logic in the software to account for this. Originally, we had implemented debounce circuits into our circuit board for all of the various mechanical switches in our project (5 total). However, we did not have said debounce circuits in our switches after switching to a BlackPill development board, so we used state machines with flags and measurements of the elapsed time in order control both the rising and falling edges of signals, primarily our mode and type selection buttons. This implementation is shown in Figure 12. We chose to prioritize input latency, so the debounce is triggered on any rising or falling edge, and the filtered signal is forced to that state for a period of time before it is allowed switch again. The trigger uses a 10ms debounce, while the user buttons use a 250ms debounce.
Rising and Falling Edge Debounce Implementation
Result
This project overall was fairly successful. We managed to make a complete, 2 fully featured blasters with the intended 12 different modes of operation. The overall look and feel of the blaster exceeded our expectations. However, it was quite disappointing that our custom MCU circuit boards did not work, especially since we had invested quite a bit of time and money into them. The biggest consequence of moving away from the custom PCB was the improvised methods for mounting various components, especially the beam break sensors. The beam break sensors are truly meant to be mounted to a circuit board, there are no holes or intended mechanical methods to mount them. We used a clamping mechanism to try and secure them in place, however due to the extreme vibrations of the blaster the beam break sensors continually lift themselves out of alignment. This prevents the blaster from firing, since the sensors are required for actuation.
Additionally, the potentiometers used gave us quite a bit of trouble. On a test breadboard setup, the potentiometers would work perfectly. However, after soldering into the blaster, they would become unreliable or sometimes outright unreadable. We believe this may have been due to the heat of the soldering iron affecting the internals of the potentiometers.
Overall, we are proud that all of the functionality works for our project, however it lacks the robustness for continued use or demonstrations.
The following references were exceptionally valuable in the software and electrical design of our project:
Interfacing with WS2812 LEDs on STM32 - ControllersTech