SMS GPS-tracker with Neoway M590 and ublox NEO-6 part 1. Gathering parts and testing

 На русском

This post is a follow up on my series about GSM/GPRS module Neoway M590.
First post of the series concerned some basic module usage scenarios with Arduino like sending/receiving SMS, detecting a phone call and even using GPRS network, the second post was a more practical example of automated garage heater that can be controlled with SMS messages.

This time I'll demonstrate a more sophisticated example of using this module - making a GPS tracker that sends its location to owner via SMS. We'll have to explore both GSM and GPS modules' power-saving settings to ensure long battery life of our resulting device. This two-part tutorial will also complement the first tutorial I wrote up with more detailed Neoway M590 assembly and startup guidelines.
  1. Neoway M590 GPRS Tutorial: sending and receiving files from/to SD card
  2. Application of Neoway M590: remote control for garage heater
  3. SMS GPS-tracker with Neoway M590 and ublox NEO-6 part 2. Assembling the device

Here's some helpful links with datasheets:

Essential hardware

  • Evidently, you'll need both Neoway M590 GSM/GPRS module and ublox NEO-6 GPS module. The former is usually conveniently sold as a dirt cheap assemble-it-yourself kit on Aliexpress and Taobao (try this kit similar to mine with the same double pin header or this one which is twice as cheap, but with different PCB. The one I bought is already 5.5 USD for some inscrutable reasons: link). The latter can be procured as a ready-made PCB complete with a huge rectangular ceramic antenna (here's the link).

    Neoway M590 GSM/GPRS module
    ublox NEO-6 GPS module

  • For the GPS logger iself we'll use the ol' trusty ATMega 328P. Actually, I happened to buy it as a set of  IC itself, DIP socket, 7805 voltage regulator, electrolytic capacitors and 16MHz crystal with 22pF capacitors. Not all of that will come in handy, but hey, it was 99 cents! Can't find the same kit now, but this will do great too.

    The infamous ATMega328p that we all know as a heart of Arduino Uno. 8MHz crystal resonator in the middle.

  • 8MHz crystal resonator. Sadly, my kit didn't include this, and I had to pluck it out of some unfortunate piece of hardware I had lying around.

    8.000 printed on top clearly marks this 8Mhz crystal.

  • Lithium battery that you can salvage from someone's old mobile or just buy + Lithium battery charger like this one:
    TP4056 (datasheet) based charger. Can be bought cheaply and in great numbers on Aliexpress and the likes.

  • Assorted capacitors. Specifically, beside your run-of-the-mill electrolytic and ceramic caps, you'll need some large capacitance caps that can be found in charge pump circuits on motherboards.

  • Optionally, to test each piece of hardware before assembling the device you'll need: an Arduino, some male and female jumper wires (don't know why I included a breadboard in this picture, but it might prove useful to you).

  • A pair of ham-fisted hands😀 (in my case, anyway)
That should be enough. Let's get started then?

Not much for such an advanced(ish) device.

Assembling and testing M590 module


