Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4562326
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:12:00+00:00 2026-05-21T18:12:00+00:00

I have an app on my iPhone called iSeismometer which reads the iPhone’s accelerometers

  • 0

I have an app on my iPhone called iSeismometer which reads the iPhone’s accelerometers and acts as a server which streams this data via UDP (I can set the IP address and port number). The question is how to read this data stream with Mathematica? Apparently, Dreeves has been looking into this 12 years ago, so I imagine something must have happened in the meantime.

Update
I got two great answers so far; one from WReach and one from Mark McClure. Both are using JLink to get at the data. This seems like a fine approach. However, I was reminded of some work I did on the WII balance board. Using a few free programs (GlovePIE and PPJoy) I got this bluetooth peripheral to appear as a joystick to Windows, and therefore also to Mathematica (via ControllerState). Of course, bluetooth and UDP are quite different, but could something along the same lines be made to work too?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T18:12:00+00:00Added an answer on May 21, 2026 at 6:12 pm

    JLink is definitely the way to go. I prefer to keep my Java code and my Mathematica code separate by compiling a Java programwhich I then call from Mathematica. I set up a Notebook and companion Java program that you can grab here:
    http://facstaff.unca.edu/mcmcclur/UDPFiles.tar.gz

    Here is the essential Mathematica code:

    Needs["JLink`"];
    InstallJava[];
    AddToClassPath[NotebookDirectory[]];
    udpReader = JavaNew["myClient"];
    i = 0;
    While[True && i++ < 100,
      Print[udpReader@udpReadOne[10552]]]
    

    The updReader class is defined by the following Java code.

    // A simple UDP client to read from iseismometer:
    // http://www.iseismometer.com/
    // You can run this from the command line via "java myClient"
    // to check that your iseismometer setup is correct or you can
    // call the the udpReadOne method from another program.
    
    import java.io.*;
    import java.net.*;
    import java.util.*;
    
    public class myClient {
        public static void main() throws IOException {
            DatagramSocket socket = new DatagramSocket(10552);
            byte[] buffer = new byte[500];
            DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
            while(true) {
                socket.receive(packet);
                String received = new String(packet.getData(), 0, packet.getLength());
                System.out.println(received);
            }
        }
    
        public static String udpReadOne(int port) throws IOException {
            DatagramSocket socket = new DatagramSocket(port);
            byte[] buffer = new byte[100];
            DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
            socket.receive(packet);
            String received = new String(packet.getData(), 0, packet.getLength());
            socket.close();
            return received;
        }
    }
    

    Note that you can use the main method of the myClient class to check that your setup is working without Mathematica, essentially taking one potential issue out of the loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iPhone app in which I have a method in ClassB called:
In my iPhone app, I have a class called Contact which consists of an
I have an app which existed as an iPhone app first and now as
I have my iPhone app that calls an ASP.NET Webservice to download data. Most
I have a UIViewController called LaunchController that is launched in my iPhone app when
I have an iphone App that reads the category field from the xml file
I have an iPhone app with this screen: When the user taps a textfield,
I'm using Cocoa Touch to build an iPhone app. I have an NSMutableArray called
I have a MonoTouch iPhone app which has a UITableViewController as it's main view
I have an iPhone app which sends a request to a url posting a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.