User avatar
By RichardS
#43219 User
petefats

Description
Recoil is an ESP8266 based target practice game. It consists of a single server, one or many targets and one or many web-based scoreboards operating in a closed ecosystem. Each element is powered by a 18650 lithium ion battery and contains a small module to provide charging and battery protection. The same PCB is used for all elements however the firmware they run is role-based.

Server

First and foremost, the server acts as an AP for all other devices. It broadcasts its own SSID, issues DHCP and provides concurrence between the known targets and web clients. It also acts as both a web server and websocket endpoint. The web server is used to serve static HTML/JS to web scoreboards, while the websocket interface is used for all other messaging. Targets are tracked via their chip ID. Each is also allocated a name and a color, which are used by to help identify which target is which. The server also manages the various modes of game play, enabling and disabling the individual targets based on the rules of the game chosen. Individual targets are represented by WS2812 leds (one per target) to give a simple visual indication of the play field. In addition, the server outputs a JSON object that is used by the web scoreboards to display game and target data.

Targets

Targets main job is to facilitate game play and detect impact. Upon startup, they connect to the AP, request DHCP, then issue a registration packet to the server. Depending on the current state of game play, as dictated by the server, they will enable or disable themselves. When enabled, they will report impact detected by a piezo connected through the ESP8266's ADC, registering a "hit" with the server. Targets are also responsible for storing their own individual settings in EEPROM. When a target's name or color is updated by the web scoreboard, it's saved locally and reused at next power up.

Web Scoreboard

Any browser based device can act as a web scoreboard. Simply connecting to mDNS address "recoil.local" will display the current environment. From here you can rename targets and change their color. This page is also used to select the current game mode and display/reset the target hit counters. Essentially, this portion acts like a HUD for the system and can be displayed on multiple devices at the same time.

Game Modes

All-on

Simple game where all targets are enabled and simply count hits.

Round-the-world

Targets are enabled 1 at a time and cycle to the next once hit.

Whack-a-mole

Targets are enabled 1 at a time at random. If the enabled target isn't hit before the timer expires, a new target is selected.

Blackout

All targets are enabled. Once a particular target is hit, it is disabled. This repeats until all targets have been disabled and the game resets.

Parts
1x 2 screw terminal 5.0MM
1x 3 screw terminal 3.5MM or ws2811 connector
1x 4DIP switch 2.54mm
1x 6 Pin header
1x LM1117 3.3 regulator
2x Capacitor 16v 100uf
1x Capacitor 6.3v 1000uf
1x 6x6x4.5mm tactile switch
1x 3v3 Zener diode
1x 0805 resistor 1M
1x 0805 redistor 470k
1x 35mm Piezo Element
1x 18650 Lithium Ion
1x 18650 Battery Holder
1x 5V Micro USB 1A 18650 Lithium Battery Charger
http://www.ebay.com/itm/5PCS-5V-Micro-U ... 1414928326
1x JST XH 2.5-2 Pin Male/Female Connector
http://www.ebay.com/itm/50-SETS-JST-XH- ... 1639548157

Links
Github

Video


Images
Attachments
(19.78 KiB) Downloaded 628 times
(10.58 KiB) Downloaded 639 times
(525.32 KiB) Downloaded 585 times
(97.57 KiB) Downloaded 574 times
recoil_img_4.JPG
recoil_img_3.JPG
recoil_img_2.JPG
recoil_img_1.JPG
User avatar
By nicodw
#43799 Nice project :).

How do you detect the hit ?

I was wandering because I'm an airsoft player who was thinking about building a setup like this but has been experimenting with hit detection. Just detecting a hit is not that hard but it would be cool to be able to triangulate the exact position of the hit.

Any ideas for this would be welcome.
User avatar
By petefats
#43885 Thanks!

Hits are detected with a simple piezo, so there's no way to detect where you hit, only that you did. I had toyed with the same idea, where you could give more points to impact closer to the bullseye.

Perhaps if you split the target into smaller portions, with a piezo on each, with a little bit of foam surrounding them to provide acoustic isolation. This may work for a ring based target.

Also, I just recently became aware of Velostat. From what I understand, it can also be used as a make-shift pressure sensor. I believe you could use smaller pieces of it to define target areas.

Ether plan though is going to require an external ADC, since there is only the single one available on the ESP12e