I've been trying to connect an MPU-9250 module to my raspberry pi B+ in order to output the sensor's data through a Node-RED UI, i followed this tutorial to setup the MP-9250: https://kingtidesailing.blogspot.com/2016/02/how-to-setup-mpu-9250-on-raspberry-pi_25.html

I can detect the MPU-9250 on address 0x68, and print the sensor's output to the console without any issues, but the moment i start the Node-RED console, it stops working (i had to use a keyboard interrupt to stop the program since it wouldn't give any output). I already tried with another raspberry Pi B+ to see if it was hardware related but the same thing happened, used the same SD with the same image though.

enter image description here The console in the left is the first console before starting Node-RED, the one in the right was started after initiating Node-RED, everything works fine, afterwards i2cdetect -y 1 says that every i2c address is connected, which i believe is the reason why the script doesn't work after this.

I'm really new to the IoT world, and i would like to know if any of you guys knows what's going on.


Update 1:

This is what I get before starting node red

pi@magrazPi:~ $ sudo pigpiod pi@magrazPi:~ $ pigs mg 2 mg 3 4 4

This is what I get after starting node red

pi@magrazPi:~ $ i2cdetect -y 1 pi@magrazPi:~ $ pigs mg 2 mg 3 1 4

I read that 1 means that the SDA pin is configured as an output, how can i change this after starting Node-RED?

  • 1
    Please use formatted text instead of pictures! – MatsK Feb 22 '19 at 9:36

I'd guess node-red is altering the mode of the I2C GPIO so that at least SDA is no longer in I2C mode.

Before and after running node-red (for the first time) check the GPIO mode.

wiringPi's gpio command should have a method. Look at the documentation.

If (my) pigpio is installed you can read the mode with the following commands.

sudo pigpiod # only needs to be run once per session

pigs mg 2 mg 3

The pigs command will get the modes of GPIO 2 and 3 (SDA and SCL).

See http://abyz.me.uk/rpi/pigpio/pigs.html#MG/MODEG

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.