Source code and build for a miniature WMATA Metrorail train arrivals board.
- Sign up for an account at https://developer.wmata.com/signup/ and verify your email. Once you have an account, go to Products -> Default Tier and subscribe a new product in the section shown below (the name does not matter).
- You should be taken to the Profile page, where you can access your new API key. Keep this page open.
Find your station name's corresponding 3-digit code in wmata_station_codes.csv. Some stations have multiple platforms, so be sure you choose the correct platform with the lines you typically take. Keep this page open as well.
- Plug in the box. You should see a message saying
Connect to "Metrobox" to set up. If you don't see this and instead it showsConnection establishedand begins to show times for an unwanted station, follow the instructions in Resetting, then come back to this section.
You can do the following on either a phone or a computer, but it will be easier on the same computer that you performed the above steps on since you will be able to copy-paste the API key.
-
Go to where you would normally connect to a WiFi network and connect to the Access Point "Metrobox" with the password "metrobox". You will lose Internet access on this device until setup is complete, so be sure to keep the API key and station code on hand.
-
A captive portal should open. Click on "Configure WiFi" and fill in your WiFi settings, the primary API key, and the station code (notional example below).
Once you hit "Save", the box should display Connection established and begin to display arrival times. You can then reconnect back to the Internet on your device.
The box is now successfully configured and will automatically function with the same settings if unplugged and restarted.
If your box is already auto-connecting to your WiFi, you will have to reset the box in order to change stations or API keys after configuration. Upon connection, you should see a message saying Visit http://<ip_address>/reset to reset. Do this on any device that is connected to the same WiFi network and you should receive a message saying Resetting configuration.
The box should no longer auto-connect and you can follow the instructions in Configuring the Metrobox to set it up again.
To make this yourself, you will need the following (links may need updating):
- UNO R3 + WIFI ESP8266, example "UNO R3 Black"
- 3.5" TFT LCD Shield for Arduino Uno (no touchscreen), example "Without Touch"
- Micro-USB cable, optionally right-angled and the same color as the case like this example
- 3D printer or access to 3D printing services
Altogether the total cost should come out to around $15-20, depending on international trade climate and other factors.
Note: After buying parts from various AliExpress sellers I have confirmed that the 3D models may not work for all parts, as there are discrepancies in dimensions and fit between different products of the same type. Additionally, the specific products that I purchased have been taken down and are no longer available. I am thinking of how to solve this but in the meantime if you plan to purchase your own parts and replicate this project feel free to leave an issue or contact me and I can advise further.
- Install the Arduino IDE.
- Install the ESP8266 platform into Arduino IDE Boards Manager
- Add libraries WiFiManager, ArduinoJson, MCUFRIEND_kbv, and Adafruit GFX Library.
- You are now ready to begin uploading sketches to the board. To start, ensure that the UNO R3 is recognized by Arduino IDE when plugged into the computer. If not, you may need to install the CH340G drivers.
The board controls communications using a DIP switch as pictured below. You will need to use a small needle or pin to set the switches appropriately for each of the next steps.
a. With only switches 5, 6, and 7 in the "on" position, upload get_trains.ino with board type set to "Generic ESP8266 Module".
b. With only switches 3 and 4 in the "on" position, upload display_metro.ino with board type set to "Arduino UNO".
Optional: It seems that the LCD shield parts have minor variations in color display, so the line colors may not appear as expected. You can test out the screen functionality as follows - after uploading this file, with the board connected, open Serial Monitor and enter "[CONNECTED]". Wait for the screen to go black after the 10 seconds and enter "S:TEST,BL,OR,SV,RD,GR,YL". You should be able to see all possible color bars for the lines. If any seem off, you can tune the colors defined in the beginning of the file and re-upload. I use https://rgbcolorpicker.com/565 to find new values.
c. Set only switches 1 and 2 to the "on" position.
If all uploads succeeded, you are ready to move on to the assembly portion.
It seems that the LCD shield parts have minor variations in color display, so the line colors may not appear as expected. If this is the case for you, repeat step B from the previous section but with these additional steps:
- After uploading this file, with the board connected, open Serial Monitor and enter "[CONNECTED]".
- Wait for the screen to go black after the 10 seconds and enter "S:TEST,BL,OR,SV,RD,GR,YL". You should be able to see all possible color bars for the lines.
- If any seem off, you can tune the colors defined in the beginning of the file and re-upload. I use https://rgbcolorpicker.com/565 to test and create new values.
3D print files and information can be found here.
Note: After buying parts from various AliExpress sellers I have confirmed that the 3D models may not work for all parts, as there are discrepancies in dimensions and fit between different products of the same type. Additionally, the specific products that I purchased have been taken down and are no longer available. I am thinking of how to solve this but in the meantime if you plan to purchase your own parts and replicate this project feel free to leave an issue or contact me and I can advise further.
The 3D print files were created using these products:
https://www.aliexpress.us/item/3256804704287770.html (3.5 inch 480*320 TFT LCD Module Screen Display ILI9486 Controller for Arduino UNO MEGA2560 Board with/Without Touch Panel)
https://www.aliexpress.us/item/3256806674644408.html (UNO R3 Official ATMEGA16U2 / UNO+WiFi R3 MEGA328P Chip CH340G For Arduino UNO R3 Development Board WeMos ESP8266: UNO R3 Black)
- Place the UNO R3 board inside the case so that the ports line up with the holes.
- Line up the TFT shield pins with the UNO R3 and connect the two components.
- Place and snap the cover on.
The Metrobox is now complete and ready for Configuring a Ready-to-Use Metrobox.






