Skip to the content
2 layers190 × 75 mmAVT2022 Badge Final, the printed circuit board in 3D

AVTokyo 2022 event badge PCB, firmware and server code.

Size
190 × 75 mm
Copper layers
2
Thickness
1.6 mm
Parts
72
Nets
75
Pads
269
Tracks, vias
581, 80
Pours
4
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
9 Nov 2022
Updated
24 Nov 2022

Overview

AVT2022 Badge Final is an open-source printed circuit board by epremeaux, from the epremeaux/AVTokyo_2022_Badge repository on GitHub. It is a 2-layer board of 190 × 75 mm with 72 parts on 75 nets, routed with 581 tracks and 80 vias.

It is built around the CH340C, ESP32-WROOM-32E and SHTC3, with the DW01A, KXTJ3-1057 and LM1117MPX-3.3/NOPB-HXY among its other parts. Its parts include 26 resistors, 13 capacitors, 7 ICs, 6 switches and 5 transistors. It belongs with the lEDs and displays boards and the ESP32 boards of this library.

Main components

9

README

README.md

AVTokyo 2022 event badge

alt_text

MQTT enabled, Hacker tools, Sensors and Games on ESP32

The AVTokyo 2022 event attendee badge was designed and produced by VPCAsia. Our vision was to provide a useful tool for the attendee not only at the event, but far into the future.

It is based on an 8MB ESP32 with 280x240 pixel TFT full color display (sourced from smart watches). Additionally, it includes a joystick (4 directions plus “press to select”), two game buttons (B and A), and two sensors (Temperature/Humidity and Accelerometer). Finally, the device is fully battery powered, relying on an 18650 style Li-ion battery with associated protections and USB charging.

The software runs a variety of open source Arduino libraries. In particular, we utilized tcMenu and TFT_eSPI to provide all of our software UI, and Adafruit libraries to manage sensors and MQTT (Message Queue, Telemetry Transport).

While WiFi is connected and MQTT messaging is enabled, the badge will send Temperature, Humidity and Battery Voltage measurements to an MQTT server every 5 seconds (the interval is redefinable). Additionally, when you obtain a new best personal score on any game, the new score will be queued to be sent in the next MQTT post. While gaming, MQTT posting is temporarily disabled, in order to provide the best gaming experience.

Here is a video: Watch the intro video

Tour of the Board

Most of the badge components are self-explanatory, but I will attempt to highlight the main components and features. The circuitry between the joystick and screen is responsible for charging the battery (on the back). This is fed from the USB connector, and will charge the battery even when the badge is switched off. There are two LEDs, Standby and Charge. Once fully charged, the Charge LED will turn off and the Standby LED will light. These are rather bright! I started placing tape over my test units to dampend the brightness. ;)

Directly below the screen are the two sensors. On the right, we have an SHTC3 temperature and humidity sensor. On the left we have the KXTJ3-1057 accelerometer. Its not a particularly expensive device, so don't expect much. It's good enough for basic movement and orientation measurement. In the future, I hope to write some better drivers and filters for it to make the data more usable. At which point, I'll try to make a game using tilt/movement.

Above the power switch (bottom right) we have the battery protection circuits and voltage regulator which powers the board. The protection circuit is a very basic back to back mosfet configuration. The control IC Should cut power when the battery voltage gets below 3.2, but in my testing this turned out not to be the case. So, until I perform further tests, please dont trust this circuit to protect your battery from long term discharge. Remove the battery for storage.

