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!

Participated in the
PCB Contest
6 Comments
Question 4 years ago
Nice project I am currently building one myself but simpler with LDR's so it can only be played in the dark. How do you register or fire to a different person and know that a target has been hit? Do you use IR for it?
Reply 4 years ago
Yeah, actually! I am using an SFH4360 (I think, don't quote me on that), driven from a PMBT2222A and no resistor. Current through the LED will be very high but pulsed, and the LED has a fairly focused beam already. The ESP32 has a built in IR encoder and decoder system to send 40kHz modulated signals, and I'm using VISHAY receivers that provide a clean logic level data signal when the IR is detected.
The data signal that gets sent during a shot includes the user's "ID" (8 bit), a "counter" (4 bit), and a small checksum value to detect data correctness.
Reply 4 years ago
I have been looking at IR myself as well I am only a bit sceptic about the beam focus since the light is not visible to the naked eye this is pretty difficult to finetune the focus.
What I also used in the user ID was splitting the ID up in 4 bit team ID and 4 bit user ID.
But yeah, really like the project keep it up!
oh and if you would like to see the project I am working on: www.github.com/ghostleyjim. Probably going to post an instructable when I have a working prototype (would not be long I hope)
Reply 4 years ago
If you are using a central server, adding the team ID isn't really necessary, since the user ID also allows the team information to be retrieved. And I get that problem with the IR beam - though keep in mind that a lot of phone cameras can see IR, especially strong beams, so you can use that for finer tuning!
I personally haven't found any good source of lenses yet, so I am just using a somewhat crude but surprisingly functional "pinhole" style system.
4 years ago
Fun project. You should enter this into one of the contests that are currently running on the site.
Reply 4 years ago
Thanks for the suggestion - that's actually why I posted it on here in the first place! I heard about the PCB contest, and unless I got a setting wrong, it should be entered into just that contest ^^