**All pictures and files and useful links for this project are at the end of this page
The final project I decided was on a watch that can count my steps, a fitbit like watch, or a pedometer is the official name of the actual device, I will be making. I did a lot of research on this project, to find multiple websites that could be helpful to building this project. I found one tutorial to base my project off of, from a website called robotically, but I would have to use this tutorial combined with other tutorials on this type of project to connect the device to an app called Blynk on my phone, so even though I am referencing a tutorial, it would be as if I am making my project from scratch, using different materials and boards, using my knowledge of different boards and using different codes to combine them to make a successful pedometer. A successful pedometer will be worn and have a case similar looking to a fit bit or a watch and the device itself will be able to count the steps I walk as I am walking, and be able to send that information to my phone. It is going to be hard to approach this project from scratch, trying to figure out coding that relates to my boards and how to combine the codes, but once I can figure out how each of the boards and codes connect, my project should work. It will be wireless and connect to my phone, but will be worn on my wrist and look like a fit-bit case. The main tutorial I plan to use for this project is (https://roboticadiy.com/how-to-make-your-own-pedometer-with-arduino/).
**My project ended up being completely made from scratch, not relating to this tutorial due to a setback in software and coding. It lead me to use different boards, apps, and codes.
**Troubleshoot as necessary
**Troubleshoot as necessary
I ordered my materials for my project from the primary tutorial that I will be using for my project. It included a schematic and a code and the materials that could potentially work to make my watch, step counter, so I ordered my materials to begin working on my project. I then experienced my first setback on my project, when I tried to download the app that controlled the output of values and counts the steps the person is walking. I found out that the app only works for Samsung devices, which I didn’t have, and I realized that I would have to use a different board because the bluetooth module I bought could only connect to samsung devices, so I would have to change my board to be able to connect to my phone. I then started using an Arduino Bluetooth nano.
I tested the Arduino nano bluetooth with a sample blink LED program on Arduino. I changed the speed of delay on the Blynk program to make sure it was working properly. I then downloaded light blue, an app that could be used to connect my board through bluetooth. I then soldered the Arduino nano bluetooth, and began to test the bluetooth of the board with light blue and trying to see connections, but after working with bluetooth and not having consistent results or connections, I decided that using a board to connect to wireless would potentially be more consistent and have a higher connection. Mr. Dubick introduced me to a new board called an Wemos D1 mini, which could be used to connect the board to my phone through wireless connections, rather than bluetooth, but was still small enough to eventually be worn on my wrist.
I began by researching how the pinouts of the Wemos D1 mini were similar to an Arduino Uno, and finding codes that could be helpful to test the Wemos to make sure it was working before I added more electronics. I had to download a Wemos D1 library on the arduino program for this board to run, and so I could run a simple test on it to make sure it was working.
I then soldered the pins to my wemos board to be able to place it in breadboards. After soldering the pins to the wemos board, in order to test the connection of the wemos to my phone using the Blynk program on my phone, I had to connect the wemos board to an LED to test to see if the wemos could connect and control something from my phone. I used the blinkBlynk code from basic Blynk examples and set up an LED to run through the wemos. I had to enter my authorization code and the wifi information, and it originally wouldn’t work, but the wemos was online, so there was an issue with wiring. I got the LED to blink by changing the LED legs, switching short and long legs, and I realized that the wire was going to ground and not power and I needed to change the wire to D1 on the code in order for it to talk to phone when I created a virtual pin for D1 pin on the Blynk app. I used a 330k resistor to do this, along with LEDs. I then wanted to test to see if I could control multiple things going on at once through the Blynk app, so I tried to blink 2 LEDs. It originally was not working and only 1 LED was blinking. I learned that the problem with my second led was that it was not connected to a ground, and I had the wire connected to the power, but I needed another wire to make it go to the ground that was being used for the other led, and this allowed me to blink both leds.
I then found an accelerometer compatible with the wemos D1 mini, called the LIS3DH accelerometer. I downloaded the adafruit library to Arduino for the lis3dh accelerometer to test if the new accelerometer would work with just a basic code with the wemos. I then soldered three pins on the other side of accelerometer. Then I set up the wemos with wiring connecting it to the accelerometer to be able to test to see what it does or if it can measure or count numbers with the accelerometer. I used the LIS3DH tutorials to find basic wiring with an Arduino Uno, and I tried that wiring with my wemos board. I changed the pins for the code to match the wemos board, but now it won't upload to the wemos board. I decided to go back and try to use accelerometer with normal Arduino Uno, and with the heat coming off of the accelerometer, I realized that it was fried due to a short connection. When I tried to use a new accelerometer, I realized the problem it was not working was because it was going off of an spi program that we did not have, so I commented that and uncommented line of the basic accelerometer code that defined what LIS3DH is defined as and this made values appear. I then found another major setback when I did research for measuring distance with this board. Most people did not recommend or couldn’t find the code to make accelerometers measure distance, so I realized that instead of an accelerometer, I would need a GPS to measure the initial values, and I could find code to turn latitude and longitude into distance and steps.
For my first Adafruit GPS I used, I set up a wiring with an Arduino UNO to make sure the GPS worked in the first place and could find values. After soldering pins to the GPS, the GPS ended up working and showing latitude and longitude values on the serial port. I had to order an adaptor for the GPS to have an antenna attached to it, and the adaptor I ended up ordering was not compatible with my GPS because I need a male to female adaptor, but I had a male to male adaptor. I then changed the gps wired to Arduino uno to wired to wemos, and when I tried to upload a blank document, it did not work. Blynkblink1 is the name of document I used for the blink of wemos, and it did not work with the blink code either. I then found out that the gps I was using does not have spi or I2C making it not compatible with the wemos board so spi or I2C won't communicate and boards won't work together, so I had to get the new Adafruit GPS with I2C for this project. Once I got the new gps, I did wiring for an Arduino then an Arduino and the new gps then wemos then wemos and new gps and it is now reading values off of the serial port.
I then began working on the code, which was very hard because even though there were basic codes like the blink code and simple GPS Blynk codes, I had to try to create code with haversine formula to turn longitude and latitude into steps. I used a code that had a multitude of variables building off one another to make the haversine formula, and changed the end units from meters to steps. The problem with this code is that it won't read or get a position from my gps. I tired to fix codes by breaking them down to just trying to declare the gps because that is a common problem in my code and the codes I have tried. When I did this, tiny gps was not a file or directory so I need to download it. I installed tiny gps library to try to make it work, but the code still did not work. I deleted a portion on my steps code and turned it to void loop from void setup to see if it works. I found out that the Flora I2C code works with the gps and wemos, not the tiny gps library code, to get initial code info. I also discovered that when it is raining, the GPS I have can’t read longitude and latitude values and the values just read as zeros. I then found a code off of Blynk tutorials that connect to my gps that I tested, but it said the GPS is offline which is only problem communicating to phone, but this was due to the rain. When it wasn’t raining, it connected to my phone. I also changed the code to have D2 and D1 pins instead of Arduino pins to be the pins I assigned to the virtual pin on the Blynk program so it could read values and connect to my Wemos board. It read latitude and longitude, but when I tried to combine this with the haversine formula, it did not work. The haversine formula only worked when specific values were assigned to the variables, not equations, and the codes don’t work together but I am close to having them work together.
I also created a prototype of the case I will use to hold my electronics. I measured the width and length and height of my Wemo, my GPS and a lithium battery. I then used Fusion 360, a CAD program to design the model based off of a fitbit design, where the top of the wrist watch would contain the electronics, and I put slits in the sides so a band could go through it. I made a dip in the top, so I could place the electronics later in the dip and cover them or stack them to fit in that area. My print failed 3 times as I tired to print a prototype out. I am still working on the electronics and final design of case and will continue working on this project.
In order to complete my project and fine tune it, in the second semester of this senior engineering class, I create a final case for my project, after the dimension setbacks and the failed prints, and I made the case to fit exactly the length and width of the protoboards that I soldered my wiring and electronics to, to make my project thinner and fit in a more compact case that could fit on my wrist. I used the display tool on the Blynk app to be able to see the difference in location from point to point as I walk. I also, before seeing the display values, created a code that was basic math to calculate the steps in a mile based on two longitude points, and I combined this code with the code getting my longitude and latitude values to be able to have a combined code for my project.
This project had many setbacks that were major setbacks, sending my project into new directions, and forcing me to learn new techniques in coding as well as in learning how to use different boards and connecting those boards. The first major setback I had was when I realized the tutorial I was originally using used code and boards and modules that only worked using an app for Samsung devices, which I did not have for this project, and it made my project turn from getting help from a tutorial to trying new boards and building my project from scratch and various resources. Another setback I had was the Arduino bluetooth nano not being consistent and not working with app and connecting consistently, so I had to switch to the Wemo D1 mini board. The next setback I had that was a major setback was realizing that I could not measure distance with an accelerometer through code, so I would have to switch from using an accelerometer to using a GPS. Finding the right GPS was also a setback because originally the GPS I was using did not use I2C and so it could not connect with the wemos or read the longitude and latitude values, so I had to get the new Adafruit GPS to have it connect to the wemos and read values through the serial port. The majority of the setbacks I have experienced are because of coding because the code I have to connect to the wemos and the code to calculate steps are not combining and are not working. The haversine code for the steps is not working because it is not receiving the gps longitude and latitude values, but when I try to add this code to the other code, it is still not working, and this is one setback I am continuing to work on and improve on.
What I learned in this project, mostly is that, even if it seems like you can finish a project in a few months or weeks, it will take two or three times that amount, so time management is very important, because setbacks are bound to happen. I also learned that going step by step and breaking down steps is a very important part of building a project, because when I used an arduino and then used my wemo with accelerometers and gpss, it tended to work better once I knew the basic setup. I also learned the importance of having a tutorial or a work to base your projects after, because when approaching a project without a tutorial, there leads to more inevitably and trying to figure out code, where with a tutorial, you can build off of the code the tutorial gave you and test using the given code, rather than building code from scratch.
For this project, I have learned a lot about bluetooth and wireless. Before this project, I did not know how to use bluetooth or wireless or how to connect any intelligence to my phone, and now I am able to understand the Blynk app and am able to interpret what pins and what basic codes I can use to connect different boards to my phone. I also learned there are a lot of functions and display values I can use on Blynk. I also learned about the difficulty of coding when there is not a “base” code. I have been learning more about variables and libraries that have to be defined in order to make the code work, and I have learned that just combining codes does not work because they have to be compatible and have similar functions to work, but it can still be difficult to figure out. I have also learned that some boards are compatible with each other and others are not. I did not know before that I2C would have allowed my GPS and Wemo to be compatible and show serial port values, vs another GPS, so that some modules can only work with certain applications. These skills I have learned during this project will help me moving forward with this project and others.
For this project, I will continue to work and improve it. To improve my project, I would work on the codes more to make the steps and location more clearly displayed on my phone, to make the steps obvious when counting. I will also continue to work on the design of my case, making the “dip” more, and then creating an enclosing around the electronics so they won’t be seen, making it more like a bracelet. I will also add a strap to the band, making it a complete watch/bracelet. I will continue to work on and improve my project to make it fully functioning and ready to walk around to measure my steps without showing all of the obvious electronics.
https://learn.adafruit.com/adafruit-lis3dh-triple-axis-accelerometer-breakout
https://www.instructables.com/id/How-to-Make-a-Step-Counter/
https://www.instructables.com/id/Make-your-own-activity-tracker/
https://blog.zakkemble.net/diy-digital-wristwatch/
https://github.com/zkemble/NWatch
https://www.sparkfun.com/products/11734
https://m.youtube.com/watch?v=g_Xqg6m-VI4
https://roboticadiy.com/how-to-make-your-own-pedometer-with-arduino/
https://www.arduino.cc/en/Guide/NANO33BLESense
https://m.youtube.com/watch?v=-QuQ0qIDg90
https://learn.adafruit.com/adafruit-lis3dh-triple-axis-accelerometer-breakout/arduino
https://lowellrunning.com/stepspermile/
http://www.chrobotics.com/library/accel-position-velocity
https://physics.stackexchange.com/questions/406705/calculate-distance-an-accelerometer-moved
https://arduino.stackexchange.com/questions/25529/detecting-distance-moved-by-accelerometer/25547
https://www.adafruit.com/product/746
https://learn.adafruit.com/adafruit-ultimate-gps/direct-computer-wiring
https://cdn-learn.adafruit.com/downloads/pdf/adafruit-ultimate-gps.pdf
https://learn.adafruit.com/adafruit-ultimate-gps/parsed-data-output
https://www.adafruit.com/product/4415
https://stackoverflow.com/questions/365826/calculate-distance-between-2-gps-coordinates
https://www.movable-type.co.uk/scripts/latlong.html
https://www.geodatasource.com/developers/vb
https://learn.adafruit.com/adafruit-mini-gps-pa1010d-module?view=all
https://forum.arduino.cc/index.php?topic=27541.0
https://randomnerdtutorials.com/guide-to-neo-6m-gps-module-with-arduino/
http://allaboutee.com/2012/12/03/arduino-gps-tutorial-get-latitude-and-longitude-coordinates/
https://github.com/ArduPilot/MissionPlanner/blob/master/Scripts/example3.py
https://github.com/adafruit/Adafruit_CircuitPython_GPS/blob/master/examples/gps_datalogging.py
https://forums.adafruit.com/viewtopic.php?f=19&t=33501
https://github.com/adafruit/Adafruit_GPS/tree/master/examples
https://www.movable-type.co.uk/scripts/latlong.html