Speaking of that power switch.... :( Yes, now we know it's terrible. Attendee @mimura1133 found some alternate part numbers from Digikey if you have the skills to replace the switch. EG1215AA and CUS-12TB should fit. The part used on the badge is from G-Switch, MK-12C02-GXXX. We have yet to determine if this was a case of bad quality switches, or something in the reflow oven process made some of the switch plastics brittle. While this issue seemed considerable at the time of the event, we only had 42 total switch failures (of 400). The cracked resistor on the joystick was actually a higher failure rate.

Above the screen on the left we have the USB connector and associated ESP32 programming circuitry. This consists mainly of a USB to UART interface chip (CH340) and the Enable / Boot config buttons. Under normal circumstances using USB to program the badge, you should not need to bother with the buttons. If you get into a jam though, its nice to be able to manually trigger them. Additionally, the left button (enable) can be used as a reset button, so you dont have to toggle the power switch. The USB connector can not only be used for programming but provides serial output from the ESP32 as well. There are some diagnostic messages as the badge goes through various tasks. The WiFi and Bluetooth scanners also output a lot of additional data here which cant possibly fit on the screen.

At the screen's top right corner we have a user LED and backlight control circuitry. The LED can be used for your own applications as well. We only use it to indicate the completion of the boot process (sort of a debugging tool for us).

Above the right side of the screen on the edge of the PCB we included some features for your own projects and future expansion. First, there is an I2C "Quiic" footprint. You will need to obtain and solder this yourself (was impossible at the time of production due to supply chain issues). This is a JST BM04B-SRSS connector or equivalent. To the right of the Quiic connector is a 5 pin header (2.54 mm pitch). This has ground, 3.3 volts, and three free GPIO from the ESP32. We are excited to see what you all come up with for these connections.

The back of the badge is dominated by the large 18650 lithium-ion battery holder at the bottom. Right in the middle is the ribbon cable for the screen. At top center we have the ESP32 module itself. This is an ESP32-Wroom-32 8MB part. Yes, it really IS 8MB. The firmware as flashed on the day of the event has a 4MB partition configuration. However, if you build fresh from this repository, it will build an 8Mb partition. All of our code now occupies only 20%! Lots of room left for more games, tools and custom apps. In the near future we will make some tutorials on how to add your project to the badge menu.

Fixes to the production version

The PCB production and most of the component mounting was completed by JLCPCB. However, we still had some work to do. We glued the displays to the PCB and soldering the ribbon cable to the backside ourselves. Additionally, we mounted the battery case. However, you may notice some.. urr.. "Corrections" to some parts around the joystick. Unfortunately, I (Emery) made a mistake on the fill pattern, in which two pull-up resistors did not get connected to 3.3 Volts. So, we had to scrape away some of the solder mask and solder zero ohm jumpers to connect these resistors to the 3.3 volt fill. This added a LOT of additional work. The kicad files have been corrected. So if you attempt to produce the board yourself, don't worry.

We did experience a very unusual issue during production. Thankfully, I had created this a hardware test firmware before the final code was complete, so that we could test all functions before performing final firmware flashing. This test code included the Button Test (in the tools menu) as well as the Sensors page to confirm sensors were working. The issue we found is that many (like, 1 of every 5 to 10) badges would indicate Left on the joystick, permanently. It took some time to identify the issue: The associated pull-up resistor (R8, on the left side of the joystick) was cracked. The crack is nearly impossible to see, even with a good magnifying lense. However, when we attempted to desolder it, it came off in two pieces! We were able to replace this resistor and managed to save 58 badges.

About the Server

On our server side, we used a variety of services. It all starts by receiving the MQTT message in the MQTT server. From here, messages are written to a database using some custom Java. From this database we then made web pages to output various statistics. In particular, we wanted to make a scoreboard for the two games included with the badge. alt_text

MQTT is simply a message bucket service. Many other services can subscribe to it. In fact, the code which writes to the database simply subscribes to the MQTT messages. Because this concept is so flexible, other services can easily subscribe at the same time.

Node-Red is a very user friendly GUI based data application builder. It was a simple matter to create a Node-Red flow to subscribe to badge topics using wild cards, allowing us to easily gather temperature measurements from ALL badges at once for example. This same flow outputs a web page with gauges, plots and text data. Node-Red performance is not very quick, but because it is only subscribing to topics (and another service handles database work), it has no impact on MQTT or our database. alt_text alt_text

WiFi BugHunt

WE had one more game to play at the event: a WiFi BugHunt! These consisted of an ESP32 with battery pack hidden inside the nightclub (see AVTokyo_2022_Badge/Software/AVT_FindMe_Switcher/). Using the WiFi scanner tool in the badge (or your smartphone), players could seek out the three hidden WiFi access points. Once found, there was a QR code printed on the container of the WiFi AP. Scanning the code with your smartphone would bring you to a guest book web page, where you could sign that you found the AP and leave a comment. To make it more challenging, the APs occasionally dropped AP mode and joined local WiFi to send us an MQTT message containing the battery voltage, so we could monitor the devices in real time. It was quite entertaining to see all the script attacks people tried on our guestbook page ;) alt_text alt_text

Getting the code up and running

The source code is "almost ready to run". You will need to install an editor such as Visual Studio Code. Within VSCode, add the PlatformIO extension. After opening the sourcecode folder, PlatformIO SHOULD download all the required extensions (mainly the Arduino framework and the ESP32 platform). All the required libraries are already included in the source code folder (.pio/libdeps/esp32dev/). Depending on your initial VSCode and PlatformIO configuration, you MAY need to add "lorol/LittleFS_esp32@^1.0.6" to the platform.ini file, under the "lib_deps = " heading. If during compile you receive errors concerning LittleFS, either add it to the platform.ini file, or remove it (just add ; to the beginning of the line).