Upon ripping open a package with (preferably ESD-protected, but who knows where you'll buy your module...) a plastic bag, you'll see a jumble of electronic parts:

Close up pictures of the PCB tell a tale of which M590's pins are broken out on a pin header (quite a restrictive number for so many pins, that is):

Top side
Bottom side

Soldering those is pretty straightforward, although there's still more than one way one could mess this up. Pin header, resistors (small black rectangular ones with numerals on them) and ceramic capacitors (small yellow ones) are non-polar, meaning you can solder them any way 'round. My kit lacked one ceramic capacitor, you can solder any other salvaged SMD ceramic cap in its place.

Tantalum capacitor and LED's have to be soldered in a particular orientation to work. You can tell their polarity (and thus, the way you have to solder them) from markings on their body.

Tantalum caps have a dark stripe on positive side:

Surface mounted LEDs have 2 distinctive feature that differentiate anode from cathode, namely, a drawing on the bottom and 2 green spots just barely visible from above:

 Putting all the rest together should be easy. GSM module has a circle on silkscreen, denoting pin 1. You can look up module's pinout in Neoway M590 Hardware design manual . SIM card slot's silkscreen also clearly indicates how it should be placed with a triangular notch.

That's how the assembled module looks:

Top side
Bottom side

There's only one thing missing now. M590 hardware design manual mentions that it can draw high peak current from its power source, hence you need a beefy capacitor to store energy and smooth out those surges of current consumption to reduce the continuous current output requirements of your power source. The kit I've bought came with a measly 220uF capacitor, and that is only good for the power source that can supply an approximate 0.8A of current!

Let's reduce these current requirements and solder a beefy electrolytic cap right on top of the PCB to the power lines:

4700uF here

^ NOT DOING THIS CAN LEAD TO MODULE CONTINUOUSLY RESETTING and spitting out something like this in serial port:

Now, on to checking if it even works, because cheap don't always mean good...


My breakout board's pinout is as follows:

Pin Function
3 Vcc
4 Vcc
5 NC
6 NC
7 TX (M590 pin 8)
8 RX(M590 pin 7)
9 NC
10 NC
11 NC
12 RING (M590 pin 10)
13 NC
14 ON/OFF (M590 pin 19)

Thanks to the capacitor we've soldered we can power the module directly from Arduino Uno's on-board 3.3V voltage regulator. Simply connect your module to Arduino like this:

Arduino pin M590 pin
GND GND (1 or 2)
3.3V VCC (3 or 4)
D8 TX (8)
D9 RX (7)

In previous blog posts I used SoftwareSerial.h library to talk to Neoway M590. It worked to an extent, but I was constantly plagued by distorted characters in serial output. Turns out it was this library all along, being too slow to recognise fast transitions on serial pins...

Now I'm using AltSoftSerial library and I suggest you do the same (or pick another better software serial library for Arduino). Just look at the difference, it's like in those washing powder TV commercials:
SoftwareSerial's garbled output
AltSoftSerial. Sleek.

Now, let's upload the code that checks if Neoway M590 module responds to AT commands. For that, use Echo sketch that comes with AltSoftSerial library modified so that it sets 115200 baud rate for altSerial (see screenshot above).

After powering up M590, if it's LED doesn't start blinking, you'll have to short the module's ON/OFF and GND pins for at least 0.5 seconds. Once it starts blinking, you should see MODEM:STARTUP in Serial monitor. Try to type AT and send it with trailing CRLF to test communication both ways. The module should send OK back.

If it doesn't,  try to use my auto-detection code from the next paragraph. Double-check your connections. If it still doesn't work, it's as good as garbage, try another one😊

From my previous Neoway tutorial I learned that though the default baud rate of M590 module should be 115200, in reality the modules that vendors ship sometimes bear the signs of being used before and are set up for another baud rate. To simplify  the matter of finding the right baud rate, I wrote a sketch that automatically determines your module's speed.
Upload it and enjoy not having to do the manual determining as seen on screenshot down below:

Assembling and testing NEO-6 module

Not a lot to assemble here. Just snap the module's antenna connector in place and solder jumper wires to its 4 pins (Vcc, GND, RX, TX). Alternatively, don't be a caveman like me and do it properly - solder a pin header to module and connect jump wires to it... I also soldered a small capacitor to Vcc and GND for stability.

Ready to go

Get yourself some GPS decoding library like this one -> NeoGPS. It is extremely configurable and can be set up to use AltSoftSerial, NeoSWSerial or even the nasty SoftwareSerial libraries for software serial connection to GPS module, along with hardware serial ports found on Leonardo, Mega and such.
NeoGPS  installation manual on GinHub can be really helpful. Although it strongly advises against using SoftwareSerial, it will do for testing purposes.

Now, connect serial pins as per GPSport.h included in NeoGPS library:

Arduino pin NEO-6 pin
3.3V VCC

Now let's fire up the Arduino and upload slightly modified NMEA.ino from NeoGPS library examples folder:

GPS modules usually need some time (5 to 15 minutes in remote areas) to start up and get a fix from satellites. And once it does get a fix, it will start blinking an on-board LED twice a second.

 That's when you should see a torrent of data in your Serial port. Latitude and longitude are there, too, without a decimal separator on 2nd place from the right. You can try and plug them into Google Maps and make sure GPS module works:

Looks about right!

Here's the link to PART 2, where we are going to proceed to design the schematic and build the device.