Projekt von Makern - IoT Nerfgun

Maker: Moritz König

I. Video:

II. material:

The following components are needed to build an IoT NerfGun target:

  • Craftsman plywood 1,5mm thickness
  • foam rubber 4mm thickness
  • Microcontroller (Teensy LC)
  • ESP8266 or Wemos D1 Mini
  • LED seven segment display
  • Neopixel 24 ring
  • Pushbutton (3x)
  • QTR-1A distance sensor
  • USB micro jack
  • Cable, glue, tape (double-sided), hot glue

The following parts are needed for the NerfGun modifications:

  • LiPo battery
  • LiPo USB charger board
  • ESP8266 or Wemos D1 Mini
  • Button (soft)
  • Switch

III. the target

Cut out the required wooden parts from the 1.5mm thin plywood using the first template and a laser cutter. All foam rubber parts are cut out in the same way from the second template. To begin, the following wooden parts are glued together: Top part, one side part as well as the front side. On the front side, the 24 pixel LED ring is glued around the cut out circle using double-sided tape. The three holes for the connection cables of the ring should be drilled first.

Next, attach the foam rubber sides to the inside of the wooden case using double-sided tape. The holder for the target plate is inserted into the slanted slot on the sides of the housing, which is glued to the flexible sponge rubber part for the time being. The rectangular cutouts in the foam rubber allow the target to move so that it is recoiled when an arrow is hit. To detect the recoil, the distance sensor is fixed on the long plywood with hot glue and inserted between the two cutouts in the side walls of the case, as well as the wooden plate for the microcontroller.

For the power supply of the target, a small wooden box is attached to the right side of the case with some glue. Inside the box there is only the USB socket.

IV. The modifications of the NerfGun

In order for the NerfGun to be able to send messages to the target as soon as the trigger is pressed, there is space for a 0.5mm push button inside the gun just behind the spring of the trigger.

The soft version of the button contains a mound that perfectly matches the pin of the trigger. Between the trigger and the magazine is space for the Wifi module, the switch to turn the Gun on and off, and the USB charger for the LiPo battery.

The LiPo battery, on the other hand, is located directly in the handle of the Gun, although a pair of stabilizers may need to be removed depending on the type of battery. The charger is attached with hot glue, whereas all other components do not necessarily need to be glued.

V. Electronics and game modes

The Teensy microcontroller is responsible for the I2C 7-segment display, the distance sensor, the three buttons and the Neopixel ring. The Wemos or the ESP8266 are only needed here if a connection to the gun is needed. When the gun is switched on and triggered, a UDP message is sent from the gun to the target. If this is received at the Wemos of the target, pin D5 is switched from 0V to 5V (green connection cable). The digital input of the Teensys recognizes this voltage change and can react to it afterwards.

The middle button on the target is used to select the game mode. The left and the right button are used to increase or decrease values in the certain game mode. The 7-segment display shows the current value.

The first two game modes do not require an IoT NerfGun, i.e. the Wifi module can remain switched off. The last two game modes correspond to the first two only with IoT functionality, so that the misses are also detected.

  • Game mode 1: In this game mode, the time is set in which as many hits as possible must be scored. The timer will not start until the first arrow has hit the target. Arrows that do not hit the target are not considered. If the target is hit, the LED ring lights up green. When the timer has run out, the hits scored are shown on the 7-segment display.
  • Game mode 2: In this variant the number of hits is set. As in game mode 1, the game will not start until the first hit is scored. If the target is hit, the LED ring lights up green. The current number of hits can also be read from the ring. After the last hit, the time required is shown on the 7-segment display.
  • Game mode 3/4: These two game modes represent the first two with the addition that the NerfGun must be turned on. Misses are also detected here. If the trigger is pressed and no hit is detected within a very short time, a miss is counted. The game will also start at the miss.

VI. downloads:

Lasercut Templates:

Arduino code:

Fritzing schematic: