Fetch data from url using SIM900 ATC modam - http

I have Sim900 modem which have TCP/IP stack. I have developed website which return data in json. like if you hit my url;
http://mywebsite.com/?id=8&certkey=Hljhph895D5
then it will return value like
{'name':'Ali', 'Age':23}
I would like to know how to fetch data using Sim900 modem. any help would be appreciated.

The GSM (GPRS, UMTS etc) connection is lower level than the IP connection. So you need to make a GPRS or UMTS data connection from your modem to the operator's network, and an IP connection on top of that (usually both connections are done with one single connect command to the modem).
Then you can use this IP connection like any normal internet connection, and retrieve your json data.
How you make the GPRS/UMTS and IP connections, depends upon your platform.
As you are using C#, I guess it's Windows.
If the modem supports newer Windows interfaces, you can use Windows Mobile Broadband API on Win 7 or 8(desktop).
If the modem doesn't support Mobile Broadband API, then you can use AT commands. There is lots of help on the internet for that.

Related

RS232 interface protocol

I'm developing a new board that should connect to other devices like PLC or industrial PC trough rs232.
The remote devices will connect to read and set some parameters (most of them one byte value).
I'm asking if is there any standard protocol to do that or if I can implement something proprietary that customers must follow .
I tought to use AT commands but my device has nothing to do with modems.

Is it possible for a modem to connect to an APN using GSM only, not GPRS?

Using a 2g/gprs modem (BGS2T), it seems like we are able to connect to an APN and communicate data though it with only a GSM connection. Is it possible we are doing this without a pdp context being active between the the modem (mobile station) and the SGSN (Serving gprs support node)/ actually using GPRS?
If you mean a TCP/IP connection over the circuit switched GSM voice network then the only way you can do normally is by using a data modem over the speech path.
It is possible to do that but it would be an unusual way to do data, especially with the different network options available today.
The modem you mention is a GPRS modem however, so it is much more likely you are actually using a GPRS connection.

Forwarding data from server to router to Arduino

Basically I have an Arduino UNO that I have connected via Ethernet to my router. I have logged the IP with my server and I would like to push data to my arduino. I guess the flow of data would be to send data (not sure the best way? Should I just open up a port and stream the data?) to the router that then forwards it to my Arduino at a local address assigned by my router.
How can I tell the router to forward this information on without logging in and changing anything with the router. The point of this exercise is to do everything with code and not do any other activities like logging into the router and setting things up. I want to do this as I have my Arduino recording temperature and I want to push data to state if it should switch sending the data from degrees or Fahrenheit or visa versa.
I would use a socket server with a publish/subscribe pattern. Probably several out there but I know XSockets.NET best.
A few hours ago I actually connected my Arduino to XSockets and communicated between webpages and my arduino both ways.
I will put the code on github when I am done, but you can look at a video showing the concept here: The Stuff For You Starts At 3:20
You dont need to open any ports as long as your arduino and server is on the same local network. Since IP adresses maps all devices on a network including your arduino.
The reason you want to open ports on your router is to make people outside your local network access a server on your network. Reasons why port forwarding exists is that when someone sends a packet of data to your public IP (which is your router) it doesent know which local IP to send the packet to. It then discards it, unless you port forward a port to a local IP, which means your router sends all packets with that port to that local IP adress.
You also need to make your own server program, for example a java program to act as a server.
I made something similar to what you are looking for, but i use a wifi shield instead. I've had some problems with maintaining connections with it, but so far it seems that it's a problem with the wifi libary.
You still might learn something from it though:
Maintaining communication between Arduino and Java program
If you want to know more about how the java server works in general, here is a great tutorial which explains a lot of the basics:
http://www.thenewboston.org/watch.php?cat=25&number=38

Transferring call from GSM modem to PC

I have the following scenario.
I have a LAN and more than one GSM modems are connected to a server. I want to receive incoming call on GSM modem and transfer this call to other PC on the network. Is it possible? Can anyone give me an idea to achieve this?
You cannot 'transfer the call'.
You will have to receive the calls from each modem on the server only, then you can implement something like a VOIP/sound streaming system by which you can simply send and receive the audio between server and client(s).

Wavecom GSM modem as a TCP client

I've been trying to do TCP communication using my Wavecom Fastrack modem. What I want to achieve is make the modem connect to a specified TCP server port to enable me to transfer data to and from the server. I found some information on than in the user's guide.
Basing on the information you can find on page 66 I created an application that opens the serial port to which the modem is connected and writes the following AT commands:
AT+WIPCFG=1 //start IP stack
AT+WIPBR=1,6 //open GPRS bearer
AT+WIPBR=2,6,11,"APN" //set APN of GPRS bearer
AT+WIPBR=2,6,0 //username
AT+WIPBR=2,6,1 //password
AT+WIPBR=4,6,0 //start GPRS bearer
AT+WIPCREATE=2,1,"server_ip_address",server_port //create a TCP client on port "server_port"
AT+WIPDATA=2,1,1 //switch do data exchange mode
This is exactly what the user's guide says. After the last command is sent to the modem, the device switches to data exchange mode and from then on everything what is written to the serial port opened by my application should be received by the server and everything the server sends should appear in the input buffer of that port.
The thing is that I did not manage to maintain stable bidirectional communication between the server and my modem. When I write some data to the serial port (only a few bytes), it takes a lot of time before the data appears on the server's side and in many cases the data does not reach the server at all.
I performed a few tests writing about 100 bytes to the serial port at once. Logging the data received by my server application I noticed that the first piece of data (8-35 bytes) is received after a second or two. The rest of the data appears in 2-5 seconds (either as a whole or in pieces of the said size) or does not appear at all.
I do not know where to look for the reason of that behaviour. Did I use wrong AT commands to switch the modem to TCP client mode? I can't believe the communication may be so slow and unstable.
Any advice will be appreciated. Thank you in advance.
what OS are you running? Windows does a pretty good job of hiding the messy details of communicating with the GPRS modem, all you have to do is create a new dial-up connection. To establish the connection you can make a call to the Win32 RasDial function. Once connected, you can use standard sockets to transfer data on a TCP port.
i have been using wavecomm modem for 2 years now.As far as i know from my experience is that if you are able to send some of the data then you can send all of the data.
the problem might be in the listening application which receives the data on the server side.
It could be that it is unable to deal with the amount of data that you are trying to send.
try sending the same data in smaller busts
with some delay in between them,then you might receive all data intact.

Resources