HG-C02-V1.5 - GPS module

model: Ublox Neo-M8N with compass


Hobbyking - Ublox Neo-7M, Ublox Neo-M8N with compass, Pixhawk.org - Pixhawk, Arduino playground - I2C Bi-directional level shifter, u-blox: Neo-M8N, datasheet (PDF), protocol specification (PDF), Wikipedia - DDC,

local links

Arduino Uno,

back to microcontrollers page.


2021-08-12: I re-created this page on my self-hosted web server.

2016-04-11: Testing the compass - I used the HMC5883 example from SparkFun, I just had to fix the Write.send -> Wire.write and Wire.receive -> Wire.read and then it compiled. The Compass works better:

x: 406  y: -192  z: 285
x: 263  y: -327  z: 308
x: 129  y: -384  z: 309
x: 71  y: -361  z: 324
x: 64  y: -361  z: 327
x: 70  y: -352  z: 329

this is me moving it.

2016-04-11: TinyGPS test - I modify the test_with_gps_device example, and test it:

Testing TinyGPS library v. 13
by Mikal Hart

Sats HDOP Latitude  Longitude  Fix  Date       Time     Date Alt    Course Speed Card  Distance Course Card  Chars Sentences Checksum
          (deg)     (deg)      Age                      Age  (m)    --- from GPS ----  ---- to London  ----  RX    RX        Fail
**** **** ********* ********** **** ********** ******** **** ****** ****** ***** ***   *******  ****** ***   0     0         0        
**** **** ********* ********** **** ********** ******** **** ****** ****** ***** ***   *******  ****** ***   187   0         2        
**** **** ********* ********** **** ********** ******** **** ****** ****** ***** ***   *******  ****** ***   374   0         4        
**** **** ********* ********** **** ********** ******** **** ****** ****** ***** ***   *******  ****** ***   561   0         7        

again, I do not know if the GPS works indoors.

2016-04-11: TinyGPSPlus test - I modify the DeviceExample, and try it:

A simple demonstration of TinyGPS++ with an attached GPS module
Testing TinyGPS++ library v. 0.92
by Mikal Hart


not sure the GPS can fix on satellites indoors.

2016-04-11: examples - compass - HMC5883L examples: Adafruit HMC5883L, SparkFun Triple Axis Magnetometer HMC5883L,

2016-04-11: examples - Arduino GPS libraries: TinyGPS, TinyGPS++ (TinyGPSPlus),

2016-04-11: GPS module - it seems like the Neo-M8N uses DDC I2C, maximum rate 400 kbps. POrt numbers: 0 - DDC (I2C compatible), 1 - UART 1, 3 - USB, 4 - SPI. The Serial port (UART) supports the following baud rates: 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800 and operates with 8 bits, no parity, 1 stop bit. It is not possible to configure different baud rates for sending and receiving. DDC (I2C) opertes in slave mode only - the host provides the clock (SCL). Receiver's default address is 0x42. No handhske mechanism on I2C, in streaming mode the receiver returns 0xFF for "no data". Registers: number of bytes available - address 0xFD (high byte) and 0xFE (low byte), data stream - 0xFF (successive reads),

2016-04-11: GPS module - I use SoftwareSerialExample from Examples in Arduino IDE, it uses Arduino pin 10 for RX and pin 11 for TX. So I conect B3 on converter to pin 10 on Arduino Uno, and B4 on converter to PIN 11 on Arduino. The I connect yellow (TX) on GPS to A3 on converter, and green (RX) on GPS to A4 on converter. According to the HobbyKing product page, the module communicates at 38400 baud rate, so I modify the example accordingly. First error: the pins are reversed, yellow is RX and green is TX, I just switched in the sketch (10 -> 11, 11 -> 10). Second error: now it printed just garbage, so I know that the baud rate is wrong. Changed it to 9600 baud, and uploaded the code again. And get:

Goodnight moon!
GA,,,.999 P,09G,,6GL,N $GNRMC,,V,,,,,,,,,,N*4D

very good.

2016-04-11: I2C scanner - I connect up an Arduino Uno (because it has both 5V and 3.3V out), and set a 4-channel I2C-safe Bi-directional Logic Level Converter - BSS138 (Adafruit, product 757) which I bought at Digital Impuls (137015) on Saturday for NOK 88.- on a small breadboard (FastTech, 1001000). I connect one GND pin on the converter to GND on the Arduino, "HV" on the converter to + 5V on Arduino, and "LV" on converter to + 3.3 V on Arduino. On the Arduino Uno, SDA is A4, and SCL is A5, according to the Wire reference. So I connect B1 on converter to A4 on Uno, and B2 on converter to A5 on Uno. From the GPS, I connect black to GND on breadboard, and red to + 5V on bredboard, this makes the green PWR led light, so this is correct. I guess that orange is SCL, and connect it to A2 on converter, and blue must then be SDA, so I connect it to A1 on converter. Next, I load the I2C scanner sketch into Arduino IDE and compile it, and upload it. I start serial monitor, and is greeted with this:

I2C Scanner
I2C device found at address 0x1E  !

which repeats every second. Nice.

2016-04-10: a friend at work lent me this so I could test it. The module is housed in a round, smoke colored plastic enclosure with "GPS/COMPASS" written on it. The pcb is labeled "HG-C02-V1.5". On the top is just the cable connector and the GPS antenna. On the bottom is one u-blox NEO-M8N-0-01, a battery, U1 (A983 2412) - this is probably the HMC5883L compass chip with I2C interface, and a few other chips. According to the Hobbyking product page, it also contains an I2C EEPROM and a low noise amplifier for the GPS. It is delivered with a "Pixhawk compatible 6pin cable" and a "APM compatible 5pin cable". It is the 6-pin cable that is connected. On the Pixhawk page, I can see that the GPS connector has the following layout:

pin signal voltage
 1   VCC         + 5 V
 2   TX out       3.3 V
 3   RX in        3.3 V
 4   CAN2 TX   3.3 V
 5   CAN2 RX  3.3 V
 6   GND

The I2C port has this layout:

pin signal voltage
 1  VCC   +5 V
 2  SCL   3.3 V (pullups)
 3  SDA  3.3 V  (pullups)

Now how to figure out how the GPS cable is configured. Ok, looking at pictures of GPS cables, a possible configuration might be:

I2C: blue, orange (for the compass)
GPS: black - GND, red - VCC, yellow - TX, green - RX.