Additionally, you will need to create a "secrets.h" file like so:

text
//wifi
#define SECRET_SSID "your first AP"
#define SECRET_PASS "AP1 password"

#define SECRET_SSID2 "Second AP"
#define SECRET_PASS2 "AP2 password"

#define SECRET_SSID3 "third AP"
#define SECRET_PASS3 "AP3 password"

//mqtt
#define SECRET_SERVER "MQTT URL or IP" 

You can add as many WiFi access points as you want. Look at the MyWiFi.cpp file to add them to the array. The badge will first try to connect to whatever AP you have saved manually from the menu system. If that connection fails, it will then scan through the list given at the top of MyWiFi.cpp (the list is filled in from the secrets.h file). It will try to match any of these AP names to a scanned list available. If one matches, it will try to connect.

In addition to WiFi, you may want to point the badge to your own MQTT server. You may enter it manually in the menu, but you may prefer to hard code it. We have only defined the SECRET_SERVER keyword in the secrets.h file. This assumes an unsecured connection. So, you may want to modify MQTT_Sensors.cpp and secrets.h such that you can define a username and access key in secrets.h.

UPDATE (22/11/24):

While experimenting with some badges, I found that SOME badges have 4MB ESP32 modules, and some have 8MB modules. Of course, we ORDERED 8MB modules. If you are attempting to compile and run this code and the following effects happen (after upload and reset), you likely have a 4MB module:

  • red LED at the top right corner of the screen remains dimly light
  • nothing displayed on screen
  • when using the terminal, you see that the ESP is rapidly rebooting, with the following output:
text
rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
ets Jul 29 2019 12:21:46

PlatformIO is building an image set larger than the size of the flash storage area. However, it cannot by itself, verify the size. All the checksums are fine. You can confirm the size of your ESP's flash area yourself though. Look in the upload task terminal. When you hit the compile button (check mark on the bottom of VSCode window), one of hte first few lines will read: HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash OR HARDWARE: ESP32 240MHz, 320KB RAM, 8MB Flash

