0

GIS Project - GPS Data Logger & Lots of Sensors.
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

GIS Project - GPS Data Logger & Lots of Sensors.

by 1chicagodave on Thu Oct 17, 2013 10:35 am

Need some general advice/suggestions.

*Edit (to put question up top).
What would be the "best" (recommended) way to connect 3-4 analog sensors to an UNO with the Ultimate GPS Data Log Shield to keep everything running smooth, reliable, and modular? One of the sensors will be a microphone to record relative sound/noise levels. External ADC? A second micro controller?

The rest of the story —
I'm getting certified in GIS (Geographic Information Systems), which is very basically making & using maps with geo-referenced data to (hopefully) solve problems. (Highly simplified paraphrasing...)

I have already built a simple standalone GPS data logger with an UNO, Ultimate GPS SHIELD, RGB LCD, and the Adafruit Arduino Project Case. Unfortunately, I let that information slip to my instructor. So....now, instead of just downloading from the plethora of GIS info available online for my final project, she 'encouraged' me to use my GPS to collect my own data. :shock:

After scrambling for ideas over the past week, I think I have something. My plan is to connect a number of environmental sensors to my data logger, strap it to my back, and ride my bicycle around downtown Chicago for a few hours in the morning, afternoon, evening, and middle of the night collecting data (of cores, following the same path every time...). The sensor types I'm thinking of include (at least) a microphone (from Adafruit), a dust/particulate sensor, and at least one gas sensor (CO, O2, or similar which could imply air quality). Then, download traffic data for the corresponding time frames...and get to work mapping out the correlations between traffic density, time of day, and "pollution" levels using ArcGIS.

Finally, my question....
What would be a few "best" options for connecting the sensors to the UNO inside my data logger? I don't want to overload it with too much analog data. I don't need a very high refresh rate for my GPS; I'm thinking less than 1Hz would be adequate. I would like to be able to easily connect & disconnect the "sensor pack" from the data logger too.

So far, my ideas are as follows...
Connecting all sensors to an external ADC, and running the output of that ADC into the UNO. Or, maybe using an Arduino Micro (or similar) to collect the sensor data, convert to digital, then send that to UNO. Or, possibly even an external ADC to an Arduino Micro then to UNO...? The microphone is one of my largest concerns right now too. I'm thinking that might need it's own processor? I have previously built the Tiny Music Visualizer on the learning center & think I may just hack that up into an audio level (aka: "noise pollution") sensor for this project - I used a Micro for that one.

So....
Thoughts? Suggestions? General advice or good examples to reference? I have a few more months to produce my final output, but I would like to start building, coding....and debugging....ASAP. Budget isn't a huge issue. Reliability and ease of use/mobility is a priority. Any direction would be awesome.

Thank you!

