loading
UPDATES

INTRODUCTION

I thought it would be educational to build a prototype that I can take on the road to log, geo-tag, and time-stamp sensor data to be analyzed later with mapping and/or data analysis applications.  So I figured why not start with a gadget that can log road conditions. This prototype, the Bump-O-Meter, measures road conditions by using an Arduino, a GPS receiver, an SD card, and an accelerometer sensor.

This prototype is a generic sensor logging/geo-tagging gadget which means the accelerometer can be replaced with any other sensor(s) to log and map anything anywhere.  

As a matter or fact my next adventure with this logger is to replace the accelerometer with a pollution sensor to visualize levels of air quality around town. 

PROJECT SECTIONS

This guide is divided into the following sections:
  1. Overview & Background
  2. Hardware & Software Components
  3. Wiring the Prototype
  4. Logging data to the LC STUDIO SD Card
  5. Geo-Tagging & Time-Stamping With the LS20031 GPS Receiver
  6. Measuring Road Condition with an ADXL335 Accelerometer
  7. PROGRAM: The Arduino Program That Pulls It All Together
  8. PROGRAM: A Plain GPS Logger To Interface With Google Earth
  9. Scrubbing & Formatting Data with a Spreadsheet
  10. Plotting and Color-coding Road Condition Data with GPSvisualizer.com
  11. Formatting GPS Date/time Output For Stamping Data
  12. Speed vs. Logging Accuracy

PROJECT OVERVIEW

The Bump-O-Meter uses an Arduino to capture the X,Y,Z motion data generated by the ADXL335 accelerometer. In this case, we are measuring road "shakiness" as a result of road condition. Poor road conditions and uneven road surfaces generate lots of sudden acceleration in the car body up and down (z-axis). But before this data is saved to the SD card, it's tagged with location information from the LS20031 GPS receiver and also date/time stamped in real-time using the GPS satellites' atomic clock. More on this later.

We want to capture and analyze the z-axis acceleration information visually to determine which road stretches are poorer and need attention. We can repeat this and compare our data over time. The possibilities are endless. Not just for road condition scanning, but for any sort of environmental geo data logging.  

HOW TO USE

We can use this gadget by placing it in a car and driving over a given road stretch to assess its condition.  We can even attach this prototype to a bike or skateboard to identify irregular and rough stretches of tracks.

We can substitute the ADXL335 accelerometer sensor with any other sensor(s) such as temperature or pollution sensors with simple code modification.

The data on the SD card can then be imported it into a spreadsheet for scrubbing, sub-setting, reformatting, analysis, and visualizing.

We will also make use of a wonderful website GPSvisualizer.com to plot our data over a map using intelligent markers that change shape and color according to magnitude of road shakiness so we can visually detect road conditions in need of further inspection.

I have published a guide titled "Connect your LS20031 GPS receiver to Google Earth via PC" explaining how to configure the LS20031 GPS receiver.  You can refer to it for more details on how to use the LS20031 GPS receiver.

HARDWARE & SOFTWARE COMPONENTS

