Netduino home hardware projects downloads community

Jump to content


Photo

Yet another supported shield question (GPS)


  • Please log in to reply
22 replies to this topic

#1 remotewizard

remotewizard

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 06 August 2010 - 07:04 PM

Any thoughts as to whether I can use a SparkFun GPS shield and receiver (GPS-09817 / EM-406A ) with the Netduino/Net MicroFramework? Amazon reports my Netduino is in transit - I can hardly wait! Thanks for offering such a nifty product.

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 06 August 2010 - 09:12 PM

Any thoughts as to whether I can use a SparkFun GPS shield and receiver (GPS-09817 / EM-406A ) with the Netduino/Net MicroFramework?

Amazon reports my Netduino is in transit - I can hardly wait!

Thanks for offering such a nifty product.


Thanks for your contagious enthusiasm!

We have an Adafruit GPS Log Shield Kit (v1.1) here that we're testing with the EM-406A. We'll test it out by Monday and report our results back on this thread. If it supports 3V3 signals alright, we'll get one of the SparkFun shields to test as well.

Chris

#3 remotewizard

remotewizard

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 09 August 2010 - 12:08 PM

And thank you for the prompt response! I'll watch for your results later today.

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 August 2010 - 06:20 AM

And thank you for the prompt response! I'll watch for your results later today.


remotewizard,

We tested the Adafruit GPS logger shield and it worked great. We're getting GPS data via the serial port (you can use either one). You need to create an OutputPort for the "power pin" and set it to false (0V). Then simply read the data from the GPS receiver module. We'll create some sample code for it in the near future and post it on our site, perhaps as a tutorial or project.

We've also ordered a Sparkun GPS shield to test (GPS-09817). It should arrive within about a week.

The SD card on the back of the Adafruit GPS logger shield may work with the upcoming Netduino v4.1.1 firmware as well (when we enable the FAT16/FAT32 and SD card file system support). We haven't tested this feature of the GPS logger shield, but we have tested the Adafruit MicroSD breakout board and the Adafruit data logger shield and the SD worked great on both of those.

So now what are you going to build as your first geo-location project?!?

Chris

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 August 2010 - 06:36 AM

P.S.

Here's some very rough test code I put together to make sure we were getting data from the GPS receiver. You might want to put this in an event handler-based class which parsed the data out and raised events whenever a new location was received.

But this will show you your GPS data stream :) I've put a 100ms delay in between each iteration of the loop so that we're not getting and printing one byte of data at a time.

I plugged TX, RX, and PWR into pins D0, D1, and D2. This corresponds to serial port 1 (COM1) and a "powerpin" of D2.

using System;
using System.IO.Ports;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace GpsLogger
{
    public class Program
    {
        public static void Main()
        {
            // write your code here
            SerialPort serialPort = new SerialPort("COM1", 4800, Parity.None, 8, StopBits.One);
            serialPort.Open();

            // pin D2 off = gps module turned on
            OutputPort powerPin = new OutputPort(Pins.GPIO_PIN_D2, false);

            while (true)
            {
                int bytesToRead = serialPort.BytesToRead;
                if (bytesToRead > 0)
                {
                    // get the waiting data
                    byte[] buffer = new byte[bytesToRead];
                    serialPort.Read(buffer, 0, buffer.Length);
                    // print out our received data
                    Debug.Print(new String(System.Text.Encoding.UTF8.GetChars(buffer)));
                }

                Thread.Sleep(100); // wait a bit so we get a few bytes at a time...
            }
        }
    }
}


#6 remotewizard

remotewizard

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 10 August 2010 - 12:31 PM

I'd like to start out with something simple: a box I can plug into my cigarette lighter (excuse me: auxiliary power connector) and log my route/mileage information (for tax purposes) when I visit clients. A portable device with a cigarette lighter plug could be quickly moved from car to car, so I could use it no matter what I was driving. Ideally, it would have Bluetooth/WiFi support, to facilitate dumping the data to my home PC. Eventually, I’d like to build a more permanent car computer that ties into OBD-II connector (something like http://www.practical...emetry-platform). Mostly, it's all just an excuse to have some fun with the Netduino.

