The Adafruit MagTag might just contain everything that you ever wanted in an e-Ink refrigerator magnet. First, the display itself is a comfortable 2.9″ presenting a 298x128x4 grayscale image. The 4-level grayscale is an excellent design choice, allowing improved image rendering while keeping display updates at about one second (Tri-color black, white, red displays often have long update times). Above the display are four downward-lighting RGB NeoPixels that create a sort of billboard illumination effect. Below the display, mirroring the LEDs, are four buttons connected to GPIO pins. A light sensor rounds out the devices found on the front of the board.
The brains of the operation is an ESP32-S2 microcontroller. This latest iteration in the ESP line of Wi-Fi-enabled microcontrollers adds native USB support, allowing Adafruit to deploy CircuitPython to the platform. But that’s not all that’s found on the backside. There is a connector and charge controller for a LiPo battery and a convenient space to affix a battery with double-sided tape. Crammed in around that are a small speaker and a three-axis accelerometer.
Along the edge of the MagTag we find a few connectors and switches. There is a STEMMA QT connector providing power and an I2C serial connection for adding sensors and peripherals. STEMMA QT peripherals are designed to be daisy-chained from one connector and are compatible with SparkFun’s QWIIC system. There are also two “STEMMA” JST connectors providing power and access to a digital pin and an analog pin. The device is programmed or powered via a USB-C connector and there is an power switch at the top.
The MagTag is sold on its own, or as part of the MagTag Starter Kit. The starter kit includes a battery, some faceplates, and four magnetic feet that screw into four M3 standoffs on the corners of the board. It is the four magnetic feet (which can also be purchased separately from the kit) that turn the MagTag into a Wi-Fi enabled refrigerator magnet. I can’t help but think that this platform would make a great badge if only there was an easy way to attach a lanyard.
To get started with the MagTag, I first chose the Arduino IDE, following the guide from Adafruit. I used the minimum supported system of Windows 10 and Arduino IDE version 1.8. You will have to add an additional Board Manager URL to your preferences to get support in 1.8, but then you can install the board definitions for the ESP32 line of microcontrollers directly from Espressif systems. The Adafruit MagTag has its own entry in the list of ESP32-based boards. Once the board is selected in the Tools menu, you will find a nice collection of example programs under the File menu. These examples are for all of Adafruit’s ESP32-S2 boards. The guide recommends, and I concur, that you should run the WIFI->WIFIScan example. This will confirm that you are able to upload to the board, that the Wi-Fi is working and that it will find your network. The first time you upload a program to the board, you will need to hold down the ‘boot’ button on the MagTag as you turn it on, then it will show up as attached to a serial port.
While the examples demonstrate the use of essential features of the ESP32-S2, they do not show how to write to the MagTag’s display. For that, you will need to install the Adafruit EPD (e-paper display) library via the Library Manager. While you’re at it, install the Adafruit LIS3DH library so you can use the accelerometer. With those two installed, you can download the “Shipping Demo” from the guide to see how Adafruit wrote the code that comes pre-installed on the device. For a better example program, install the ArduinoJson library and then download the “Quotes Example.” This one uses both Wi-Fi and the display and does what you probably want the MagTag for: to pull information from the web and put it on the display. The code also shows how to put the ESP32 into deep sleep between updates to save battery life.
The other programming option for the MagTag is CircuitPython. Getting CircuitPython onto the board is the first step. According to Adafruit’s documentation, some later MagTags come with the UF2 bootloader installed at the factory. If double-clicking the reset button on your MagTag causes it to appear on your system as a USB drive, then you are in luck. You can drag and drop the CircuitPython .uf2 file onto the drive to install it. If not, then you will first have to use esptool.py from the command line to install the UF2 bootloader. Fortunately, you only have to do this once, and then it is drag and drop from there on out.
Once you have dropped CircuitPython onto the MagTag, a nice little “Hello World!” program runs on the display. I recommend then running the CircuitPython Internet Test on it to make sure you are connecting to your local network successfully. If this is your first time using CircuitPython, definitely go through the “Welcome to CircuitPython” walkthrough. If you are familiar with CircuitPython already, the overview of MagTag-Specific Libraries will direct you to libraries for generating QR codes for the screen, putting new fonts on the screen, as well as for controlling the NeoPixels and the speaker.
In all, the MagTag is a great entry point for getting into the Internet of Things. The guides and example programs will get you up and running in no time.
- Excellent, quick-updating display.
- Includes Wi-Fi, an accelerometer, speaker, and battery management
- Easy programming options