Create Desktop application for MPU6000 I2C sensor module interfacing with particle photon

Hey, Can you suggest any desktop application sample code which helps to code the particle photon? Basically after the success of this kind of operation,
I want to send the Raw data of MPU6000 I2C module to my PC and convert the values in software only.

Any suggestion on this will be helpful.

Have you tried on the Resources tab on the NCD page?
There is a section Community Repositories with a MPU-6000 GitHub link.

1 Like

Hi, I am using resource code of NCD community, I am working on the project and while using particle cloud to where values of are getting published for different axis, I also want to send the sensor data serially and display it in the application on which I am working.

For testing, I am using the python code

import serial

part = serial.Serial('COM4', 9600);

while True:
    
    k = part.readline().decode('ascii');
    print (k) 

mentioned above code I have tested with Arduino but need some assistance displaying the data serially with the help Particle photon without using any specialized IDE.

Whenever I am running this code after connecting my particle photon it does not display any serial information

Have you added a Serial.println() statement to the code?
The code you linked does initialise the serial interface (Serial.begin(9600)) but never prints to it.
If you can serial print on Arduino you can also with the Photon as it uses the same commands.

BTW, while the code works, this is all but good practice

  // Output data to dashboard
  Particle.publish("Acceleration in X-Axis : ", String(xAccl));
  delay(1000);
  Particle.publish("Acceleration in Y-Axis : ", String(yAccl));
  delay(1000);
  Particle.publish("Acceleration in Z-Axis : ", String(zAccl));
  delay(1000);
  Particle.publish("X-Axis of Rotation : ", String(xGyro));
  delay(1000);
  Particle.publish("Y-Axis of Rotation : ", String(yGyro));
  delay(1000);
  Particle.publish("Z-Axis of Rotation : ", String(zGyro));
  delay(1000);

rather replace that whole block with this

  char data[128];
  snprintf(data, sizeof[data]
          , "Acceleration: %d/%d/%d, Rotation: %d/%d/%d"
          , xAccl, yAccl, zAccl, xGyro, yGyro, zGyro
          );
  Particle.publish("MPU6000", data, PRIVATE);
  Serial.println(data);
3 Likes

How time-sensitive is the data you are trying to send to your PC?

If you are looking to get a stream of data from your sensor with the current data, you might want to look into sending it via Serial/USB. When you plug the Photon in via USB, you should see a serial port populate on your computer. You can open up a terminal (such as screen on Linux or Mac OSX, or something like PuTTY on Windows), and get the data. Using something like Processing, you can write a quick program (in a language similar to what you use to program the Photon) that can do something with the incoming data (like graph it, etc).

If you are looking to just get updates with the sensors reach certain thresholds, such as when the accelromoter detects a large movement, you can use Particle’s eventing system. Using the Particle.publish() function in your program, you can send events over the WiFi to be consumed on your PC (or any PC on the internet). You can see those events show up in the Particle Console when they are triggered as well.

You can find out more about Processing at https://processing.org/.

1 Like