Difference between revisions of "BOARDLOCK project"
Line 71: | Line 71: | ||
*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. | *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. | *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 | + | ===Python programmed Google Maps webpage=== |
− | After collecting the data, we were able to connect our usb flash drive to a different computer in order to display our route traveled by a heat map. | + | After collecting the data, we were then able to connect our usb flash drive to a different computer in order to display our route traveled by a heat map. |
==Presentation Slides== | ==Presentation Slides== |
Revision as of 04:09, 11 December 2018
Contents
Project Overview
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 a monitor. But wait, there's more -- each display is unique to every trip, enabling you to access how far you have traveled, your speed at any location, and the highest overall acceleration reached. In this project, our team aims to manufacture a unique transportation method of utmost quality, aesthetics, and convenience.
Weekly Log
https://classes.engineering.wustl.edu/ese205/core/index.php?title=BOARDLOCK
Team Members
- Amin Bdeir
- Isabella Zisman
- TA: Sam Hoff
Objectives
Old Objectives:
- Attach ESC to Raspberry pi
- Be able to lock board's wheels
- Use raspberry pi bluetooth capabilities to lock board wheel from cellphone
New Objectives:
- 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
Challenges
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.
New Skills
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.
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.
- This required us to learn a bit of HTML and how the static maps part of google maps API worked. One way to use google maps API is by creating a webpage and calling the google maps API in the HTML script. So we began writing this file strictly in HTML/Javascript, but we soon came to find out that it would be really difficult to pull data from my local drive (the flash drive on the mac which has data written from pi) using strictly HTML. HTML/Javascript doesn’t allow you to simply call a path to a file on your computer to a local drive. So we decided to use python, although we were not really sure how we were going to do this. We stumbled upon a video on youtube of a man writing to an html file from python. This gave us the idea to create a string in python, which would be all the code included the HTML file. In the python script we would append to the end of the string all the parts of the HTML file which needed to call to a CSV file stored in the usb flash drive. This included the information which would be used to create the lines (of different sizes and colors) which displays a heat map of the trip traveled on the raspberry pi.
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.
Other Challenges
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.
and 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.
Gantt Chart
https://classes.engineering.wustl.edu/ese205/core/images/7/7d/Ganttchartt.pdf
Designs and Solutions
Design Components
- 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
Overall Setup:
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).
Raspberry pi: Accelerometer, GPS, and button
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
After collecting the data, we were then able to connect our usb flash drive to a different computer in order to display our route traveled by a heat map.
Presentation Slides
https://docs.google.com/presentation/d/1R9UPc2ogxPKON9jxLcB9qWECYStB06nGXCuJ_GoqvfU/edit?usp=sharing
Night Light design
https://drive.google.com/open?id=14BxDPPlyi2YZkdFCk_n2jNiYaWCCQbUU
Budget
Anker PowerCore 10000 $25.49
Adafruit 16mm Illuminated Pushbutton - Blue Momentary [ADA1477] $6.09
SunFounder MPU6050 Module for Arduino and Raspberry Pi, 3-axis Gyroscope and 3-axis Accelerator $11.99
Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates - Version 3 $39.99
Raspberry pi 3B
Total: $83.56
Final Report
Designs and Solutions
Programming:
How to project GPS data onto Google Maps API? Hyperlink created
How to project Accelerometer data onto graph? X, Y, Z coordinates
How to program button to start/stop collecting data? LED light
How to extract data? Stored on USB flash drive
Wiring Connections:
F-F Configuration / Pins
Battery → Pi → button → GPS chip → Accelerometer → USB → monitor
Virtually every aspect of this project was learned from scratch...
How to:
- Parse/interpret/project data from GPS chip and Accelerometer
- Based on data collection, program button to respond accordingly
Results
On Demo Day, our team successfully met our goals, though not to the extent we originally envisioned.
Source Code and CAD files
3-D printed box:
Repository: