Go Down

Topic: Multiple MPU6050s with Johnny Five (Read 69 times) previous topic - next topic

marnesen

Nov 08, 2018, 02:02 pm Last Edit: Nov 08, 2018, 02:04 pm by marnesen
Hey,

I am trying to set up a control loop using four MPU6050s connected through an i2C bus, nodejs and johnny five, and I was wondering how this should be set up in nodejs.

SET UP ARDUINO/NODEJS

Currently I'm reading data from one MPU6050. I have uploaded the Standard Firmata to my Arduino MEGA Board and use the Johnny five Example code for controlling a MPU6050. See attached code.

SET UP USING ONLY ARDUINO

When I used arduino only to read the IMU values I would get the address of each sensor by connecting each A0 pin to a different digital port, and then set them to HIGH and LOW. This was to deal with the problem that the MPU6050 only have the addresses 68 and 69.

To sum up, how can I get data each of my four MPU6050s in my nodejs code using the johnny five library.


MorganS

I expect you will have to modify the library to define a new type of IMU. It would use all the same functions as the MPU6050 does except each instance of the IMU object would require an Arduino pin number instead of an I2C address.
"The problem is in the code you didn't post."

Idahowalker

There are uController products that have more than 1 I2C bus, such as the Arduino DUE.


There are products that are called multiplexers and either polling or interrupts, from the MPU6050, can be used to control the multiplexers.


For instance, I have set the MPU606 to create an interrupt when data is available and to hold the available data till the data has been read. The interrupt pins can be polled and the data read when the pin is at the programmed state.


If you were to go with something like the DUE and used the uMT library, you'd be able to create a completely interrupt driven operation, ifin you want.

Go Up