HARDWARE 
  • Arduino Uno or Leonardo*:  $25 (Arduino.cc, Seeedstudio.com)
  • LS20031 GPS receiver: $50 (Ebay, Pololu, Adafruit, Sparkfun)
  • ADXL335 or ADXL345 Accelerometer (or any other sensor): $7 (Ebay.com)
  • SN74AHC125 as level shifter from 5V to 3.3V**: $1 (Mouser.com, Futurlec.com)
  • SD reader socket. The LC STUDIO: $2.50 (Ebay.com)
  • SD memory card.  $5 for 4GB. 
  • LED: $0.1
  • Resistor 1K Ohm: $0.1
  • Breadboard: $5
  • Jumper wires: $2
  • Male headers 2.45mm (0.1") -  straight and right angle: $1 (Ebay.com)
  • Any battery or power source that can provide 7-12V and a minimum of 500mA.

* I have not tried this prototype with the Arduino Leonardo because of some known issues with the SD library . But according to the release notes of the  Arduino IDE 1.02 software these issues have been addressed.

** In the future, I am phasing out the SN74AHC125 level-shifter (5V to 3.3V converter) in favor of the CD4050BE HEX Non-Inverting Buffer/Converter simply because it's more readily and cheaply available on Ebay.com.  I purchased 10 ICs for $4.0. That's $0.4 per IC. The CD4050 is not pin compatible with the SN74AHC125 but there are plenty of examples on the net.

SOFTWARE
  • Arduino IDE 1.02 
  • MiniGPS 1.4: This is a nifty utility to configure the LS20031 GPS receiver.
  • GPSvisualizer.com: This amazing website will help us plot logged sensor data along with the GPS coordinates using color schemes to indicate road conditions.
  • MS Excel or comparable spreadsheet: We will use a spreadsheet to scrub the logged data, to remove any garbage, to make sub-selections of our logged, and to format it in a manner that can be read by other applications and websites such as GPSvisualizer.com and Google Earth.
  • SD Arduino library (bundled with Arduino IDE)

 
VIDEO OF IMPORTING/REFORMATTING LOG FILE



DISCLAIMER
This is a prototype and prototypes by definition are drafts of products not finished yet. Your feedback is appreciated.

CONTACT
Hazim Bitar (techbitar)
techbitar at gmail dot com

Step 1: Wiring the Geo-logger

WIRING THE ARDUINO

GND                   GND rail of the breadboard (usually the blue row)
5V                      To 5V VIN of the SD card
3.3V                   To the positive rail (red-lined row) of the breadboard
PIN13                 PIN5 (2A) of the SN74AHC125 IC
PIN12                 SD MISO PIN
PIN11                 PIN2 (1A) of the SN74AHC125 IC
PIN8                   LED POSITIVE
PIN4                   PIN12 (4A) of the SN74AHC125 IC
PIN1(TX)            PIN9 (3A) of the SN74AHC125 IC
PIN0(RX)            PIN TX of the LS20031 GPS Receiver
ANALOG0          PIN X of the ADXL335 (or any analog sensor output)
ANALOG1          PIN Y of the ADXL335 (or any analog sensor output)
ANALOG2          PIN Z of the ADXL335 (or any analog sensor output)
GND (bottom)    GND rail bottom of the breadboard

WIRING THE SN74AHC125 IC

PIN1 (10E)          GND rail of breadboard
PIN2 (1A)            Arduino PIN11
PIN3 (1Y)            SD MOSI PIN
PIN4 (20E)         GND rail of breadboard
PIN5 (2A)            Arduino PIN13
PIN6 (2Y)            SD SCK PIN
PIN7 GND          GND rail of breadboard
PIN9 (3A)           Arduino TX PIN1
PIN8 (3Y)            GPS RX PIN
PIN10 (30E)       GND rail of breadboard
PIN12 (4A)         Arduino PIN4
PIN11 (4Y)         SD CS PIN
PIN13 (40E)      GND rail of breadboard
PIN14 (VCC)     Arduino 3.3V pin

WIRING THE SD CARD SOCKET

GND                 GND rail of breadboard
3.3V                 No connection
5V                    Arduino 5V pin
CS                    PIN11 (4Y) of the SN74AHC125 IC
MOSI                PIN3 (1Y) of the SN74AHC125 IC
SCK                 PIN6 (2Y) of the SN74AHC125 IC
MISO               Arduino PIN12
GND                GND rail of breadboard

WIRING THE LS20031 GPS RECEIVER

GND               GND rail of breadboard
GND               GND rail of breadboard
TX                   Arduino PIN0 (RX)
RX                  PIN8 (3Y) of the SN74AHC125 IC
VCC               3.3V rail of the breadboard

WIRING THE ADXL335 ACCELEROMETER

GND               GND rail of breadboard
Z                     Arduino ANALOG2
Y                     Arduino ANALOG1
X                    Arduino ANALOG0
3.3V              3.3V rail of breadboard
ST                  No connection.
<p>Hi im just wondering whether it will able to track the location like within a room because i want to implement this in a lego track for detecting faulty track.</p><p>Can you assist me with this?</p>
<p>Can anyone help please? I am new <br>to this, and been trying to put together the project. So far I have everything <br>assembled as instructed. However, as soon as I try to verify the code, I get <br>this error:</p><p>Arduino: 1.6.5 (Windows 7), Board: &quot;Arduino/Genuino <br>Uno&quot;</p><p>C:\Program Files <br>(x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:26:17: fatal error: SPI.h: <br>No such file or directory</p><p>#include <br>&lt;SPI.h&gt;</p><p>^</p><p>compilation terminated.</p><p>Error compiling.</p><p>What do I need to do to fix this?</p>
<p>Newer versions of Arduino IDE can't find the SPI library, so you need to add them by adding the following line at the start of sketch:<br>#include &lt;SPI.h&gt;<br></p>
<p>I'm no expert but had this same problem on another project. All of the files (including the additional libraries) need to be in the right folder. The Arduino IDE seems to be a bit picky about this (on Linux at least).</p>
<p>can i have the code for storing Accelerometer ADXL335 data into SD card with time staps (say every 5 min interbal)</p><p>and how can name the stored file as a YYYYMMDDHHSS format </p>
<p>could not get code to compile</p>
<p>I made an equivalent tool in python that print real time data from ADXL345 accelerometer.</p>
<p>like</p>
<p>I made an equivalent tool in python that print real time data from ADXL345 accelerometer.</p><p><a href="https://github.com/mba7/SerialPort-RealTime-Data-Plotter" rel="nofollow">https://github.com/mba7/SerialPort-RealTime-Data-P...</a></p><p>may be it will be helpful for someone</p>
<p>I made an equivalent tool in python that print real time data from ADXL345 accelerometer.</p><p><a href="https://github.com/mba7/SerialPort-RealTime-Data-Plotter" rel="nofollow">https://github.com/mba7/SerialPort-RealTime-Data-P...</a></p><p>may be it will be helpful for someone</p>
<p>I need create a file GPS.log in SD card before do this work ? Or the file GPS.log will be created by code?</p>
<p>You can read the accelerometer more often than the GPS, so there should be no need to interpolate the accelerometer reading.</p>
<p>great</p>
<p>good</p>
<p>super</p>
<p>super</p>
<p>In this tutorial I find what I need to start interfacing the gps sensor with an Arduino. And because I want to help many more hobbyists to start building robots, I share this tutorial on my post http://www.intorobotics.com/gps-sensors-tutorials-resources/. Thank you!</p>
<p>Hello techbitar - I'm thinking of building an adaption of your project but am considering changing the SD card adapter to the microSD card shield from Sparkfun: https://www.sparkfun.com/products/9802</p>
True but not all sensors (temperature, humid, etc.) possibly used by others will be as fast as the accelerometer I am using in my project.
Hello techbitar, <br> <br>I just ordered all the hardware for this project, and I should be beginning it some time next week. I just had a question. Obviously all of these components would need to be powered up whilst in car data collecting while driving, so would one of these do the job: http://www.radioshack.com/product/index.jsp?productId=3802146 . Also, I got this for the 'in-home' programming and construction of the actual project: https://www.sparkfun.com/products/9442? ..... Do you think that'll be good as well? I would assume so.
The Arduino Uno specs are as follows: <br>Input Voltage (recommended) 7-12V <br>Input Voltage (limits) 6-20V <br> <br>As for current, I have tested my Bump-O-Meter with a USB connection which provides 5V and up to 0.5A. I did not run into any issues but I did not perform any exhaustive tests. <br> <br>While driving around in my car, I powered the Arduino Uno via the DC plug using a battery brick made of 6 X 1.2V (NiMh) = 7.2V @ 2A. That voltage is close to the minimum recommended voltage. It worked but of course the moment the battery dropped to 6V and below I am sure I would have ran into all sorts of issues. <br> <br>If I go production with this, I would use a 3S LiPo for a cool 11.1 Volts and 1.5A or 2A current for safety margin in case I need to add additional power hungry gizmos to the bump-o-meter. <br> <br>Check you choices of power supplies against the min/max voltage specs and add a comfortable margin to the current with an eye on your future plans. then decide what fits your requirements best.
I was riding my bike recently and remarked to another rider that it would be useful to quantify just how bad our roads are. My thinking is to first breadboard components as you have laid them out, and then substitute an Arduino Micro and micro SD card reader for compactness. While I like LiOn batteries, a 3S 11.1V 2 amp battery is fairly large (and heavy and needs a requisite charger). Do you have an idea for a compact battery with a 3-hour runtime?
Hello techbitar - I'm thinking of building an adaption of your project but am considering changing the SD card adapter to the microSD card shield from Sparkfun: https://www.sparkfun.com/products/9802 <br> <br>Do you see any obvious problems with this change, and would it break the code you've written? Cheers
I have not tried it but if it Sparkfun's SD adapter does not work out of the box you may need to tweak my circuit and/or code.
You can read the accelerometer more often than the GPS, so there should be no need to interpolate the accelerometer reading.
True but not all sensors (temperature, humid, etc.) possibly used by others will be as fast as the accelerometer I am using in my project.
You're welcome.

About This Instructable

159,926views

503favorites

License:

Bio: Did I unplug the solder iron?
More by techbitar:IR Remote Control Station for Android - TURN THE TV DOWN SensoDuino: Turn Your Android Phone into a Wireless Sensors Hub for Arduino Modify The HC-05 Bluetooth Module Defaults Using AT Commands 
Add instructable to: