Thursday, 4 August 2016

Automatic configuration of ublox M6 GPS receivers for Arduino during runtime.

My good friend Ryan wants to make a GPS tracker with KML, as detailed on this very website.

He wants to make a couple of revisions, which I'll publish here later...

But, he runs into a problem.

It doesn't work....

After some careful examination of the receiver, and checking the configuration with the U-blox U-center application, it becomes apparent that the receiver isn't storing the new configuration (57,600 baud serial, and 200mS update rate) after a power cycle... It defaults to 9,600 baud and a rate of 1s.

... damn it, a faulty receiver. So another is tried. Same results...

So, presumably the receivers aren't faulty....

This is one of the guilty receivers....

.... notice anything??

Here's one of mine....

... and there's the difference. See where the "faulty" receiver has a white circle marked with a 2??  Mine has a battery fitted. After a quick look at the datasheet for the U-blox chip, this is a RAM back-up battery. The configuration settings are stored in RAM. On Ryan's receiver these are lost as soon as the supply is removed.

Ryan looked into getting the correct battery and fitting it, but it's got one helluva specification, and was about £7... which is a touch expensive considering the GPS module was £9!

How about sending the configuration data from the sketch every time it starts up?

Why not....

I did a few experiments with two FTDI boards connected to a receiver...

In this picture you can see I've connected the lower FTDI to the receiver, RX to TX, TX to RX. This FTDI is used to communicate to the U-Center application. The top FTDI is used to "sniff" the serial data on the TX line on the first FTDI. Only it's ground and the RX pin are connected. This is so I can run a terminal program and grab the configuration data when I click "send" on the u-center application.

After a bit of buggering around with Real term (download from here.) I grabbed the data, in hex, being sent to the receiver from u-center.

This is what it looks like:

Set to 200mS rate

B5 62 06 08 06 00 C8 00 01 00 01 00 DE 6A B5 62 06 08 00 00 0E 30
set 57,600 baudrate

B5 62 06 00 14 00 01 00 00 00 D0 08 00 00 00 E1 00 00 07 00 02 00 00 00
00 00 DD C3 B5 62 06 00 01 00 01 08 22

So, now we just need to send that each time we power up...

You'll need to add a wire from the Arduino's TX pin to the receiver's RX pin, so the receiver can receive the configuration commands.

Here's the code snippet, you'll just need to add it in the void setup ()

.... and so on. I'll post up the whole thing , and the modifications we made to Ryan's tracker soon!


  1. Fiendishly clever, even for you Mt D! Looking forward to the full report in due course. Please keep them coming!

  2. "Serial.begin (56700); // start serial coms at 56,700 baud. "
    the correct baud rate should be set to 57600 .