Introduction: ESP32 Lasertag

I think we all know Lasertag. It's this lovely Sci-Fi alternative to Paintball, with less paint (and pain), and plenty of awesome sound- and light-effects all over!

But for me personally, I always felt it was a bit restrictive to have to go to a specific arena to play. "Outdoor" Lasertag doesn't exist anywhere nearby, so I went for the next best thing:

An entirely DIY Lasertag system, with easily available components, made to be flexible, cheap, durable, and easy to build for anyone!

But can DIY even reach up to professional sets?
Oh, mine sure can. Thanks to the ESP32, the sets feature WiFi and Bluetooth, proper speakers, up to 40m of range in good conditions, and a few hours of runtime!
The whole thing is rounded off with an App and a well-polished, easy to hack Ruby server-script.

It's been a long-running project of mine, and I finally feel it's ready to be shared with others, so let me guide you through how to set your own sets up!

Quick note: This project is still very WIP. I haven't finished programming the software for the ESP32 just yet, but I wanted to publish the project for the PCB contest.
A proof of concept can already be seen with my older ESP-01 and AVR-based Lasertags, so it's not like the system does't work!

Step 1: Getting the Prerequisites

In order to actually use the Lasertag system, a few prerequisites first need to be fetched. I'll be describing how to get everything needed to build, program and modify your own set, but if you only want to use what's already there you can skip a few tools!

The softwares:
In order to work with the PCB schematic, you'll be needing KiCAD 5, available for all OSs from Windows to Linux. Head over to http://kicad-pcb.org/ and follow their instructions! If you only want to look at the schematic sheets to solder the PCB, but don't want to modify anything, you can just use the exported PDFs!

In order to program the ESP32, a normal Micro-USB cable can be used. To use the uploading tool you'll need to fetch the ESP-IDF though, which can be found here: https://docs.espressif.com/projects/esp-idf/en/lat...
You will also need to fetch the code repositories for the Lasertag and my general-purpose "XasCode" library, which can be found here: https://github.com/XasWorks/LZRTag https://github.com/XasWorks/XasCode
Clone them into whereever you like.

Optionally you can also install Eclipse for C++, if you want to be able to modify the software in a nice environment. This isn't necessary if you only want to program the system though!

The server side of the code will require at least Ruby 2.3. Installing the gem `LZRTag_base` will fetch everything you need to run the scripts.
You'll also need a MQTT server. The public `iot.eclipse.org` or similar can be used, but it is recommended to set up a local broker to improve ping!

If you want to use the App, installing Qt 5.11 together with the QMqtt plugin is necessary. The system will work just fine without though!

Step 2: Soldering Up the Hardware

I know, I know, this is a project with a lot of SMD parts, but don't worry!
I've taken care to not use any QFN packages or small parts that might be too challenging or require special hardware. A fine-tipped soldering iron, some flux, solder wick and other normal soldering items will be enough.

I don't sell the PCBs myself, but I can highly recommend using Aisler if you only want to get two or three PCBs. Their prices are good, they ship fast (inside the EU!), and you can order a set of all the required parts alongside the PCB!
Get yourself a board here: https://aisler.net/p/QLILZEMV
((I did not yet document some of the resistors etc., but I only use 220R, 2.2k, 10k and a few 100k, as well as a few 150nF and 10uF capacitors.))
Alternatively, throw the PCB at JLCPCB or whereever. Anything that can fabricate a two-sided board will do!

A small note on price-saving: If you don't feel like spending too much money on the USB-To-Uart converter chip, you can just leave it out, and program the ESP by soldering on some pin-headers and using whatever USB-Uart converter you have laying around. Just make sure to replace R51 with a 2.2k Resistor, otherwise the LiPo won't charge very quickly!

If you ordered from Aisler, all the packages should come with descriptions of where the components need to go (and yes, that feature is as cool as it sounds :>), but you can always look into the schematic files in KiCAD and figure things out from there.

Once all the hardware is soldered in place, you can head over to the next step, programming the chip!