/warbadge

ShmooCon 2018 WarBadge Games

Primary LanguagePythonMIT LicenseMIT

ShmooCon 2018 WarBadge Games

See more at warbadge.ninja

How to flash a badge

The 2018 ShmooCon badges have an ESP 8266 chip inside. If you open the case you will se an "S2" pad, which is where the reset button would normally go. You have to short this pad (a flathead screwdriver blade works well) while turning the badge on. This will put the badge in serial bootload mode.

Once the badge is in this mode you can load anything that runs on the ESP 8266 via USB serial cable. In this case, the MicroPython image via esptool.py. You will need the serial driver if you are running Mac or Windows.

Your load command on a Mac will look something like this:

esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --flash_size=detect -fm dio 0 esp8266-20171101-v1.9.3.bin

Power the badge off and back on, and connect via serial terminal (e.g. minicom, PuTTY, etc.) You will be at the MicroPython REPL and ready to the load the warbadge python program. The easiest way to do this is to wrap the files in the badge folder inside python that saves them to the badge flash. That looks something like this:

# Hit Ctrl-E to enter bulk paste mode

output = open('config.py', 'w')
output.write("""
# Paste config.py here
""")
output.close()

output = open('main.py', 'w')
output.write("""
# Paste main.py here
""")
output.close()

# Hit Ctrl-D to end bulk paste mode and to run the pasted code

If it was successful, the console will display the number of bytes written for each file. The program saved to main.py will run automatically when the badge powers up.

Power the badge off and on again, and make note of the MAC address that is printed to the console. The ShmooCon Labs team is recording MACs and handles for the leaderboard. Post-con, well, who knows how that is going to work - stay tuned.

What are all these LED colors?

You can see/set this in config.py, but here's an easy reference:

Bottom LED

Color Meaning
Blue Not connected to Wi-Fi
Green Connected to Wi-Fi

Top LED

Color Meaning
Blue Scanning for SSIDs and APs
Yellow Uploading results to warbadge.ninja
Green Successful upload
Red Error uploading

The con(test) is over, what now?

If you want to modify your badge and continue playing the game, update config.py with a new SSID and optional PSK to connect to. Set the SSID to your phone's hotspot and you'll have a roaming Wi-Fi scanning rig.

If you just want to use the MicroPython environment and your badge is flashed, hit Ctrl-C to break out of the main.py running program. The badge has two NeoPixel RGB LEDs off pin 14 in addition to the Wi-Fi capabilities of the ESP 8266 chip. Index 0 is the LED in the nose of the rocket and index 1 is the tail LED.

Have fun!