Difference between revisions of "BOARDLOCK project"
|Line 104:||Line 104:|
Revision as of 01:43, 13 December 2018
- 1 Project Overview
- 2 Weekly Log
- 3 Team Members
- 4 Objectives
- 5 Challenges
- 6 Gantt Chart
- 7 Designs and Solutions
- 8 Results
- 9 Presentation Slides
- 10 Night Light design
- 11 Budget
Tired of your run-of-the-mill skateboard? Looking to upgrade it to the next level? We present to you BOARDTRACK: a slick skateboard equipped with a battery-powered Raspberry Pi, GPS chip, and accelerometer attached to its underside. Why? We're glad you asked... these small gadgets provide BOARDTRACK with the the capacity for user-friendly tracking of its location, acceleration, and average speed. Once collected, this data is displayed onto google maps in a form of a heat map. In this project, our team aims to manufacture a unique transportation method of utmost quality, aesthetics, and convenience.
- Amin Bdeir
- Isabella Zisman
- TA: Sam Hoff
- Attach ESC to Raspberry pi
- Be able to lock board's wheels
- Use raspberry pi bluetooth capabilities to lock board wheel from cellphone
- Attach a 3D-printed box to the underside of our Skateboard's deck, containing a portable battery-powered Raspberry Pi, GPS Chip, Accelerometer, and a LED pushbutton
- Set up Raspberry Pi
- Learning how the Raspberry pi and Python works
- Understand how GPS technology works
- Get GPS and Accelerometer to send data to Raspberry pi
- Program button so that we can begin and end pi program
- Program a Python Script which writes an HTML file which displays a heat map of route traveled
We anticipated our challenges to mainly be using unfamiliar technology to all group members, including programming in python, the raspberry pi, accelerometer and GPS. In addition to these being new to us, we knew that we also were going to have trouble testing the GPS, especially if we were inside. The GPS specifically caused the most trouble, and was hardest thing to deal with in our project.
Programming in python:
We learned how to program a python script to read data from a GPS chip and an accelerometer and write it to a USB flash drive.
- This required us to research online and find resources which would help us read this data. We were able to find tutorials which taught us how to call our accelerometer. Originally we were not able to set it up, but the drivers we were directed to made it easy to collect the data it was sending. We also found a youtube video which taught us how to set up our GPS, and linked us to a github which had code to a program which decoded the GPS data into coordinates, speed and other useful information. Using these resources we were easily able to write useful information sent from the Accelerometer and GPS to pi onto our USB flash drive.
How to use google maps API to plot on a map: https://classes.engineering.wustl.edu/ese205/core/index.php?title=Google_Maps_API
We struggled for a bit trying to figure out the best way to display all of this data that we were able to collect. It seemed pretty complicated, especially since we wanted to incorporate the accelerometer into it as well. The only way to display data from an accelerometer/ speed from the GPS with specific coordinate points is if we could color each point, or edit it in some way to differentiate each coordinate point so you could tell how fast you were going at that point in time. We researched about this and decided to program a script which would call google maps API in an HTML webpage. Google maps API is the simplest way to plot data with different shapes of different sizes and colors.
Pivot in our project
We lost access to our electric longboard, which was also going to use an ESC to lock the board's wheels along with powering the raspberry pi. This meant that we needed to figure out a way to carry out this project in a different direction. We decided to stop trying to lock board's wheels and using an electric longboard. Instead we used a regular, unmotorized skateboard which would be used to mount the pi and in addition, an accelerometer. We would instead power the pi using a portable battery.
Some other challenges we faced include initially testing our GPS:
- We tested the GPS a lot and didn’t get many results until Jim suggested we solder the connections of my GPS. After this we started getting some sort of data, but nothing useful in the basement. We went to a place in Jolley Hall across from Lopata, which had windows. The GPS finally worked when we put it up against a window. After this we started testing some code that we found from a pi-GPS tutorial on youtube. This code would use the information sent by the GPS and decode it in an orderly fashion, listing coordinates, speed and other useful data that the GPS collected
- We got our GPS program work, but it was still hard to program other things when our GPS had to be actively collecting data in order for us to know if our program was working. It became easier to test our project once we installed our LED pushbutton which would let you know if the program was running and would only start collecting data once pushed.
Accessing the USB flash drive when program is started through cron tab:
- When we first started testing the program on boot of the pi, the pi was booting and starting our program before it realized that there was a mounted USB flashdrive. This caused our program to not work at all, since we needed to access the data stored in the USB flash drive. In order to solve this problem we placed a 15 second sleep() call before the program called the USB flash drive.
and our Raspberry Pi completely stopped working, but luckily we had our files backed up:
- We reinstalled the Raspberry Pi OS and downloaded our backed up files. Some parts of our project did not work once we reinstalled the OS, but after enough working backwards we were able to find out that we were missing a few drivers which we did not remember to back up with the rest of our files.
Designs and Solutions
- A 3D printed box which encases: Raspberry pi, Portable battery, Accelerometer, GPS sensor, and an LED pushbutton(which is exposed in the outside of the box.)
- An HTML webpage which displays a heat map of route traveled by raspberry pi
We used a raspberry pi in order to record and store data sent from a GPS chip and an Accelerometer. The raspberry pi is wired to our accelerometer and our LED pushbutton using GPIO pins, and connected to our GPS using a USB wire. We also used a USB flash drive on our raspberry pi to be able to easily transport data to collected by our pi to other computers. By using our data collected by our pi, we are able to display the route traveled by our pi on an html webpage using google maps API. The average accelerations and speed between coordinate points are demonstrated in respect to color, and line width(line connecting 2 coordinate points) respectively.
We found useful tutorials regarding reading Accelerometer data from the GPS and Accelerometer. Through these tutorials we were able to find a program which decoded and organized the GPS data into an array, and a driver that easily set up our accelerometer. From here we needed to write the information that was read by the GPS and the accelerometer to the USB flash drive.
- In order to do this for the GPS we wrote to a CSV file on the USB flash drive every time it read information from the decoded coordinate, and speed values stored in the array.
- To do this for the Accelerometer, we did the same, but we called the accelerometer only once each time we also wrote data from the GPS sensor, in order to have an equal amount of corresponding data to each coordinate point, and to limit the accelerometer from sending too many values.
- We also programmed a button which would light up once the program started running after boot. While it's recording data, the LED turns off, and turns back on once you press it again to stop the program.
Python programmed Google Maps webpage
Inside of this python script we also created a method which could take the accelerometer data and map it to a range of colors, from minimum acceleration to maximum acceleration. This method gave us R,G,B values but what we needed to plot using google maps API was the hex format of these values, so we also had to create a method which would convert these RGB values again, into hexadecimal. We then stored these values in another array, which was called when creating each "line object."
The final result of BoardTrack is a device/program that:
- Tracks location, acceleration and speed of the raspberry pi
- Displays route traveled through Google maps API using a custom built heat map
After some last minute adjustments, everything ended up working out. Even though we did not have our connections soldered and our box printed out by demo day, we were able to get everything else wet set out to accomplish done. Our goals morphed into something different than we expected at the start, but we were able to meet our new goals. We successfully stored the GPS and Accelerometer data onto the USB flashdrive and created a program which could represent the data in a visual display which was easy to understand.
Some things which we could have done to get better results were:
- Starting the 3d print design of the box earlier on, and taking more accurate measurements doing so. Also being aware of the size limit of the 3d printer would have helped. Our original designs were too big, this slowed us down to getting it printed in time.
- Earlier on in the semester we could have worked more proactively in the parts of the projects that could be done when we were stuck on certain parts. For example, when we were stuck with the GPS, someone could have figured out how to do all of what was needed for the accelerometer in that time being.
Night Light design
Anker PowerCore 10000 $25.49
Raspberry pi 3B