Running Around the World (Now with Arduino)

About a decade ago, while running with the Boise Area Runners, I challenged the club to (collectively) run around the world in a year. I set up a Google form where people could input their mileage then gave monthly updates about how far we’d gone. We made it back to Boise in November.

Last summer the idea of running around the world came up again when talking about the Southeast Seattle Schools Fundraising Alliance (SESSFA) Move-a-Thon. This time, another parent was voluntold to create the tracking website which gave me time to plan another event. For the final day of the Move-a-Thon we decided to hosted a jog-a-thon at Dunlap Elementary.

The event was held immediately after school so all students could attend. To connect it to the SESSFA Run Around the World Challenge, we wanted to keep track of how far we collectively ran but obviously couldn’t do that with a website. Luckily, a co-worker had a large red button on his desk that used to make funny noises when you pressed it and I had an Arduino.

We measured the course the kids would run, figured out how many laps it would take to get to different cities in and around Washington, then programmed that into the Arduino to track their progress each time someone pressed the button. Not sure how many students would attend or how far they would be willing to run, there were cities included from 12 laps (2.4 miles) to 2000 laps (400 miles).

After each lap, they would slap the big red button, pause to catch their breath, and start the next lap. We had about 35 runners participate. Some ran only one or two laps while others continued running (with only brief snack breaks) for the entire hour and managed to cover four miles. Collectively, we ran 346 laps for a total of 69.2 miles putting us well past Mt. Rainier and only 5.5 miles shy of the Canadian border and by the end of Move-a-Thon, SESSFA kids had run a total of 32,000 miles, 29% over the goal of getting around the world!

As we started cleaning up after the event, several of the longer distance runners came up to me and asked, “Can we do this again next year?” As someone who likes to run and encourage others to do the same, that may have been the highlight of my week. We can most definitely do it again next year!

Congratulations to all the Dunlap and Rainier View Elementary students who came out and ran. You did amazing!


For anyone interested in doing something similar, but unsure about Arduinos, hopefully this next section will help. If you’re never going to build one, the rest of this will probably be pretty boring.

For this project, I used an Arduino Nano. I wired the LCD screen to it just like we show here. The button was connected between digital pin 8 and a GND pin. You can modify the two arrays at the top of the code with the correct number of laps for the cities you pick. Once you upload it, every button click gets you closer to the next city. Good luck with the project and feel free to comment below, if you have questions.

/*
  Dunlap Running Lap Counter 
  Button connected to Pin 8 and GND.
  Output to 16x2 LCD
*/

#include <LiquidCrystal_I2C.h>      // LCD Library
LiquidCrystal_I2C lcd(0x27, 16, 2);     // LCD Declaration, tell the arduino we're using an LCD at I2C address 0x27, 16 column and 2 rows

const int buttonPin = 8;         // input pin for pushbutton
int previousButtonState = LOW;  // for checking the state of a pushButton
int counter = 0;                 // button push counter

// Next three variables are used for debouncing the push button
unsigned long lastDebounceTime = 0;
unsigned long delayTime = 50;
int counted = 0;

int lapsRequired[] = {12, 23, 36, 58, 102, 168, 229, 250, 375, 440, 504, 525, 620, 667, 759, 912, 1050, 1130, 1215, 1525, 1905, 2000};
char *cities[] = {"Columbia City", "Renton", "Bellevue", "Issaquah", "Tacoma", "JBLM", "Olympia", "Mt Rainier", "Canada", "Ellensburg", "Oregon", "Yakima", "Vancouver", "Portland", "Mt Hood", "Salem", "Corv/Pendleton", "Spokane", "Eugen/Pulman", "Roseburg", "California", "Boise"};

void setup() {
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT_PULLUP);

  lcd.init();               // initialize the lcd
  lcd.backlight();
  lcd.setCursor(0, 0);      // move cursor to   (0, 0)
  lcd.print("Laps: ");
  lcd.setCursor(0, 1);
  lcd.print("City: ");
}

void loop() {
  // read the pushbutton:
  int buttonState = digitalRead(buttonPin);
  // if the button state has changed,
  if (buttonState != previousButtonState) {
    lastDebounceTime = millis();
  }

  if (((millis() - lastDebounceTime) > delayTime)
      // and it's currently pressed:
      && (buttonState == LOW) && (counted == 0)) {
    // increment the button counter
    counter++;
    counted = 1;     //Flag used to only count a button push once
    for (int i = 0; i <= 21; i++) {
      if (counter == lapsRequired[i]) {
        lcd.clear();
        lcd.setCursor(0, 1);
        lcd.print("City: ");
        lcd.print(cities[i]);
      }
    }
    lcd.setCursor(0, 0);      // move cursor to   (0, 0)
    lcd.print("Laps: ");        
    lcd.print(counter);
  }

  if (((millis() - lastDebounceTime) > delayTime)
      // and it's currently pressed:
      && (buttonState == HIGH) && (counted == 1)) {
        counted = 0;
      }
  // save the current button state for comparison next time:
  previousButtonState = buttonState;
}
This entry was posted in Education, Running and tagged , , , , . Bookmark the permalink.

Leave a comment