Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Port Arduino GPS Data Logger to Netduino


  • Please log in to reply
12 replies to this topic

#1 Bob Cravens

Bob Cravens

    Member

  • Members
  • PipPip
  • 17 posts

Posted 17 August 2010 - 04:18 AM

I recently purchased the GPS Data Logger shield from ladyada.net and an Arduino board. The assembly and programming was straight-forward. I used the out-of-the-box solution and documented everything here: http://blog.bobcrave...heArduino.aspx. I am interested in getting this shield to work with the Netduino. Please feel free to contact me at bob dot cravens at gmail dot com. Thanks in advance for any help. Bob Cravens

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 August 2010 - 04:34 AM

Hi Bob,

Thanks for the post, and welcome to the Netduino community. Let's see if we can help.

To start with, I believe what you're trying to do is:
1. Read the GPS data from the GPS receiver in its standard NMEA format
2. Save the received data to an SD card

Step #1 should be really easy...using the SerialPort class. Step #2 will be easy in about two weeks when we publish the first beta firmware for SD card use over SPI. I've tested the SD on the Adafruit Datalogger shield and it works great with 3.3V -- so I'm pretty sure that the SD on the Adafruit GPS shield will work well too. We have one here, so I'll try it for sure.

Are there any other things you'd like to do...such as parse the data for use at runtime? Or are you just wanting to manually upload the saved data (or once we have networking support, maybe send the data automatically)?

