Can I make my Arduino a server using just GSM/GPRS Shield? - android

I have seen examples of Arduino acting as a server using the Ethernet. But I am working on a project that requires my Arduino to act a server that will listen for client requests using no Ethernet, but only GSM/GPRS shield. I have a SIMCOM SIM808 GSM/GPRS/GPS module.
I will have my Android send requests to that Arduino & the Arduino will perform the operations accordingly. I have searched a lot, but haven't found any such example. That got me wondering if it was even possible? If yes, how?
Do feel free to direct me to links / posts that have such tutorial.
Thank you for your time.

of course it is possible.
GSM/GPRS shield will convert data to serial.
You will need to configure it with AT commands.
The main problem I see here is that GPRS will not have a fixed IP address, so you would not be able to reach it if you don't know the address.
Somehow the Arduino should send you every now and then its public IP address, which I am sure you can retrieve with an AT command.
Except also your mobile will not have a fixed IP address.
So you'll probably need a server in between to record IP addresses.
I am actually working on this type of problem, but use different hardware and libraries, so I am not able to help you more at the moment.
I will soon have a project on Kickstarter for this type of solution.

Related

Sending Data from Android Device to a RaspberryPi

I need some help in terms of choosing a design option for my problem.
I currently managed to implement a RaspberryPi acting as a Server and my local machine to act as the client. This client send JSON-Data to the Server which processes these. Everything is working as expected and I am using TCP-Sockets for the communication.
My problem:
The next step of my project will be, that I will use instead of a PC an Android-Device as client. What I want to achieve is, to send data to the server on the go. What I mean by that is, I do not want to restrict the server to be in a special network neither the client. What can be expected, is that server and client are next to each other, like in the range of a bluetooth connection. My question is, is there a relatively simple way to implement this communication? Is TCP a possible solution for this (even working in mobile networks?) or do I need to use Bluetooth, or is the way to go, to create some kind of network the client/server connects to and communicate here?
Sorry for propably stupid questions, but I am new to all this network stuff.
EDIT:
Since there were no respones, maybe I can do a more precise question. Is there a proper way to scan a network for a device name?
The only way I currently can imagine is to do a bruteforce like check on every IP-Address and resolve the names?
I first tried to let the Pi host an ad-hoc network, but it seems that non-rooted android smartphones do not have the possibility to access ad-hoc networks.
Therefore I made the Pi acting as an access point.
The communication now is very simple realized by a tcp server-client system.

Connect Android to Arduino through GCM