#7 JonnyBritish

JonnyBritish

    New Member

  • Members
  • Pip
  • 6 posts

Posted 10 August 2010 - 02:17 PM

If you can add SD card support, an LCD and a few buttons to do Next, Previous and Select, you can build a geocaching tool where you load the coordinates of your next geocaching hunting trip. but then... if you can add a gps unit to netduino and an ethernet shield...well then you can write your own ntp server! wow the mind boggles at what you can build once you get into this arduino / netduino thing :D

#8 Patrick

Patrick

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationTampa

Posted 11 August 2010 - 01:23 AM

Hey all.

My netduino just arrived and I gotta say I'm pretty excited.

I decided to try out the GPS integration as a starter project but I can't seem to get the SerialPort class to resolve.
using System.IO.Ports;
...
SerialPort serialPort = new SerialPort("COM1", 4800, Parity.None, 8, StopBits.One);
I get the old:

The type or namespace name 'SerialPort' could not be found (are you missing a using directive or an assembly reference?)

like I'm missing a reference but I'm quite certain that I'm not. Do I have a .Net (not micro) compatibility issue?

Patrick

#9 RedHermit

RedHermit

    Member

  • Members
  • PipPip
  • 14 posts
  • LocationColorado

Posted 11 August 2010 - 01:30 AM

I could be mistaken, but I think the SerialPort class is in the Microsoft.SPOT.Hardware namespace for .NET MF.

#10 Patrick

Patrick

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationTampa

Posted 11 August 2010 - 01:36 AM

I could be mistaken, but I think the SerialPort class is in the Microsoft.SPOT.Hardware namespace for .NET MF.

Not that I can see...

EDIT: It seems that RedHermit was correct.

.Net Micro framework 4.0 and greater has the SerialPort class in the Microsoft.SPOT.Hardware.SerialPort namespace. Had to add the reference and using.

Thanks!

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 August 2010 - 02:28 AM

...like I'm missing a reference but I'm quite certain that I'm not. Do I have a .Net (not micro) compatibility issue?


Good question. We'll be sure to cover this in a tutorial.

Here's what you need to do:
* Click on the Project menu > Add References...
* Click on the first tab (.NET) if it is not already selected
* Select the "Microsoft.SPOT.Hardware.SerialPort" assembly.
* Press OK

That's it! You just needed the SerialPort support assembly in your project.

Does that work for you?

Chris

EDIT: You answered your own question while I was typing this :) Good deal.

#12 José Ángel

José Ángel

    Advanced Member

  • Members
  • PipPipPip
  • 39 posts
  • LocationSpain

Posted 11 August 2010 - 12:09 PM

The SerialPort class is in the Microsoft.SPOT.Hardware.SerialPort because the implementation that the .net mf team did, is not the same that the full .net Framework. They use the Microsoft.SPOT namespace to host the classes from the .Net Framework that are different in the .net MF

#13 Patrick

Patrick

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationTampa

Posted 11 August 2010 - 01:27 PM

Thanks for all the responses; it's nice to see an active forum for such a young device. The GPS is working perfectly now and I plan on posting some code for an NMEA interpreter once I get it finished up.

#14 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 August 2010 - 03:24 PM

Thanks for all the responses; it's nice to see an active forum for such a young device.

The GPS is working perfectly now and I plan on posting some code for an NMEA interpreter once I get it finished up.


The members of this community are pretty terrific.

Awesome news on the GPS... I'm looking forward to seeing what you build with it.

#15 greg

greg

    Advanced Member

  • Members
  • PipPipPip
  • 169 posts
  • LocationChicago, IL

Posted 19 August 2010 - 03:07 AM