**(If this project goes well, I'm considering my project for the spring might include building an autonomous "water drone" to map out the Chicago River.)
Please forgive my hyperanthropomorphization.
Every answer reveals new questions.
And, yes... there's always a better way to 'do that'.
1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am
Location: Chicago

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by adafruit_support_mike on Thu Oct 17, 2013 5:26 pm

One solution would be to use sensors that speak I2C or SPI. Both those protocols are designed for modularity and expansion. The microcontroller only sees one data bus, and communicating with specific devices is just a matter of setting the right SELECT pin or sending the right address.

The other solution would be to have separate pins for each sensor. That keeps each device's code independent of all the others.

The thing you *don't* want to do is share pins between devices, except for cases like SPI and I2C where the devices know how to stay out of each other's way. Sharing resources requires a strategy to keep the clients from tripping over each other, and is a reliable source of annoying bugs.

There's another very recent option you can use too: use a Trinket to control each of your sensors. Every Trinket has a built-in ADC if you need to work with analog sensors, and can handle the communication with a digital sensor if you need that. The benefit there is that you can make each Trinket-sensor generate exactly the kind of information you want to log, then send it to the central logging device in a common format.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

adafruit_support_mike
 
Posts: 58474
Joined: Thu Feb 11, 2010 2:51 pm

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by 1chicagodave on Fri Oct 18, 2013 3:27 am

Thanks for the quick response!

adafruit_support_mike wrote:
The thing you *don't* want to do is share pins between devices, except for cases like SPI and I2C where the devices know how to stay out of each other's way. Sharing resources requires a strategy to keep the clients from tripping over each other, and is a reliable source of annoying bugs.


That's pretty much what I was thinking about, and why I'm leaning towards keeping all Analog to Digital conversion off of the main micro controller. It's already parsing the GPS, talking to the LCD (over I2C), and writing to the SD card. I'd like to keep any extra work to a minimum. Also, I haven't experienced it personally, but have read plenty about interference (for lack of a better word) when running separate analog to digital conversions close together on the same Arduino.

...use a Trinket to control each of your sensors. Every Trinket has a built-in ADC if you need to work with analog sensors, and can handle the communication with a digital sensor if you need that.


I like that idea a lot; having them all completely self-contained and isolated. The only other option I was really looking at was this (http://www.adafruit.com/products/1083). But, since the Trinket actually costs less, I don't need the extra resolution, and I already have a couple of them sitting around to get started with.... 8)
I think I'll only need to write new data to the SD card about every 5-10 seconds, so I can also build some 'smoothing' into the code on each Trinket to minimize stray/erratic readings from being recorded.

Nice. Thanks again!

....I had better get some extra credit for this project!
Please forgive my hyperanthropomorphization.
Every answer reveals new questions.
And, yes... there's always a better way to 'do that'.
1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am
Location: Chicago

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by adafruit_support_mike on Fri Oct 18, 2013 1:24 pm

1chicagodave wrote:....I had better get some extra credit for this project!

*laugh*

Once you get it working, you could start a little side-business doing data collection for your classmates. ;-)
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

adafruit_support_mike
 
Posts: 58474
Joined: Thu Feb 11, 2010 2:51 pm

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by 1chicagodave on Wed Dec 04, 2013 8:07 am

Well....I think I finally have the hardware about finished. Little testing & adjusting I'm sure is in my future. But, wanted to post photos of what I'm dubbing my "Box of Trinkets".

One board/Trinket each for running & reading a separate sensor (*sensors not shown).
- Microphone (recording ambient sound levels)
- MQ-7 CO sensor (alternating voltage between 5V & 1.4V....)
- Sharp Airborne Dust/Particulate sensor (sending a precisely timed pulse to sensor & reading at same time)
One last protoboard to interface with my cable...which then sends it all back to my UNO over I2C to log it to SD, along with GPS data. Good times.
image.jpg
image.jpg (256.54 KiB) Viewed 1014 times

image.jpg
image.jpg (370.32 KiB) Viewed 1014 times

image.jpg
image.jpg (271.76 KiB) Viewed 1014 times


I need to have all data collected & presented next week. At some point after that (and after I finally get some sleep) I'll try to put together something describing the whole project.


Thanks for all the help so far!
Please forgive my hyperanthropomorphization.
Every answer reveals new questions.
And, yes... there's always a better way to 'do that'.
1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am
Location: Chicago

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by adafruit_support_bill on Wed Dec 04, 2013 8:21 am

Nice looking system you put together there. Congratulations! What kind of protocol are you using to send data from the Trinkets up to the Arduino?

adafruit_support_bill
 
Posts: 74058
Joined: Sat Feb 07, 2009 10:11 am

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by 1chicagodave on Wed Dec 04, 2013 11:59 am

I2C, using TinyWireS library and a few custom functions to split sensor readings into individual bytes for sending.
(…it worked on the breadboard. Fingers crossed!)
Please forgive my hyperanthropomorphization.
Every answer reveals new questions.
And, yes... there's always a better way to 'do that'.
1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am
Location: Chicago

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by 1chicagodave on Wed Dec 04, 2013 12:11 pm

While I've got you….

Last major piece of the puzzle -

Using the simple example "shield_sdlog" sketch from the GPS library, how should I amend the string being written to the SD card to include a few more values?

To give us some code to look at, I'm thinking it's near this part…?
Code: Select all | TOGGLE FULL SIZE
    // Rad. lets log it!
    Serial.println("Log");
   
    char *stringptr = GPS.lastNMEA();
    uint8_t stringsize = strlen(stringptr);
    if (stringsize != logfile.write((uint8_t *)stringptr, stringsize))    //write the string to the SD file
      error(4);
    if (strstr(stringptr, "RMC"))   logfile.flush();
    Serial.println();



Let's say the values are "Val1" & "Val2", both integers, and I wanted to tag them on to the end of the comma separated string already being written. What do I need to add/change?

Thanks!
Please forgive my hyperanthropomorphization.
Every answer reveals new questions.
And, yes... there's always a better way to 'do that'.
1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am
Location: Chicago

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by adafruit_support_bill on Wed Dec 04, 2013 2:04 pm

It's been awhile since I looked in the GPS library, but I'm pretty sure it adds a newline to the end of the string. To tack your extra values on the end you need to get rid of that.

Since this is a 'C' style string, you should be able to just null out the last character in the string (the newline). Then you can print it to the file as done now, followed by your added variables - with a comma in between.

Code: Select all | TOGGLE FULL SIZE
logfile.write(Val1);
logfile.write(",");
logfile.writeln(Val2);

adafruit_support_bill
 
Posts: 74058
Joined: Sat Feb 07, 2009 10:11 am

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by 1chicagodave on Sat Dec 07, 2013 3:01 pm

Thanks. Got it working.....sorta.

With Arduino UNO & this setup, I can now-
- get sensor values from the Trinkets and GPS shield
- log the sensor data to the SD card
- log the GPS data to the SD card
- not do all of the above within the same sketch :(

Pretty sure I'm running out of SRAM. If I'm correct, I'm about .5k short of what I need.
So....on my way to buy an overpriced Leonardo (from local store) to swap in.
Please forgive my hyperanthropomorphization.
Every answer reveals new questions.
And, yes... there's always a better way to 'do that'.
1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am
Location: Chicago

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by 1chicagodave on Wed Dec 18, 2013 6:13 am

Ok, got some quick results to show. Good news...it worked!
Bad news, it was so cold I ended up mounting the sensor box onto my sunroof (which I had to keep open halfway...during a snow storm). So, the audio levels pretty exactly matched the speed of my engine; that data is useless...but still, it worked. :D

All I ended up using for this video was my speed, CO levels, and real-time traffic congestion data.
This video may not be ground-breaking or even very useful for anything other than showing what I can do. But then, that was sort of the point! 8)

Enjoy, and thanks again for all the help!

http://youtu.be/MPorzUdBdCI
Please forgive my hyperanthropomorphization.
Every answer reveals new questions.
And, yes... there's always a better way to 'do that'.
1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am
Location: Chicago

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by adafruit_support_bill on Wed Dec 18, 2013 7:48 am

Nice work! :D

adafruit_support_bill
 
Posts: 74058
Joined: Sat Feb 07, 2009 10:11 am

Re: GIS Project - GPS Data Logger & Lots of Sensors.

by davidescola on Tue May 16, 2017 5:01 am

Hi Dave,

We are 3 university students from Germany working on an environmental monitoring project using arduino. We have a few questions regarding how to create georeferenced data and how to sync the georefenced data with our measured values (we plan on using environmental sensors to evaluate air quality in a small region, our sensors will be mounted on a bicycle)
We'd love any help you could give us!

davidescola
 
Posts: 1
Joined: Tue May 16, 2017 3:46 am

Please be positive and constructive with your questions and comments.