TFT Sandwich

This guide shows how you can assemble and program the TFT Sandwich to function as a remote control for the Shared Game Timer.

Overview

You can allow external devices to interface with your Shared Game Timer by turning on the MQTT interface. MQTT is a messaging protocol often used by IoT (Internet of Things) devices such as LED lights, buttons etc.

In this guide, we will assemble one such device powered by a microcontroller and then program it to act as a remote control for the Shared Game Timer.

The remote will have a TFT screen (to show whose turn it is and how much time they've taken), three buttons (to do things like ending your turn), a buzzer (to play little notes when you press the buttons), an accelerometer (to enable shake detection) and a wifi module (so we can connect to the MQTT broker).

This is the first project that uses wifi and MQTT instead of the Bluetooth interface. Wifi takes more battery power and has a bit more lag than Bluetooth, but wifi will work with more micro-controllers and it doesn't require a pairing step with the Shared Game Timer every time you want to use it.

Demo

This video shows what the finished TFT Sandwich will look like when it is assembled and running the code. Basically, it is a demo of what we will get at the end of this guide!

Components

Adafruit is an awesome electronics company based in New York but they sell world-wide. Their mission is to make electronics approachable and fun. All of the electronics in this project is from them.

The components are listed below. You will also need a flush cutter and a soldering kit. See the Assembly Video for more details.

The battery listed will work for this project, but I ended up using a 500mAh battery with similar dimensions that I extracted from a disposable e-cig.

  1. ESP32-S3 Reverse TFT Feather
  2. ADXL343 + ADT7410 Sensor
  3. Small Enclosed Piezo w/Wires
  4. SPDT Slide Switch
  5. Lithium Ion Polymer Battery - 3.7v 400mAh
  6. Short Feather Male Headers
  7. Short Headers Kit for Feather (two of these!)
  8. Hook-up Wire Spool Set - 22AWG Solid Core
  9. Nylon Machine Screw and Stand-off Set (optional)
  10. Micro SMT Test Hooks (optional but useful)
  11. Alligator Clip Test Lead (optional but useful)

Assembling the TFT Sandwich

I made a step-by-step video showing the assembly of the sandwich. It will require some soldering. If you are new to soldering, I recommend checking out Adafruit's guide to soldering before getting started.

Programming the TFT Sandwich

We will be programming the TFT Sandwich using Circuit Python. There is a bit of setup to make this all work. I will assume that you know nothing about programming, and that your board is brand new.

  1. Install Circuit Python on your board by following this setup guide page. You should now have a disk drive called CIRCUITPY.
  2. Follow this guide to grab the current Circuit Python libraries. Unzip it and then copy over the following libraries to the /lib folder of your CIRCUITPY drive. In the end, you should have these installed under /lib: adafruit_register, adafruit_minimqtt, adafruit_display_text, adafruit_bitmap_font, adafruit_display_shapes, adafruit_imageload, adafruit_max1704x.mpy, adafruit_requests.mpy, adafruit_adxl34x.mpy, simpleio.mpy.
  3. Download and unzip the code at the TFT Sandwich GitHub repository to your Reverse TFT board, overwriting the code.py file (safe-copy it if you like).
  4. The settings.py file has variables that you can edit to customize how the remote works. Go ahead and play around with the variables. You can probably do this editing in any text editor, but I recommend you install the Mu Editor. See these pages for help on editing code: Installing the Mu Editor, Creating and Editing Code, Connecting to the Serial Console (if you want to see debug/error messages)
  5. The main things you will want to edit in settings.py is your wifi connection details and the MQTT details. The MQTT details should be copied from the MQTT Setup page after you've enabled the MQTT integration.

That's it! Now, the TFT Sandwich should boot up with the SGT logo showing while it loads the code, and after connecting to the MQTT broker, the game you are currently viewing on the SGT device on which you activated the MQTT integration should show up on your TFT Sandwich.

Connecting it to the Shared Game Timer

Pick a device that you will use to open a game on the Shared Game Timer, for example your phone or whatever device you are reading this on.

Go to the MQTT Setup page and ensure that the MQTT integration is switched on.

Now open the timer that you wish to control using the TFT Sandwich. It should show up as soon as the TFT Sandwich boots up.

For more information about the Shared Game Timer MQTT interface, please see the MQTT interface page.