Message Boards Message Boards

Using your smart phone as the ultimate sensor array for Mathematica

POSTED BY: Marco Thiel
15 Replies

I no longer see the sensor data app on the IOS store. But see a few other new ones. Is there one that you recommend?

POSTED BY: Jack I Houng

IS there a way to associate the WM code to the phone running on a separate network? Let say that the Phone is running using its own Data Service but my computer is in a separate network. Where do I place the IP in the code since I do not see this address anywhere in the code.

POSTED BY: Jose Calderon

Marco, excellent ideas and thanks for sharing, I've noticed that after some of the modules executed, they seem to keep running in my application (I am using Mathematica v10 in a OSx) is this expected?

Again thanks,

Salva

POSTED BY: Salvador Romo

How does socket get associated with 192.168.1.95:54388? socket is instanced on Port 10552, but what does that have to do with anything?

Thanks for any hint to get me started.

Fred

POSTED BY: Fred Klingener
Posted 9 years ago

Marco,

Can you explain this code fragment from your JLink processing?

packet = JavaNew["java.net.DatagramPacket", JavaNew["[B", 1024], 1024];
POSTED BY: David G

Hi,

"packet" in this case is an object created from the class"java.net.DatagramPacket". The arguments "JavaNew["[B", 1024]" and "1024" depend on the class you are dealing with. For example, I can have a class "ConnectionUDPClient.class" which I can call by obj = JavaNew["ConnectionUDPClient"].

Furthermore, it is possible to access methods inside the class. For the class above, I can have a method "sendMessage" which I can invoke by "obj@sendMessage". Finally, depending on the implemented method, it could also be possible to pass additional arguments. Hope this helps.

Kind regards,

Ricardo

Posted 9 years ago

Ricardo,

I'm a little foggy on the "[B" argument of the nested JavaNew. I think I've seen that before, but I don't recall that notation. I assume it's specifying a buffer of some sort?

Thanks for the help.

David

POSTED BY: David G

Thanks. I'll try it out. I'm running OSX 10.10.5 on my laptop, and Mathematica 10.3.

But I was also trying to run it through the cloud so I could access it from the phone through the Wolfram Cloud app. Where I was seeing blue was on on dev.wolframcloud.com/.

POSTED BY: Kathryn Cramer
POSTED BY: Kathryn Cramer
Attachments:
POSTED BY: Marco Thiel
Posted 9 years ago

Is there an analog of the Sensor Data utility (with the data streaming capability) for Android smart phones?

POSTED BY: Alexey Popkov

Hi Alexey,

yes there are loads. We also wrote a little piece of code for Androids. It is somewhere on the Android Store. I will try to "extract" the program from a Post-Doc and post it here.

Cheers,

Marco

POSTED BY: Marco Thiel

Hi Marco and Alexey,

The app is called "Sensors Prototype" and it can be found in Google Play. We have tried it on the samsung S3 and S4 without issues. We wrote the following code in Java (server side) to test the data streaming:

import java.io.*;
import java.net.*;

    class serverUDP
    {   
        public static void main(String argv[]) throws Exception,IOException {
        System.out.println("    Server is Running ");       
        System.out.println("    In port :" + argv[0]);
        DatagramSocket serverSocket = new DatagramSocket(Integer.parseInt(argv[0]));
        byte[] receiveData = new byte[1024];

        while(true)
        {
            System.out.println("-----------------------");
            DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
            serverSocket.receive(receivePacket);
            String output = new String(receivePacket.getData());
            System.out.println("Received: " + output);
            System.out.println("-----------------------");
        }
       }
    }

Of course, both mobile and server should be on the same network

Regards Ricardo

Posted 9 years ago

okey, the Mathematica code is written to get the streaming data for any source connected into that ip address and port?

By the way, this will help me out...

Thanks

POSTED BY: Fabio Burgos
Posted 10 years ago

Such a big and informative info.

POSTED BY: Benjamin Stuart
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract