Running Glasses

Glasses that provide pace and mileage data for runners. Uses an OLED display and a GPS/accelerometer to display pace and mileage data. Also uses an accelerometer/ tilt sensor to check for running form and posture.


Parth Anjaria

Area of Interest

Mechanical and Electrical Engineering, Computer Science


Mission San Jose High School


Incoming Senior

STEM Summer Program Palo Alto

Modification Milestone

Third and Final Milestone

For my third milestone I got the GPS (Global Positioning System) to work, and combined it with my OLED Display. GPS uses a process called trilateration to

Second Milestone

My second milestone was getting my OLED Display to work. I got it to print the three main variables I wanted: Pace, Mileage, and Posture. In terms of how one works, an OLED Display has a few main components. The one closest to you is the screen, which allows all the components to stay inside and protects them. Then, in order, come the cathode, emissive layer, conductive layer, anode, and substrate. When electricity is run through the OLED, the cathode becomes negatively charged (contains a surplus of electrons) and the anode becomes positively charged (lacks electrons). Now, the anode has “holes”, or spaces in the anode that are missing an electron in them, and in order to neutralize them the conductive layer sends them towards the emissive layer, where the electron-filled spaces from the cathode meet the electron-lacking spaces from the anode. As these “holes” become neutralized, energy is released in the form of photons, or packets of light, which is what is emitted from the display. You can then further control the color of the light by adding colored filters.

For this project, I used an Adafruit library to allow me to use the OLED and send information and commands to it. I started off by setting each pixel on separately to print the letters I wanted on the screen, but soon realized that there was a built in print command that I later used.

For my next milestone I hope to get my GPS working and showing data on the OLED!

First Milestone

My first milestone was getting my accelerometer to work. To derive data from the accelerometer, I used a library with built-in functions to refer to certain values outputted by the accelerometer and an I2C bus to provide a physical route for the data to travel from the accelerometer to the Nano, which sent the information to my computer. Then to get velocity from the acceleration, I essentially used a trapezoidal Riemann sum. I took very small intervals of time (about 5 milliseconds) and took the acceleration values at both ends of the interval. I took the average of these values and then multiplied the average by the width of the interval to get the change in velocity over that interval. Essentially, I integrated the acceleration to get the velocity.

While completing the milestone, I learned how to use libraries for accelerometers, how accelerometers work, and how to wire a Nano. I also faced three main problems: finding a library that would provide me the data with the accuracy I wanted it to, figuring out why the accelerometer wasn’t communicating properly with the Nano, and figuring out a way to remove error from the accelerometer. I achieved the first one after going through four libraries, figuring out which one gave me the most relevant data. I learned that ease of use was inversely proportional to functionality, hence I ended up using one of the more complicated libraries. There was a quick fix to solving the communication problems. Instead of using a breadboard, I soldered the components together in an effort to make sure that the current was transmitted between the two devices. To attempt to remove error in the accelerometer, I et conditional statements that would remove values if they were too small to matter in the calculations. Since I was taking a Riemann sum, these small errors could eventually add up and create much larger errors, hence it was important to perform this step. Due to this, I might switch to the GPS but for now I’ll try to get rid of that error.

Motion Alarm

I made a motion alarm for my starter project. I chose this since I thought this had the most components to it and it would be interesting to learn all of them and get associated with a variety of basic Arduino skills. The alarm would ring a piezo buzzer, light an LED, and point to the “Motion Detected” phrase on the sign if the ultrasonic sensor detected any motion at a certain distance. To do this, the sensor would emit a high-frequency sound wave, one we can’t here, and would measure the time it would take for the wave to bounce back to the sensor. Since the speed of sound is constant in our case, we can divide the time by two to find the amount of time it took for the wave to hit the object. Then, we can multiply this by the speed of sound to find the distance of the object. Using a conditional statement, we can then determine whether an object is in range and then cause the other output devices to perform their respective functions. During this project, I learned how to use the correct syntax for Arduino, how to use functions for each of the connected device, how to connect and Arduino to and use a breadboard, and learn how to program an Arduino in general. One difficulty I faced while doing the project was that the LED and the piezo buzzer kept on turning on and off when the motion alarm was activated and wouldn’t act as I expected them to. To solve this, I added a delay function which allowed for the LED to look like it was blinking and allow the buzzer to sound like an alarm by turning on and off for a longer period of time (larger delay between turning on and off and visa-versa).

Leave a Comment

Start typing and press Enter to search