I can confirm that the SparkFun GPS Shield works like a charm. Attached is a picture of my netduino with the shield outputting raw GPS data to the LCD. -Greg PS: It was taken with my cell phone so sorry if it's not super sharp! :) I was excited!

Attached Files



#16 MattW

MattW

    Member

  • Members
  • PipPip
  • 23 posts

Posted 30 August 2010 - 02:42 AM

Congrats! Great pic too. :) I'm looking into doing something like this - Eventually.. :)

#17 Maddawg2012

Maddawg2012

    New Member

  • Members
  • Pip
  • 5 posts

Posted 19 April 2012 - 06:35 PM

Good question. We'll be sure to cover this in a tutorial.

Here's what you need to do:
* Click on the Project menu > Add References...
* Click on the first tab (.NET) if it is not already selected
* Select the "Microsoft.SPOT.Hardware.SerialPort" assembly.
* Press OK

That's it! You just needed the SerialPort support assembly in your project.


Chris,

Sorry to jump in on this thread, but tryign to follow this example and add the SerialPort assemply, and in following your above, there is no .NET lisitings at all in the Refrences window. What am I missing?

Thanks,

Maddawg

#18 Maddawg2012

Maddawg2012

    New Member

  • Members
  • Pip
  • 5 posts

Posted 19 April 2012 - 06:39 PM

Nevermind, I found how to add the reference from the Soution Expolorer method. Sorry to bug everytone. Thnaks, MadDawg

#19 Maddawg2012

Maddawg2012

    New Member

  • Members
  • Pip
  • 5 posts

Posted 20 April 2012 - 05:46 PM

Nevermind, I found how to add the reference from the Soution Expolorer method. Sorry to bug everytone. Thnaks, MadDawg

#20 nhale

nhale

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts
  • LocationHeidelberg, Germany

Posted 27 May 2012 - 03:22 AM

Hi,

I build the Adafruit Kit with the EM-406A based on this tutorial by Bob Cravens.
Then just ran the code from above (post #5).
But even after walking around about 30 minutes outside with blue sky and no clouds, I still not get a fix.
Does anyone has an idea what the problem could be or how I can debug the possible problem (I'm a programmer not electrician)

Powering on and off the GPS module works fine when switching Pins.GPIO_PIN_D2 from 'false' to 'true' and back. The LED on the GPS receiver gets red(on) or is off(off). I read in other posts, that it will start blinking as soon as it got a fix...but never saw that ;-(

Connection is TX ==> D0; RX ==> D1; PWR ==> D2

As sample output with the program above looks like this.
According to the this reference NMEA sentence info I interpreted my output like this:

  • No fix available ($GPRMC,000117.056,V,...)
  • and no satellites found ($GPGSA,A,1,...)

$PSRFTXT,Version:GSW3.5.0_3.5.00.00-SDK-3EP2.01 *46
$PSRFTXT,Version2:F-GPS-03-1006231*2A
$PSRFTXT,WAAS Enable*66
$PSRFTXT,TOW:  0*25
$PSRFTXT,WK:   1519*69
$PSRFTXT,POS:  6378137 0 0*2A
$PSRFTXT,CLK:  96250*25
$PSRFTXT,CHNL: 12*73
$PSRFTXT,Baud rate: 4800*65

$GPRMC,000117.056,V,,,,,,,150209,,,N*46
$GPGGA,000118.045,,,,,0,00,,,M,0.0,M,,0000*5F
$GPGSA,A,1,,,,,,,,,,,,,,,*1E$
GPRMC,000118.045,V,,,,,,,150209,,,N*4B

$GPGGA,000119.048,,,,,0,00,,,M,0.0,M,,0000*53
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,000119.048,V,,,,,,,150209,,,N*47

$GPGGA,000120.056,,,,,0,00,,,M,0.0,M,,0000*56
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,000120.056,V,,,,,,,150209,,,N*42

$GPGGA,000121.045,,,,,0,00,,,M,0.0,M,,0000*55
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,000121.045,V,,,,,,,150209,,,N*41

and so on.....





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.