Wireless Display for Three Weapon Scoring Box
This project uses an ESP8266 microprocessor to add wireless scoring and display to the Three Weapon Scoring Box.
Note This is not for wireless fencing, this only for displaying scores - Wireless Fencing is a separate project
The ESP8266 takes the serial output from the Arduino UNO and runs a web server that indicates hits and maintains scores. The ESP8266 provides a wireless access point, just connect a browser on your smartphone or laptop for your own scoring display, or even a Raspberry pi and a giant screen.
The advantage of using a separate processor is that there is no impact on the Arduino, for example the timing of hits and lockout periods is unaffected by the handling of interrupts on the WiFi.
Parts for Wireless Display
- ESP8266 microprocessor
- Optional Wifi Antenna for ESP8266. This considerably extends the range of the access point, from just a couple of metres to a couple of tens of metres. Unfortunately, attaching the external antenna requires cutting the onboard antenna on the PCB and soldering the replacement.
- Two resistors, 3K9 and 2K2 to create a 5V to 3.3V divider.
- ESP8266 GND to Arduino GND
- ESP8266 VIN to Arduino 5V
- ESP8266 RST to Arduino RESET (both processors will be reset with the rear push switch)
- 3K9 resistor to ESP8266 GND
- 2K2 resistor to ESP8266 D5
- Solder the free ends of the resistors and connect to Arduino TX.
The Arduino's serial output is 5V, but the ESP8266 is happier with 3.3V hence the voltage divider. It probably would work without the voltage divider, but I don't want to see any magic smoke.
- An extra power source isn't required, the ESP8266 can share the Arduino's.
- Remove the small connector and bare and tin short length of the coax core and and shield.
- scratch or cut through the ESP8266's on-board antenna where shown. Check for continuity - there shouldn't be any between the three bits of track.
- Solder the coax where shown.
- Use a small amount of epoxy to secure the cable and joint.
- The ESP 8266 should fit on the locating pins in the box's base. As before, use a soldering iron to spread the pins to secure.
- Wire it up, only five pins are used. Use Dupont connectors, rather than soldering directly to the ESP8266 pins (an inexpensive Dupont Connector Kit is handy to have; the crimping tool is unnecessary).
Note The pinout in the Construction section shows the top view of the ESP866. However, the ESP8266 is face down in the case, with the pins uppermost, so the connections are mirrored. Refer to the above photo if you aren't sure.
- Fasten the antenna connector to the case.
Code and Configuration
- Configure your Arduino environment for the ESP8266 processor (for mine I use NodeMCU 1.0 (ESP-12E Module))
- Download the sketch
- Update the SSID if you intend using multiple displays, and the password as well if you prefer.
How to use it
- Connect your laptop or mobile phone to the SSID being broadcast by the scoring box.
- Enter the password. the default in the sketch is "oneforall", but that's easily changed.
- Open a browser at 192.168.5.1
Note Even if you have several pistes running wireless displays, the URL will always be 192.168.5.1. The display depends on the SSID to which it is connected, which should be unique.
Note Yes, I know about mDNS .. it's on the bucket list of pending updates.
- You should see a display similar to the following. It is simplest if you can restrict access to one device; I've had mixed results connecting multiple devices .. so one large display rather than everyone running their own version on a phone.
From the top:
- Countdown clock. Starts at 3:00 (three minutes). Countdown pauses when there's a hit.
- Stop/Resume - Stops or resumes the countdown timer.
- Reset - resets the countdown timer to 3:00
- The coloured boxes light up as you would expect.
- Fencers' names can be added. There's a command line interface under the display where you can override and control the features.
The commands to set names are
G:[Green Name] R:[Red Name]For example
R:Charlie Brown G:Violet Gray
- Scores are incremented automatically as long as the countdown timer is running.
Note The display reacts to the lights that are displayed on the scoring box. The display does not know what weapons are being used, and can't even guess at priority, so, for example, simultaneous on-target hits in a foil match will increment both scores. It would be straightforward to comment out that part of the code, leaving the scores to be managed by the referee or third party.
- The - and + under each of the scores let you decrease or increase the values.
- The 0 under the scores resets the counter to 0
- Scroll down to see the command line. The following commands are available, though I expect that the name command is all that will be used in practice. These are the commands the web page on your mobile device sends back to the ESP826 and are included for completeness.
Codes are two characters and case sensitive.
- RH / GH : red/green hit on target - highlight colour, increment score (if countdown clock is running)
- RM / GM : red/green off target hit - white light
- RO / GO : red/green light off - dim colour
- R+ / G+ : increment red/green score
- R- / G- : decrement red/green score
- R0 / G0 : set red/green score to 0 (R zero G zero)
- TT Timer toggle, stop resume countdown timer
- TR Timer reset, reset timer to 3 minutes
- R: name (red)
- G: name (green)
- The logging area further down just lists the commands that the UI sees from the ESP8266 - they are there for debugging purposes, you can safely comment them out.
How does it work?
- The ESP8266 creates a WiFi access point, and provides a web page that can be accessed at http://192.168.5.1
- The ESP8266 manages the 'state' of the display, timers, score, and so on.
- When you make a change in the UI, for example to start/stop the timer, or change a score, that information is sent back to the ESP8266 which then pushes that information to all connected displays, including yours - that way everyone sees the same thing.
- The information is pushed using the Websockets protocol.