[I know that we had a bit of an offline conversation about all this...but I ask here to make sure we're all on the same page. Lots of community members have been pitching in code, so I bet we can pull some of it to help you port this project to a Netduino.]

Chris

#3 Bob Cravens

Bob Cravens

    Member

  • Members
  • PipPip
  • 17 posts

Posted 17 August 2010 - 05:20 PM

As Chris mentioned we had a bit of an offline discussion. Ultimately, I would like to be able to do the following: 1. Log GPS data to the SD card. 2. Roam onto open networks (using WiFi) and upload the SD data to a website. For example, I would like to install this device in my truck. Have it track the GPS points while I travel. When I pull into my garage, it will connect to my home network and post the data to the web. The data that I want is all included in the GPRMC sentence (timestamp, lat, long, speed, bearing). Bob

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 August 2010 - 05:42 PM

Are you just wanting the GPRMC message? Are you wanting to strip out all the other lines of data--or is it okay to save the full stream? Chris

#5 Bob Cravens

Bob Cravens

    Member

  • Members
  • PipPip
  • 17 posts

Posted 17 August 2010 - 06:02 PM

These are great questions. I am a bit naive about what is available. I was originally wanting just lat / long points. WIth the GPRMC message I got additional info and I can see that being useful as well. I may eventually want to parse out more than the GPRMC message, but I think that is a good start.

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 August 2010 - 06:25 PM

The reason I ask... You can either just read the serial data and write it out to a card (simple) or you can run it through a GPS sentence parser and then write out just the data your want...and in the specific format you want it. If the GPS sentence parser gives you all the data in the NMEA sentences, you can even write out just taht data. [Of course, you can also read in the sentences and only write them out to the SD card if they are the ones you want...and you can just write one per thirty seconds as well, etc.]

#7 Bob Cravens

Bob Cravens

    Member

  • Members
  • PipPip
  • 17 posts

Posted 17 August 2010 - 06:50 PM

Storing a all the data seems a bit wasteful of SD memory and would limit the amount of data logging between uploads (manually or wifi). The Arduino code that I was using allowed me to see the all the GPS stream. It looks like it only logged the GPRMC message. That makes sense to me. If there is additional data that I want to parse, I can always update the parser code at a later time.

#8 Bob Cravens

Bob Cravens

    Member

  • Members
  • PipPip
  • 17 posts

Posted 30 August 2010 - 09:45 PM

I have put together an initial stab at creating a GPS Shield class that encapsulates the reading / parsing of the GPS data. I saw that the .NET MF supported events and multi-threading. I attempted to put the reading of the serial port into a thread of its own. The responsibility of that thread is to read data from the gps module, collect whole lines, parse the data (if necessary) and raise events. The two events are for parsed gps data and for the raw line. The raw line allows other gps sentences to be handled externally. Of course the class could be extended to include parsing other gps lines. I found that a number of the .net framework calls that I wanted to use do not have (or don't appear to have) .net mf counter-parts. I am also feeling a bit out of my area of expertise with things like threads on the netduino hardware. I thought I would post this code to get feedback before I go much further. You will find an attached solution. I just want some reassurance that the code is not fundamentally flawed and it seem like there is probably better ways of doing some of the things. For instance, parsing the check sum string (hex) into an integer seemed overly complex. Usually, there is a string.format("x") that works, but that did not seem to be supported. Thanks for any comments. Bob

Attached Files



#9 Bob Cravens

Bob Cravens

    Member

  • Members
  • PipPip
  • 17 posts

Posted 31 August 2010 - 02:44 PM

I have put together an initial stab at creating a GPS Shield class that encapsulates the reading / parsing of the GPS data. I saw that the .NET MF supported events and multi-threading. I attempted to put the reading of the serial port into a thread of its own. The responsibility of that thread is to read data from the gps module, collect whole lines, parse the data (if necessary) and raise events. The two events are for parsed gps data and for the raw line. The raw line allows other gps sentences to be handled externally. Of course the class could be extended to include parsing other gps lines.

I found that a number of the .net framework calls that I wanted to use do not have (or don't appear to have) .net mf counter-parts. I am also feeling a bit out of my area of expertise with things like threads on the netduino hardware. I thought I would post this code to get feedback before I go much further. You will find an attached solution.

I just want some reassurance that the code is not fundamentally flawed and it seem like there is probably better ways of doing some of the things. For instance, parsing the check sum string (hex) into an integer seemed overly complex. Usually, there is a string.format("x") that works, but that did not seem to be supported.


Thanks for any comments.

Bob



In case you wander to here first....

There is a much better GPS parser here: http://forums.netdui...ated-8-26-2010/

Bob

#10 Bob Cravens

Bob Cravens

    Member

  • Members
  • PipPip
  • 17 posts

Posted 06 September 2010 - 07:55 PM

I was able to port this arduino project to the netduino using the 4.1.1 alpha 1 firmware. Here is a link to the details. http://blog.bobcrave...heNetduino.aspx Bob

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 06 September 2010 - 07:57 PM

I was able to port this arduino project to the netduino using the 4.1.1 alpha 1 firmware. Here is a link to the details.

http://blog.bobcrave...heNetduino.aspx


Nice job. We just retweeted your project.

Is that your own truck that you're tracking, by the way? Makes me want to go meet up in Wisconsin :)

#12 AMD_Fusion

AMD_Fusion

    New Member

  • Members
  • Pip
  • 7 posts

Posted 08 August 2011 - 10:44 AM

Hi, I’m trying to display GPRMC data - latitude, longitude, speed, date and time. I have connected a Netduino, 20x4 LCD and a EM-406A GPS module (not the shield) with breakout board on a breadboard. The EM-406A is always on and the red LED is flashing (locked on to satellites). EM-406A Connections: 5V to 5V GND to GND RX to D1 TX to D0 The Solution Explorer window shows: GpsDemo • GpioLcdTransferProvider.cs • ILcdTransferProvider.cs • Lcd.cs • Program.cs GpsShield • GeoDistanceCalculator.cs • GprmcParser.cs • GpsPoint.cs • Reader.cs Utilities • Math http://blog.bobcrave...g-the-netduino/ http://blog.bobcrave...g-the-netduino/ There’s an error message: The name ‘lcd’ does not exist in the current context (inside the private static void GpsShield section) Any help is welcome. Thanks in advance. Here’s the Program.cs code. using System; using System.IO; using System.IO.Ports; using System.Threading; using GpsShield; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware.Netduino; using SecretLabs.NETMF.IO; using MicroLiquidCrystal; namespace GpsDemo { public class Program { public static void Main() { var lcdProvider = new GpioLcdTransferProvider( Pins.GPIO_PIN_D12, // RS Pins.GPIO_NONE, // RW Pins.GPIO_PIN_D11, // enable Pins.GPIO_PIN_D10, // d0 Pins.GPIO_PIN_D9, // d1 Pins.GPIO_PIN_D8, // d2 Pins.GPIO_PIN_D7, // d3 Pins.GPIO_PIN_D6, // d4 Pins.GPIO_PIN_D5, // d5 Pins.GPIO_PIN_D4, // d6 Pins.GPIO_PIN_D3); // d7 var lcd = new Lcd(lcdProvider); lcd.Begin(20, 4); // Open the serial port and turn the GPS unit on. Thread.Sleep(500); // The GPS seems to need a little delay SerialPort serialPort = new SerialPort("COM1", 4800, Parity.None, 8, StopBits.One); } private static void GpsShield_GpsData(GpsPoint gpsPoint) { lcd.SetCursorPosition(0, 0); lcd.Write("time: " + gpsPoint.Timestamp + "\tLat/Lng: " + gpsPoint.Latitude + "/" + gpsPoint.Longitude); } } }

#13 Ralim

Ralim

    Member

  • Members
  • PipPip
  • 13 posts

Posted 02 November 2011 - 11:19 AM

You are missing the file : GpioLcdTransferProvider.cs from your solution...

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.