Raspberry Pi - MPU6050 - Azure IoT Hub using Node.js RRS feed

  • Question

  • Hi,

    I'm trying to integrate Raspberry Pi with Accelerometer Sensor(MPU6050) and connect it to Azure IoT Hub. I downloaded the example file from "https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-kit-node-get-started" (which actually works pretty well in the case of posting simulated data & I've not tried it out with the mentioned BME280 sensor yet). I installed MPU6050 package from the following links:

    • https://www.npmjs.com/package/mpu6050
    • https://www.npmjs.com/package/i2c-mpu6050
    • https://www.npmjs.com/package/mpu6050-dmp

    I can execute my code with these libraries to get desirable acceleration values independently. But when I try to impart this code into the sample files (from docs link mentioned above) replacing all the functionalities of BME Sensor, I am getting some unexpected errors such as "undefined functions(from the libraries which has been already installed and included)" which never popped up when the same code was run separately. 

    My questions are:

    1. Am I missing out something with the coding or the installation part given I am a bit new to Node.js?
    2. I can run a python code and do the same (works fine). How is it different from this iot-hub-node-application file except for the coding language?
    3. Is there an advantage of using Node.js especially through a repository that contains all the libraries required (given both works through HTTP) than a single python file that does the same? Is there something related to connection stability or are both pretty much the same?

    Any support on these queries would be very helpful.



    Friday, January 11, 2019 5:11 AM


All replies