- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
This blog post is a part of series about really cheap GSM/GPRS module Neoway M590:
- Application of Neoway M590: remote control for garage heater
- SMS GPS-tracker with Neoway M590 and ublox NEO-6 part 1. Gathering parts and testing
- SMS GPS-tracker with Neoway M590 and ublox NEO-6 part 2. Assembling the device
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 knack 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 5 USD.
UPDATE 25 Apr. 2018:
Essential documents for M590
Neoway M590E GPRS Module Hardware User Guide v 1.0
Neoway M590 Hardware Design Manual Version 1.1
Neoway M590 AT command sets v. 3.0
Advertisement not intended so I blurred the store id :-) |
Preparations:
- 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.
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="hostname.com" 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 character0x0D
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...
Comments
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 10.0.0.0/8 range... Is there any chance You can help me with this?
ReplyDeleteHeya,
ReplyDeleteI, 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?
Well, never make it to tcp connection, i'll try with your code and will post here what's happening.
DeleteThanks a lot for your tutorial. I managed to retrieve a webpage:
ReplyDelete"api.thingspeak.com/channels/78285/fields/1/last.txt?api_key=XXX"
but there are so many junk data and what i need is 3 byte length txt file (1of) to control LED:
+TCPSEND:1,99
+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
+TCPRECV:1,8,3
1of
+TCPRECV:1,5,0
+TCPCLOSE:1,Link Close
Please support.
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.
DeleteOther 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.
This is my edited loop:
ReplyDeletevoid loop() {
if (mySerial.available()) {
while (mySerial.available()) {
ch = mySerial.read();
val += char(ch);
delay(10);
}
Serial.println(val);
val = "";
}
/*
if (Serial.available()) {
while (Serial.available()) {
ch = Serial.read();
val += char(ch);
delay(10);
}*/
// if (val.indexOf("g") > -1) {
delay(4000);
Serial.println("GPRS send started");
mySerial.print("AT+TCPSETUP=1,52.7.53.111,80\r");
// mySerial.print("AT+TCPSETUP=1,141.101.113.175,80\r");
delayWithRelay(1000);
// mySerial.print("AT+TCPSEND=1,47\r");
mySerial.print("AT+TCPSEND=1,99\r");
delayWithRelay(1000);
//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");
delayWithRelay(500);
// mySerial.print("host: arduino.cc\n\r\n");
mySerial.print("host: api.thingspeak.com\n\r\n");
delayWithRelay(500);
mySerial.print((char)0x0D);
delay(1000);
delayWithRelay(5000);
if (val.indexOf("1of") > -1) {
Serial.println("Light is Off");
}
mySerial.println("AT+TCPCLOSE=1");
Serial.println("Complete");
// } else {
// mySerial.println(val);
// }
val = "";
}
//}
As per datasheet you can change it with +IPR command, but I don't suppose modules come preconfigured different to different sellers.
ReplyDeleteWow, 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 :)
ReplyDeleteAs per the datasheet provided, AT+CLIP is not supported. Can it really be used to get caller id on an incoming call?
ReplyDeleteWorked 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...
DeleteThank you for post ! Very good !
ReplyDeletehi,
ReplyDeletei am trying to pass url value to a server and for me this did not work. example: www.testurl.com/test.php?i=1
if i send this successfully i will get respose.. but i dont know how to send http request from M590..
pls help
Mr Maqsudjon Usmonov
ReplyDeletei 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.
MODEM:STARTUP
MODEM:STARTUP
MODEM:STARTUP
MODEM:STARTUP
MODEM:STARTUP
MODEM:STARTUP
MODEM:STARTUP
MODEM:STARTUP
MODEM:STARTUP
http://www.edaboard.com/thread357212.html
ReplyDeleteA 1000 uF capacitor will do the trick
(jbeemster)
Construction of the kit: how do you determine the polarity of the supplied diodes?
ReplyDeleteStripe on diode's body goes to the side opposite from pin headers. So it's like (pin header)-[ |]-m590.
DeleteI must admit, I had to resolder the LEDs during assembly after mixing up the polarity - they're so tiny!
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..
ReplyDeleteplease example how to write a at commands for this, i am using stm32f0xx microcontroller
Hallo, great info there. Congratulations.
ReplyDeleteIs 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
Dimitri
Hello,
DeleteBoth 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 ☺
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 http://www.ebay.com/itm/401085445937?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT indeed it's really cheap!
DeleteDid you ever get a HTTP POST working, I cant find any examples on the net
DeleteHola a todos necesito ayuda con thingspeaks. No consigo actualizar los datos del canal
ReplyDeletem590 y comandos at serie pc
MODEM:STARTUP
+PBREADY
AT
OK
AT+XISP=0
OK
AT+CGDCONT=1,"IP","ORANGEWORLD"
OK
AT+XGAUTH=1,1,"orange","orange"
OK
AT+XIIC=1
OK
AT+XIIC?
+XIIC: 1, 10.74.227.188
OK
AT+DNS="api.thingspeak.com"
OK
+DNS:52.1.229.129
+DNS:52.5.13.84
+DNS:OK
at+tcpsetup=0,52.1.229.129,80
OK
+TCPSETUP:0,OK
AT+TCPSEND=0,71
>
GET https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXXXXX&field1=9
OK
+TCPSEND:0,71
+TCPCLOSE:0,Link Closed
Parece todo correcto pero los datos del canal no se actualizan
ayuda please
I have tried to send the data through socket communication.
ReplyDeletewhen I set the AT command using AT+CGATT=1 for activate the GPRS but every time received ERROR.
Also i tried to IDEA SIM, DOCOMO SIM and VODAFONE SIM card but received ERROR.
e.g.
AT
OK
AT+CGATT?
+CGATT : 0
OK
AT+CGATT=1
ERROR
How to resolve this gprs connectivity issue?
As you may have noticed, I managed to connect to GPRS network without using CGATT command just fine. Try doing it my way, maybe?
DeleteAnyway, if your local network requires you to issue this command, I'm afraid I can't advise you anything but trying a different module. M590 modules come from a mixed bag - sometimes one module will misbehave in response to one command you know should work, while another will execute it just fine...
Thanks vadim for your response.
DeleteI also tried without using CGATT command but still create network issue. I followed below sequence for data transmission through tcp socket.
AT+XISP=0
OK
AT+CGDCONT=1,"IP","internet"
OK
AT+XIIC=1
OK
AT+XIIC?
+XIIC: 0, 0.0.0.0
OK
In that sequence I tried to establish PPP link using (AT+XIIC=1) AT command and also received OK response. But when I tried to check the PPP link is successfully attached or not using (AT+XIIC?) AT command but always PPP link is not established properly.
I followed as per given in this document link : https://cdn.instructables.com/ORIG/F...HQIZ6CYGIU.pdf
but getting this same issue
so how to resolve this type of issue?
Two quick notes:
Delete- I think you mean you have a "knack" not a "knock"
- The m590 is rated at 2.8V. Overdriving it at 3.3V may damage the module and shorten it's lifespan. YMMV, just be aware
You're absolutely right on both counts! Thanks for correction, and expanding 0n what you said about the maximum voltage, Hardware design manual clearly states this:
Delete>Because the module uses a 2.85V IO power system, maximum input voltage of all IO
interfaces can not exceed 3.3V, otherwise the IO may be damaged.IO interfaces with a 3.3V power supply may for various reasons output at 3.3V or higher. In this event, this voltage on the I/O signal interface will connect to the IO of the 2.85V module and damage the IO ports.
So yeah, to use this module for any purpose other than pure hobbyist, one should carefully read all the scarce documentation that's been translated into English.