loading

In this tutorial, we will be interfacing GPS NEO 6M Module with STM32F103 using mbed online Compiler.

This tutorial is divided into following steps:

  1. Setting up Hardware
  2. Coding
  3. Visualizing the output

Note:

Step 1: Setting Up Hardware

Setting up Hardware For NEO 6M is very Easy. Make Connection as described below:

  1. NEO 6M Vcc -> Nucleo 3.3V (DONT Connect to 5V!)
  2. NEO 6M Rx -> Nucleo D8
  3. NEO 6M Tx -> Nucleo D2
  4. NEO 6M GND -> Nucleo GND

Note:

  1. Don't connect your NEO 6M Vcc to 5V! Never!

Step 2: Coding...

Open up and Sign In to mbed Compiler. Click NEW. Make sure that NUCLEO-F103EB Platform is selected. From template select 'Blinky LED Hello World". Enter Program Name and click OK. Now, right click on your program name folder and click select Import lirary->From Import Wizard. Now, Search For "Thanawat Phattaraworamet" Only one library will appear. Like show in Figure Above. Drag it and Drop it onto your program name folder. Now, open main.cpp file and remove all the code written there.

<p>#include "mbed.h"<br>#include "GPS.h"</p><p>Serial pc(SERIAL_TX, SERIAL_RX);
GPS ark(PA_9, PA_10);
DigitalOut myled(LED1);</p><p>int main()
{
    while(1) {
        if( ark.sample() == 1) {
            myled=0;
            float latitude = ark.latitude;
            float longitude = ark.longitude;
            float utc = ark.utc+50000;
            pc.printf("latitude: %0.2f, longitude: %0.2f, utc: %f\r\n",latitude,longitude,utc);
            wait(1);
        } else {
            myled=1;
        }
    }
}</p>

Copmile and Download the .bin file to Nucleo Board

Step 3: Visualizing the Output

Open a Serial Port communication window on COM port on which your STM board is connected.

If your GPS is connected, the LED will turn OFF and you will see values being displayed on the screen.

If your GPS is not connected, the LED will turn ON indicating that GPS is not connected.

Note:

  1. The latitude and longitude being displayed are according to GPS System.

<p>Hi, </p><p>I am using the stm32 L476rg neucleo board. I cant get this code to work for my gps neo6m module. Could you be kind enough as to let me know what could i be doing wrong??</p><p>thanks in advance</p>

About This Instructable

1,507views

3favorites

License:

More by ARK4579:Getting Keil and STM32CubeMX ready STM32103: esp8266 NodeMCU ThingSpeak [using mbed.h] STM32F103: esp8266 nodeMCU Getting Started [using mbed.h] 
Add instructable to: