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.
- 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 conntected 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 enought 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\rand final character
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 cardThis 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 plaint 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...