Neoway M590 GPRS Tutorial: sending and receiving files from/to SD card

This blog post is a part of series about really cheap GSM/GPRS module Neoway M590:
  1. Application of Neoway M590: remote control for garage heater
  2. SMS GPS-tracker with Neoway M590 and ublox NEO-6 part 1. Gathering parts and testing 
  3. SMS GPS-tracker with Neoway M590 and ublox NEO-6 part 2. Assembling the device
Make sure to read the first part of blog post about GPS tracker as it contains updated info about assembling and testing this module.

Here's a bit of useful info from what I've been doing lately. I got a job to design a device that connects to a web-server via GPRS and downloads a bunch of tiny WAV files, that it later plays on a specific schedule. Now, there's a jellybean part for this kind of task, and that is SIM900 (or SIM800), but I have a knock for "optimising" my electronics. Optimising  in this context means making everything I can as cheap as possible, provided it doesn't impact overall quality in a negative way.
That's how I came upon this el cheapo GPRS module - Neoway M590. It's sold as an assemble-it-yourself kit at Aliexpress, and at the moment of writing this article it retails for as low as 2USD.

Advertisement not intended so I blurred the store id :-)


  • One can easily find pictures of this thing assembled to know which way to solder diodes, sim card holders etc. (try my new blog post with one of the newer kit version assembly instructions HERE)
  • I strongly suggest using an external 5V power supply rated at least 1A, Arduino cannot source enough current for transmit/receive operations.
  • Actually for proper operation you are supposed to power it from 3.3V supply and use level conversion on RX/TX lines with 5V Arduino, but personally I connected this module straight to Arduino pins and nothing happened.
After receiving it I wanted to do a quick check of its functions. Hooked it up with Arduino and started looking up pieces of code and docs... Hmmm, weird enough, the only useful piece of info I found was this, and it only covers SMS.
So, after sifting through tons of garbage in the internet and failing to send proper HTTP GET requests I proudly present you my test sketches that just work (c). Those sketches are enough to get anyone started in sending SMS and sending/receiving info through TCP/IP.

For those of you more practical-minded HERE's a post about using M590 to remotely control garage heating.

Some notes about TCP/IP stack on M590:

  •  TCP connection can only be established to IP address, so you can use AT+DNS="" to request IP from known address.
  • Println function in Arduino terminates the string with CR LF sequence (ASCII codes 13 10 or special characters \r \n), and I don't use it for TCPSEND command to avoid confusion. You have to tell M590 how many characters to send. All characters between AT+TCPSEND=1,47\r and final character 0x0D count (including \r and \n).
  • You will need this document, it  contains AT command set of this module.

Sending SMS and detecting incoming calls:

Download text file using GPRS

Download WAV file to SD card

This code requires the following physical setup:

SD card MOSI - Arduino pin 11
SD card MISO - Arduino pin 12
SD card CLK - Arduino pin 13
SD card CS - Arduino pin 4
M590 TX - Arduino pin 2
M590 RX - Arduino pin 3

