Sending speed datas from MPU6050 to Labview through Ethernet

Hello everyone !

I work on a project that implies a MPU-6050, an Arduino Uno (and the Ethernet shield 2) and Labview (2019 version). My objective is to measure the angular speed of a rotating machine with the MPU-6050, and to send the datas to a computer through Ethernet. Then I use Labview to display this datas on a graph (also calculating and showing the angular acceleration), and write it on a txt file.

My problem is that I don't manage to receive the datas on Labview (I just get a line of 0 on the graph and the txt file, and it doesn't change when the machine is turning). I don't have any error message on Labview, so I guess I did something wrong on Arduino, so the datas aren't even sent (first time using Arduino, so it wouldn't surprise me either if I missed a point), even if I don't have any problem during the compilation.

In my tests, I put the same communication port (port 1000) and IP Adress in the Arduino and in the Labview code (so Labview knows where to search), and I modified the parameters of my computer to get a fix IP. But in any case I don't manage to get the datas on Labview ...

Can you help me to solve this problem and improve my Arduino program please ?

I join to my message the Arduino program and the Labview VI I used.

Thank you for your help !


Arduino code :

#include <Wire.h>
#include <I2Cdev.h>
#include <SPI.h>
#include <Ethernet.h>
#include <MPU6050.h>

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 
IPAddress ip(192, 254, 142, 79);
IPAddress myDns(192, 254, 1, 1);

// On définit le port 1000
EthernetServer server(1000);

MPU6050 centrale;

//On initialise les variables de vitesse angulaire
uint16_t gx, gy, gz;

void setup() {

  // initialize the ethernet device
  Ethernet.begin(mac, ip, myDns);

  //Initialisation du MPU-6050 & définition de l'étendue de mesure
  //Calibration des 3 axes du MPU-6050
  // Open serial communications and wait for port to open:
   while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only


  // start listening for clients


void loop() {
  // wait for a new client:
  EthernetClient client = server.available();

  //On mesure les vitesses angulaires dans les 3 axes

    if (client.available() > 0) {
            // Envoyer les données mesurées au client :
      server.write(gy * (M_PI / 180));
      server.write("\r \n");

ChatServer_MPU6050.ino (1.39 KB)

Have you had any success with just the Ethernet library examples?

Ditto with reading the sensor standalone?

Only when both of those steps have been achieved should you think about combining them -
proceed by small steps from known good examples is the way to get things integrated without
getting stuck.

Perhaps there's a problem with the comms over Ethernet? Perhaps there's a problem with
comms to the sensor? Perhaps the sensor is really sending zeroes for some reason? So
many ways this could be misbehaving, its best to nail these down one-by-one.

Or .... could you not just use serial rs232 - that is simple at both ends !

Hey ! Unfortunately, there are several restraints on this project, and the communication is one (the type of connectors availables). The only possibility I have is to use an RJ45 cable.

You can send rs232 down a cat 5 cable

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.