IF you were unlucky enough to get a 4MB module, we are so sorry.. but we cant control unscrupulous suppliers *( What to do: in the platformio.ini file, find the line which reads:

text
board_build.partitions = AVT_8MB_huge.csv

Change it to read:

text
board_build.partitions = huge_app.csv

This will use a standard partition table for a 4MB ESP32, where most of the space is devoted to a single app, plus bootloader. The base AVT code will occupy 51.5%, still leaving plenty of space for future enhancements. By the way, this partition table is the one used in all of the badges on the day of the event. This is why I did not notice that we had a mix of 4MB and 8MB modules. So, I dont know yet what the statistics are on how many of you have each type.

Parts

72
QtyValueFootprintReferences
91KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR7, R8, R10, R14, R16, R17, R20, R21, R23
70.1uFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC2, C3, C4, C6, C8, C10, C11
410uFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC7, C9, C12, C13
412KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1, R3, R4, R5
3120Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR12, R13, R24
3BC817Package_TO_SOT_SMD:SOT-23Q1, Q2, Q5
210KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR19, R25
22KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR9, R11
2470Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR2, R6
2AO3400APackage_TO_SOT_SMD:SOT-23Q3, Q4
2MOMENTARY-SWITCH-SPST-2-SMD-5.2MMdigikey-footprints:Switch_Tactile_SMD_6x6mmS3, S4
110Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR18
1100Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR22
118650Battery:BatteryHolder_Keystone_1042_1x18650BT1
11uFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC5
122uFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC1
130KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR26
13KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR15
1BOOTButton_Switch_SMD:SW_Push_1P1T_NO_CK_KMR2S2
1CH340CPackage_SO:SOIC-16_3.9x9.9mm_P1.27mmU1
1Conn_01x05Connector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_VerticalJ1
1DW01APackage_TO_SOT_SMD:SOT-23-6U4
1ENButton_Switch_SMD:SW_Push_1P1T_NO_CK_KMR2S1
1ESP32-WROOM-32EVPC-Asia:ESP32-WROOM-32EU2
1KXTJ3-1057Package_LGA:Kionix_LGA-12_2x2mm_P0.5mm_LayoutBorder2x4yU7
1LED BlueLED_SMD:LED_0805_2012MetricD2
1LED GreenLED_SMD:LED_0805_2012MetricD1
1LED RedLED_SMD:LED_0805_2012MetricD3
1LM1117MPX-3_3_NOPBdigikey-footprints:SOT-223U5
1LOGOAVTokyo:2022G***
1LOGOAVTokyo:Invader_high_mediumG***
1LOGOAVTokyo:Invader_low_mediumG***
1LOGOAVTokyo:AVTOKYO txt 60x20G***
1LOGOAVTokyo:Invader_main_bigG***
1LOGOAVTokyo:VPCAsia_35x33G***
1LOGOAVTokyo:NDNH 95x5G***
1QuiicConnector_JST:JST_SH_BM04B-SRSS-TB_1x04-1MP_P1.00mm_VerticalJ3
1SHTC3Sensor_Humidity:Sensirion_DFN-4-1EP_2x2mm_P1mm_EP0.7x1.6mmU6
1SW_SPDTAVTokyo:MK-12C02-Gxxx SPDT SMD switchSW2
1TFT_240x280_raw_LH169I-IG01AVTokyo:TFT_240x280_raw_LH169I-IG01_BackSideMountTFT1
1TP4056Package_SO:TI_SO-PowerPAD-8U3
1USB_B_MicroConnector_USB:USB_Micro-AB_Molex_47590-0001J2
1navigation_switch_K1-1506SN-01AVTokyo:K1-1506SN-01SW1

Similar boards

  • 2 layers30.6 × 37.4 mmGlowBandSmall, the printed circuit board in 3D

    GlowBandSmall

    LEDs-by-glowingkitty/GlowBand

    GlowBand is an exciting LED wristband. For dancing at parties and festivals, for long-time exposure photography, and for everyday situations that need some light.

    52 parts4MIT
  • 2 layers35 × 100 mmWalkieTalkie, the printed circuit board in 3D

    WalkieTalkie

    GuzziFlipFlops/ESP32-Walkie-Talkie

    An open source ESPNOW based walkie talkie with a 600 meter tested distance, with an OLED and multiple buttons to interact with

    66 parts7MIT
  • 2 layers68.2 × 84.2 mmVAPE0F, the printed circuit board in 3D

    VAPE0F

    malikkelly8/ECE445-FADEX

    Notebook for Malik Kelly to keep track of progress in ECE 445. Also a way for the rest of the FadeX staff to see progress.

    38 parts
  • 4 layersSim7070, the printed circuit board in 3D

    Sim7070

    onomondo/getting-started

    Onomondo Getting Started development kit. Board design files and firmware.

    96 parts7
  • 2 layers76.8 × 100 mmProject CV, the printed circuit board in 3D

    Project CV

    KazimGL/ESP32-PowerIoT-DevBoard

    ESP32 battery-powered IoT dev board with Li-ion charging, protection, and sensor support — designed in KiCad

    62 parts
  • 2 layers75.4 × 36.4 mmMeterSchPcb kicad, the printed circuit board in 3D

    MeterSchPcb kicad

    Oluwaseunemme/ESP32-BLE-Multi-Meter

    A custom ESP32-based digital multimeter capable of measuring DC voltage, resistance, continuity, diode forward voltage, and capacitance, with measurement results transmitted wirelessly to a Flutter mobile application…

    77 parts
  • 2 layers61.3 × 63.3 mmMonitoring Gunung, the printed circuit board in 3D

    Monitoring Gunung

    rafdi03/PCB_Desain

    Schematic PCB Project

    50 parts
  • 2 layers52.5 × 28 mmKitchen timer, the printed circuit board in 3D

    Kitchen timer

    hggh/kitchen-timer

    kitchen timer

    35 parts16GPL-3.0

Questions

How big is the AVT2022 Badge Final PCB?

It measures 190 × 75 mm and has 2 copper layers, 1.6 mm thick.

What parts does the AVT2022 Badge Final use?

72 parts, built around the CH340C, ESP32-WROOM-32E, SHTC3 and DW01A. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the AVT2022 Badge Final KiCad files?

From the epremeaux/AVTokyo_2022_Badge repository on GitHub, at the commit this page was made from: the board is Kicad/AVT2022 Badge Final/AVT2022 Badge Final.kicad_pcb and its schematic Kicad/AVT2022 Badge Final/AVT2022 Badge Final.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the AVT2022 Badge Final design in my own project?

Its repository states no licence, so its author keeps all rights: ask epremeaux before reusing the design.