Designing a Nerf Blaster
The Nerf N-Strike Elite RapidStrike CS-18 Blaster is a toy blaster mounted on two supporting pillars that are connected to a circular plate that in turn are connected to a stepper motor shaft. This arrangement forms the basis for the horizontal rotation. On one of the pillars, a servo motor is fixed which controls the vertical motion (elevation) of the blaster. There are three DC motors inside the NERF Blaster. Two of these DC motors (with one common control) are responsible for the acceleration of the dart, thus controlling the dart speed. The third motor is responsible for triggering the dart, thus controlling the firing rate (# of darts fired/minute). Horizontal movement is mechanically restricted to one rotation to avoid a wire binding problem. Movement is limited to one rotation by a mechanical stopper connected to ground. Figure 1 shows the NERF Blaster setup, as does this demonstration video:
Figure 1: PSoC 4 BLE controlled NERF Blaster setup (Source: Cypress Semiconductor)
Challenges in the design of a Nerf-Blaster
- Designing the Stepper Motor Controller
A stepper motor is a brushless, synchronous motor that divides one full rotation of the rotor into a number of steps. A stepper motor is designed specifically to be operated in a mode where the rotor is frequently locked in defined angular positions. Stepper motors can be operated in full step mode and half step mode. In full step mode, the motor moves through its basic step angle (1.8 degrees) for 200 steps per revolution. In half step mode, the motor step angle reduces to half the angle in full step (0.9 degree). Now, it takes 400 steps to complete a revolution. The Nerf blaster discussed in this article uses the half step sequence. A 200-step (1.8°per step) stepper motor is used. With half stepping, 400 steps (i.e., 0.9° per step) is achieved.
- Limiting the Current through Stepper Motors
The stepper motor used inside the Nerf blaster is a high torque motor (20 Kg cm/1.45 foot-lbs torque). High torque stepper motors are built with very low resistance windings. Running these motors with a reasonable voltage leads to a faster rise in the current through the windings when they are turned on. This provides faster maximum motor speed. These motors generally consume 2-3 A current when the coils are completely turned on, which will damage the stepper motor windings.
- Designing the Servo Motor control
A servo motor consists of three components: DC motor, potentiometer, and a control circuit. The motor is attached to the potentiometer through a series of gears. As the motor rotates, the resistance of potentiometer changes and provides the control circuit with information regarding the shaft position. When the motor is in the desired position, the power that is provided to the motor is stopped.
- Designing the DC Motor control
DC motors are comparatively easy to control using a pulse width modulator (PWM).
Controlling a Nerf-Blaster Remotely using BLE
Figure 2: Block Diagram of PSoC 4 BLE controlled NERF Blaster (Source: Cypress Semiconductor)
Figure 2 shows the functional block diagram of the system and internal components used in this design built around the Cypress PSoC 4 BLE microcontroller. The NERF blaster is controlled using an Android phone and the communications link is BLE. This article explains how various motions of the NERF blaster are controlled:
- Stepper Motor for Horizontal Motion
- Servo Motor for Vertical Motion
- DC Motors for Firing Speed and Firing Rate
The android application and the BLE configuration for the microcontroller are outside the scope of this article.Stepper Motor Control
The stepper motor moves in distinct steps during its rotation. Each of these steps is defined by a Step Angle. The stepper motor has two coils with four terminals ( A, /A, B, /B ). For the operation of the stepper motor, the coils have to be excited in a particular sequence based on clockwise or anticlockwise rotation. The stepper motor can be operated in various modes (i.e., full step, half step, and micro step).
Once a particular mode is selected and the coils are excited in a particular sequence, the motor starts to rotate. However, the motor has the tendency to draw very high current because of the low winding resistance of the coils. If this current exceeds the maximum current rating of the stepper motor, the coils can get damaged. Hence it is very important to protect the stepper motor with current protection circuitry.
The following illustrates a half step implementation of the stepper motor using PSoC Creator to create the control code for the PSoC 4 BLE. PSoC Creator is a graphical IDE which allows developers to design projects graphically using a library components. The components required to rotate a stepper motor are PWM, Look Up Table (LUT), and descrete logic. Figure 3 shows the TopDesign configuration (graphical represenation of hardware) of the stepper motor control.
Figure 3. Stepper motor control (Source: Cypress Semiconductor)