If this is your first time using the Feather HUZZAH ESP8266, you’ll want to begin with our guide for setting that up. There’s some software to install and a few persnickety items to be selected just right in the Arduino IDE:

Using the Feather HUZZAH ESP8266 with the Arduino IDE

To confirm that you have the driver installed and IDE properly configured, load the basic “blink” example sketch, edit the LED pin number to pin 0, then try uploading to the board. If it won’t cooperate, work carefully through each of the steps in the guide linked above.

Do not continue until you have the “blink” sketch successfully working on the Feather HUZZAH ESP8266 board.

Once the ESP8266 board is confirmed working, you’ll then need to install a few libraries. In recent versions of the Arduino IDE, this is done through the Library Manager (Sketch→Include Library→Manage Libraries…)

 Search for and install the Adafruit LED Backpack library and Adafruit GFX. If the TinyXML library is available through the Library Manager, install that too. If it’s not, you’ll need to download and install that library manually (uncompress and move folder to documents/Arduino/Libraries, then restart the Arduino IDE).

The TinyXML library already includes our NextBus Arduino sketch. If the library’s properly installed, you can access it from the rollover menus: File→Sketchbook→Libraries→TinyXML→NextBus.

Software Config

Let’s now configure the system for your personal needs. You probably have a short list of bus stops and routes that are particularly relevant from your house, office or hackerspace.

The NextBus servers use a series of special “tags” (unique identifier strings) for naming transit agencies, routes and stops. The script (in the TinyXML/examples directory) helps uncover the correct tags and outputs them in a format that’s easily copied into the Arduino sketch. requires Python to run. It’s launched from the command line:


Since it’s used just a few times for setup, isn’t very glamorous to look at…simply text-based with numeric prompts. The lists it displays are sometimes long, so it’s best run from a terminal with scroll-back capability.

You’ll be prompted for a transit agency, route numer, direction and stop. The script then spits out a line of text similar to this:

  { 0x70, "actransit", "210", "0702630" }, // To Union Landing Shopping Center

Copy and paste the resulting line (in parenthesis) into the NextBus Arduino sketch. You’ll see there’s a list of routes near the top of the program:

  { 0x70, "actransit", "210", "0702640" }, // Ohlone College
  { 0x71, "actransit", "210", "0702630" }, // Union Landing
  { 0x72, "actransit", "232", "0704440" }, // Fremont BART
  { 0x73, "actransit", "232", "0704430" }  // NewPark Mall

The first item on each line is the I2C address of the corresponding display, set with solder jumpers as described on the “Circuit” page. The formatting of these lines is very persnickety! Make sure to get all the quotes and curly-braces right.

Run again for each stop and route you want arrival times for, copying the output into this list, and editing the I2C address for each.

Next, look for these two lines near the top of the sketch, and edit them with your WiFi network name and password:

char ssid[] = "NETWORK_NAME",     // WiFi network name
     pass[] = "NETWORK_PASSWORD", // WiFi network password

Then, a few lines down, there’s this line:

#define MIN_TIME      5 // Skip arrivals sooner than this (minutes)

This is a time threshold, in minutes, below which the clock just won’t even show expected arrivals. This is on purpose and by design. I know about how long it takes me to walk to my bus stops, allowing a couple minutes’ wiggle room for varying traffic and jumps that occasionally occur in NextBus’ predictions. I do not want even the temptation of rushing for a bus that I may or may not catch…the whole point of this design was to avoid stress and accidents. So those too-soon predictions are just thrown out, depending on this value.

Upload and Test

If your board settings haven’t changed since running the “Blink” sketch, you should be able to just click “Upload” now and have the sketch transferred to the ESP8266 board. If not, go back and review the board settings described here, confirm that all three libraries (Adafruit_LEDBackpack, Adafruit_GFX and TinyXML) are correctly installed, and make sure the syntax is correct for any changes you’ve made to the NextBus sketch.

If it uploads successfully, open the Serial Monitor window to see that the board’s connecting to your wireless network and is contacting the NextBus server. If not, double-check the network name and password near the top of the code.

If you don’t have the LED Backpack displays connected yet (I’ll show this on the next page), it’s not much to look at, but the Serial Monitor at least lets us know that the networking side is good!

Do not finish assembling until you have working bus predictions showing in the Serial Monitor window.

Last updated on 2016-04-02 at 03.33.12 PM Published on 2016-04-03 at 07.19.34 PM