I spent a week looking for a convenient answer to my question. I am trying to connect Android to Arduino through Cloud, Where it has 2 operations:
Arduino can trigger a push notification to the android device anywhere.
Android operates Arduino through Cloud.
now the first point is easy to be done, by having a 3rd party server where Arduino POST user credentials (can be configured when the device is bought) with the message to PHP server then the server will get GCM's Registeration ID from MySQL and POST it through cURL to GCM to push notification to the related Android device.
or by using Arduino YUN, we can directly send cURL from Arduino itself.
However for the second point where I am stuck, I can't figure out a way to maintain the IP address of the Arduino without actually making the user to enter the IP address of his Internet in the Android application interface.
The solutions I came up so far:
Connect another Android device to Arduino at all the time using ADK then it will become a communication between Android device with another Android device through GCM and the GCM will handle getting the IP addresses of both.
Using MAC address to get to the Arduino but this is insufficient approach because the MAC addresses are hard coded in Arduino, and then spoofing may occurs.
I am not convinced with the proposed solutions so is there a possible way to use GCM or any similar system like Parse in Arduino and make it have a unique registration ID just like android then I can map the user's Android registeration ID with the related Arduino registration ID. or can anybody give me another solution or method I can follow. Thanks in advance.
P.S: I dont want to use static IP address or Port forwarding, the idea of this project is to create a device that is user friendly and doesn't require a lot of configuration from the customer.
Knowing that your Arduino already communicates with a third-party server, you can take advantage of it and additionally get the IP address of the Arduino device making the GCM id registration (in PHP you'd do this by using $_SERVER['REMOTE_ADDR']).
This way you can keep a 1-to-1 identification of a GCM id and a public IP address to know to which Arduino device to send the signal.
This would need that you implement some timeout process (for instance, implement a keepalive system and if a device doesn't send a POST request each X time, just remove it from whithin the connected devices). Also, if the same device connects from two different IP addresses, just keep the last one so you're not mixing up.

want to connect my android via WLAN to a RS 232 serial adaptor

first of all thanks alot for the big help you have been in my past. I looked for alot of problems since i began android programming, but now I have a problem, i cannot find an answer.
I wrote a little program where are a number of CountDownTimers, which are correctable(adding or subtracting seconds and minutes), they can be paused and resetted to a time i setted in SharedPreferences.
Now my boss want to expand this.
he wants this app to connect via W-Lan (intranet, not internet), to a wlan-to-rs232 converter, to set states like "pause" and "end" to a machine, which displays the time.
Now my Problem:
I do not even know how to begin with that ^_^
I dont know, how to connect to the converter,
I dont know, how to send the needed bits/datas/whatevers to the converter,
I, if i can manage it to connect to the converter anytime, dont know how to tell the converter which commands/bits/whatevers he has to send to the machine.
Second:
the machine also send bits to the converter, which has to be received by my app, same thing as above, but inverted.
Maybe someone is here who can help me?
Just a little introduction to this will be helpful, i got the beginnings of programming by "Try-and-Error", but to do that, i need a point where i can begin.
Thanks alot
Mina
Nobody can really help you with this, as you didn't mention which RS-232 host you have. There is no standard... they all work a bit differently.
That being said, most of them will send/receive data over a regular TCP connection.
Configure your converter with an IP address.
Connect it to whatever RS-232 device you are using.
Make a TCP connection to your converter via its configured IP address and port.
Send/receive data over this TCP connection as if you were sending/receiving over RS-232.
Other converters implement their own protocol to facilitate emulating the port status lines, such as carrier detect and clear-to-send. For those, you will have to read the protocol documentation provided by the manufacturer.

Connecting two Android phones to transfer data between them over WIFI

Actually i am developing tracking app and want to send Location updates between two Android phones so that both can track one another over the Map. My application must get real time updates from other android device for better tracking.
I Have searched couple of techniques but don't know which one is best
Using Sockets: making one device as Server while other as Client
Possible Limitation:
What if IP address of Server is changed (because WIFI don't have a
static IP)
Cannot access if the IP address of server is private
Only client can connect to Server and Server cannot connect to Client
Using Intermediate Server: create an intermediate server and make a communication via that server.
Possible Limitation:
Slow because each Android device first send these updates to server
and then server push these updates to other android device
Please provide me your suggestion about which one is the best way to do this.
Since you didn't state the Device API level you want to support I'll provide you with an option for Android v4 (API level 14) devices. It's called Wi-Fi Direct and allows p2p connections between phones. It's essentially your socket approach, but allows easy neighbour discovery and allows transfers in both directions.
Well wifi is out.. Not for your stated purpose at least. Unless your map is quite small. Wifi is for say 100 meters (on a really good day)
Not knowing as much about android as I do of other mobiles, I'd say you're in for some pain.
I'd suspect connecting to your phone with a peer to peer might be a real slog.. some providers won't let it happen.
I have an approach more than an answer..
From an android phone, see if you can get your ip address.
From a desk, ping that ip address.
If it works, you're well on your way..
Id even say given the size of your info, you could use pinging as your main data carrier.
Pings can contain more than just random bytes. You could include an ID, and GPS in the contents you send in your ping. --- perhaps include a check sum ---
Do most of the work desk to phone, because development would be faster.. Then when your phone is capable of catching the pings.. Well then sending the ping should be easy as.

ANDROID - Displaying a list of IP addresses of phones running same app

I am developing a multi threaded client-server Android app in which both clients and the server are android phones( the server is not centrally located) and are located in the same network, under the control of one single router.
The server will start the application first. When the clients starts the app, they should get the IP address of the server phone automatically, so that when they click the address, they can be connected to the server.
Right now, I have made a provision that the server phone displays its IP address on the screen when the app starts running. When a client starts the app, it is provided with a text field in which the user can manually type the server's IP address and get connected to it.
Can anyone give me any pointers on how I can get the server's IP address to be displayed on the client phone automatically? Do I need a central database or something like that? I am new to android programming and don't really have any idea about this.
See if this is useful: Android IP address with java
You might want to think about implementing a UPnP solution. See this Universal Plug and Play as a starter then check the links at the end for relevant docs/references.
UPnP doesn't require devices to explicitly know the network details of other devices and instead they locate each other using a discovery protocol (SSDP).
One solution is to ping local IP range in a loop. Put a small timeout duration. It would be better if you run it in separate threads. If you get ping response, this would mean the server is available.

Categories

Resources