To avoid using level converters with peripherals (they're all 3.3V) I used my Arduino Uno modified for 3.3V operation.

So, this one sketch I used to try and see what happens if you download something bigger than plain text. I quickly whipped up a free web-site and downloaded a tiny 90kB wave file to it. Then I used the same old sketch to print this file in Serial monitor.

This turned out a complete failure. First of all, M590 would reboot mid-download, what is worse, is that some bytes came corrupted. I'm attaching original WAV file and received bogus copy for future reference, with the conclusion that, as usual, you can get things either cheap or in good quiality, not both...


  1. Hi, i have problem with some code similar to yours. I have tried to connect to internet with AT+xiic=1, and i got OK response, but when i checked AT+xiic?, instead my cell providers regular IP address (109.254.x.x), i got some unknown IANA addres from range... Is there any chance You can help me with this?

  2. Heya,
    I, don't know much about the way providers dispense IPs in GPRS network, but IIRC my module shows an address from the same subnet as you wrote. Never gave it much thought :-)
    Can you establish TCP connection afterwards?

    1. Well, never make it to tcp connection, i'll try with your code and will post here what's happening.

  3. Thanks a lot for your tutorial. I managed to retrieve a webpage:

    but there are so many junk data and what i need is 3 byte length txt file (1of) to control LED:


    +TCPRECV:1,644,HTTP/1.1 200 OK
    Content-Type: text/plain; charset=utf-8
    Transfer-Encoding: chunked
    Connection: close
    Status: 200 OK
    X-Frame-Options: ALLOWALL
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH
    Access-Control-Allow-Headers: origin, content-type, X-Requested-With
    Access-Control-Max-Age: 1800
    ETag: "8ce5bfa6ae8b0f9050ed55891ac22d1c"
    Cache-Control: max-age=0, private, must-revalidate
    X-Request-Id: 67d9d57d-5b57-4e3d-bf01-dff221ba5db0
    X-Runtime: 0.020108
    X-Powered-By: Phusion Passenger 4.0.57
    Date: Mon, 30 May 2016 08:56:02 GMT
    Server: nginx/1.9.3 + Phusion Passenger 4.0.57



    +TCPCLOSE:1,Link Close

    Please support.

    1. From the code that you provided I can see you are running TCP request in loop without checking for any conditions, which means the code checking inbound text for "1of" string executes once in about 14 seconds (sum of all delays in your loop), which makes no sense.
      Other than that I can only say that I'm still learning about this module just like you, so you're on your on. Try to find out what this "junk" data means and why are you receiving it for starters.

  4. This is my edited loop:
    void loop() {
    if (mySerial.available()) {
    while (mySerial.available()) {
    ch =;
    val += char(ch);
    val = "";
    if (Serial.available()) {
    while (Serial.available()) {
    ch =;
    val += char(ch);
    // if (val.indexOf("g") > -1) {
    Serial.println("GPRS send started");

    // mySerial.print("AT+TCPSETUP=1,,80\r");

    // mySerial.print("AT+TCPSEND=1,47\r");

    //mySerial.print("GET /asciilogo.txt HTTP/1.1\n");
    mySerial.print("GET /channels/78285/fields/1/last.txt?api_key=XXX HTTP/1.1\n");

    // mySerial.print("host:\n\r\n");



    if (val.indexOf("1of") > -1) {
    Serial.println("Light is Off");
    // } else {
    // mySerial.println(val);
    // }
    val = "";

  5. Hello, thank you for your notes.
    When I tested first "Sms sending" code, I received "garbage" symbols from SoftwareSerial.

    Are all Neoway M590 chips set 9600 baud rate? Is it possible to configure the baud rate of the GSM module?

    Thank you!

    1. As per datasheet you can change it with +IPR command, but I don't suppose modules come preconfigured different to different sellers.

    2. I have finally solved the problem. My GSM module was configured for 19200 baud rate.

    3. One more problem, just in case there is a solution:

      Once everything powered-up, module is sending "MODEM:STARTUP" message repeatedly, almost every 10-15 seconds.

      I have tried many power sources, both 5V and 3.9V -> the same result.

      When designing, have you ever encountered this kind of problem too?

    4. Wow, I'm curious to see what weird things one can expect from those things. No, I haven't seen such behavior yet, but I can see module resetting every 15 seconds either means it's fubar or there's something bad in the external curcuit. Double check your connections, and if everything is fine, throw it in the trash :)

    5. Mr Maqsudjon Usmonov
      i have the same probleme did you solve your probleme if yes. I will be great if tell me who can i solve it too ...Thanks.










      A 1000 uF capacitor will do the trick

  6. As per the datasheet provided, AT+CLIP is not supported. Can it really be used to get caller id on an incoming call?

    1. Worked for me, and looking around the web I can see I'm not alone in that. Cannot garantee it will work for you though - ridiculously cheap stuff rarely works 100% of time...

  7. Thank you for post ! Very good !

  8. hi,
    i am trying to pass url value to a server and for me this did not work. example:
    if i send this successfully i will get respose.. but i dont know how to send http request from M590..
    pls help

  9. Construction of the kit: how do you determine the polarity of the supplied diodes?

    1. Stripe on diode's body goes to the side opposite from pin headers. So it's like (pin header)-[ |]-m590.
      I must admit, I had to resolder the LEDs during assembly after mixing up the polarity - they're so tiny!

  10. i need a help , i am using neoways n10 module for that module how to connect sever for send the data to server and viceversa..
    please example how to write a at commands for this, i am using stm32f0xx microcontroller

  11. Hallo, great info there. Congratulations.

    Is it also possible with this module to upload data to a webserver? eg lively or your own webserver? (eg sensing sensor values).

    Can the detect call be used for example: i Send sms or call the arduino and it responds with an sms?

    I am thinking of buying 2 of them to create 2 simple weather stations that's upload data to a web server, and/or respond to your call with an sms with thw sensors readings

    thank you in Advance

    1. Hello,
      Both scenarios seem viable to me. This chip can definitely detect caller's number, send and receive SMS (all that was tested by me). As for sending sensor values to a web server, I can imagine using http POST method to do that (just like sending form data from a web page e.g. val1=1023&val2=123). Actually, considering how inexpensive those modules are, I would just buy a couple and try it out if I were you. If it doesn't work - PFF, no big loss ☺

    2. thank you Vadim, after studying your post more carefully, actually, i already did order 2 of them :) in my rush i did not see it carefully the chip is not from neoway, but i think it's the same one indeed it's really cheap!

  12. Hola a todos necesito ayuda con thingspeaks. No consigo actualizar los datos del canal
    m590 y comandos at serie pc








    +XIIC: 1,








    +TCPCLOSE:0,Link Closed

    Parece todo correcto pero los datos del canal no se actualizan

    ayuda please


Post a Comment