Wednesday, August 17, 2016

GPX Heat Maps

I have been running a lot this year. I am currently training for the Kansas City Full Marathon. I was looking for a way to Heat Map my runs and I stumbled on the solution today.

Here is a sample Heat Map of my Downtown runs.



First you will need to get your files. I use the RunKeeper app to track my runs. RunKeeper allows you to download your run files in GPX format. The website I used to build the Heat Map allows you to use GPX and other files.



  1. Download your RunKeeper GPX files, or grab your files you want to import.
  2. Go to http://umap.openstreetmap.fr/en/
  3. Click Create a Map
  4. Click the Upload data, up arrow on the right side of the screen
  5. Browse to your GPX files, or whatever format you used.
  6. Click the map settings button, little gear on the right
  7. Click Default Properties
  8. Change the opacity to .4
  9. Change the weight to 5
  10. Click the Tile Layers button (little stack of paper)
  11. Choose the background you want to use.


Tuesday, August 16, 2016

ESP8266 GPIO Read

A while back I ordered two LoLin ESP8266 modules from eBay for super cheap. Off and on I was messing around with them trying to get them to work...with not much luck. I wasted a lot of time trying to get the ESP8266s to work with the Arduino IDE for some reason.

I finally wised up and pitched the Arduino IDE idea and started using the LuaLoader. The interface is a little cludgy and old looking but man this thing app works great.



Initial Setup

  1. Download and install the LuaLoader.
  2. Fire up LuaLoader.exe
  3. Plug in your ESP8266
  4. Click the settings menu in LuaLoader. You should see Open COMX on the setup menu. The LuaLoader automatically knows which COM port you are using.
  5. You should see a Connected Response and the COM section on the Top right should be green.
  6. In the Orange section you will see a spot for your wifi details...plug in  your WIFI information
  7. Click the Get IP button
  8. BOOM, you have an IP.

Lua Script


You are now ready to start your quest to learn the .lua language. Below is a sample script. This script will start up a web server on the ESP8266 and will present some HTML. The web page will allow you to interact with an LED. Each 10s button will increase the intensity of the LED. If you click OFF it will turn the LED OFF, if you click ON it will turn the LED on 100%. If you click BLINK it will blink the LED on and off.

You will also notice that we read the GPIO Pin to determine if the LED is on or off. This will come in handy as we start to incorporate some other sensors. We can start adding Relays, Temperature sensors, Motion detectors, etc.


  1. Connect an LED to a Ground Pin and the D1 Pin on your ESP8266
  2. Open your favorite text editor
  3. Paste this code into your text editor
  4. Modify the code as needed. You will notice I am using port 85, you can use whatever port you want. Also I am loading an image from my web server. You can change that to whatever you want as well.
  5. Save your script with the name init.lua.
  6. Open up the LuaLoader interface again
  7. Click the Upload File Button on the right side
  8. Browse to your init.lua file and click open
  9. LuaLoader will upload your file.
  10. Once the upload is complete click Dofile. 
  11. Hit the IP address with the Port you specified in a web browser. 
  12. You should be able to control your LED using the web page.


So if you call the lua file init.lua, the ESP8266 will load this file on boot. This is cool because now you can find an external power source (I've been using a spare ChromeCast power brick, anything 3.3V to 5V should work) and the ESP8266 will load your program on boot. Meaning you can plug this thing in anywhere it can hit WiFi and you can start interacting with it via the web.