Android to Raspberry Pi with TCP/IP - java

I'm working on creating an Android app that will act as a controller for a robot I'm building for my kids. I just want to be able to turn it's head, and move it's arms. I was experimenting with TCP/IP earlier, and was able to send data from my phone to my Raspi. The issue I'm confused about is how to go about parsing the data. Currently, I'm just dumping all of the data into one stream from the phone, is there any way to send data for the head turn, and the individual arms as separate streams, and then send them off to the robot?

Why don't you use any popular format like JSON or XML for this like
{"command":{"type":"head","direction":{"up":"2","down":"0","left":"0","right":"0"}}}
And parse it in the RPi

Related

Using Java to send data to arduino sketch

I'm new into arduino programming and robotics, and I want to use Java to send data to the arduino sketch, to notify it when to use the robots motors. In particular, I have already written a working A* algorithm in Java and would really like to apply this to my arduino robot, so in my java code, when the best state is found, I want to then send data to arduino sketch to notify it what direction to go. Anyone have and ideas as to the best way? I've looked online but haven't anything that really answers this specific question.
Also, I realize I'll need to have the arduino connected via USB to use Java, but for now I'm fine with it
You are going to need JAVA USB API in order to send the data to the USB port where your Arduino is connected. From there you just read the input in your Arduino sketch and you are done.
You can also use a Java Serial Port library (like jssc).
Personally I use Processing (which uses Java) and it's quite easy to do Serial communication with the serial library it ships with.
Check out the SimpleWrite example (which includes example Processing-java code and Arduino code)

Android: Multiple Streaming Variables to Raspberry Pi (Bi-Communication)

I'm trying to create an android controller app that will send seekbar data for a steering wheel, brakes, and throttle to the raspberry pi. I've been using TCP/IP over ethernet to communicate with the pi, but I need a way to identify the different data streams associated with the seekbars. I've looked into JeroMQ, and Java Object Serialization but would like to get some suggestions. Ultimately, I need to send, and receive data to/from the Pi, essentially, the data needs to be synced, so that if, let's say, the steering wheel moves in the Pi program, the android also receives that data, and vice versa. Thanks Wizards.
The solution is to use a framework like MQTT or JeroMQ(ZeroMQ) to send the messages, either one will allow you to publish and subscribe, so you don't have to worry about creating a parser, this works particularly well when you need data being communicated bilaterally.
JeroMQ
MQTT

Transfer data by ultrasound in android java

I want to implement an app that looks like this:
https://www.youtube.com/watch?v=GPntMT_8UuQ
Basically - Two mobiles that my app open and one mobile sends bits like 01010101
and in the second mobile I received this sequence...
I read about sinus function to send sound but unsuccessful.
I want to implement in java lang the app,
the cover of the app is ready, but I don't know how to continue that I
click "Transfer".
Is there an idea where to start?

Receiving data at regular intervals (MODBUS TCP JAVA)

I'm currently working on a Modbus TCP JAVA project using the jamod library. So far, I'm able to read & write to the Modbus network (gateway & some sensors from 4-noks) without any issues. My next step is to receive the data of the sensors automatically.
The devices I'm using are sending their registers to the Modbus-Gateway at regular intervals (about 20-60seconds). Unfortunately, I'm having some problems in receiving these data.
The Gateway has a register in which it's counting the received messages and it does receive data of the sensors, but how can I display these data onto my PC using java (jamod, or maybe another library)?
I have been searching and trying for the last week and I'm out of ideas. Would be very nice to get some information on how this goal can be achieved!
It depends how you want to display the data and what your intentions are.
On the full-solution end of the spectrum this is what an HMI/SCADA system does for you (www.inductiveautomation.com, for example).
On the roll-it-yourself end of the spectrum it sounds like you just need to continually poll the gateway for the registers you're interested in and maybe display it on a webpage.
Where do you land on this spectrum?

Android: Tap phones to exchange information without NFC

I would like to develop a application that when used between two phone we can send exchange data(like e-visiting card). I intend to develop it for all smart phones even those without NFC. I am just a budding developer and would like to have some references about the possibilities of such an app. i have seen BUMP but i do not intend to maintain any server and would like to create a temporary network between the two phones and terminate it after the transfer. So is there any possibility in developing such an app?
Thanks in advance
Depends on the size of the data, but one possibility that comes to mind is the use of QR codes.
http://en.wikipedia.org/wiki/QR_code
You could try using a library like zxing (https://code.google.com/p/zxing/) to generate the qr codes.
Basically the phone wanting to send the data generates a qr code representation than the phone wanting to read the data reads the qr code with its camera and translates back to the original data.
I think you should try to use bluetoolth or local area network.
I pefer LAN.
In your app , you can set one app as server, another app as client.
make a socket connection and send your data.

Categories

Resources