Teensy 3.1 and MPU-9150 (GY-9150 breakout board)

deelaleo

Well-known member
Hi

I would like to get some breakout board that uses the MPU-9150, with a Teensy 3.1

The problem is that I need 6 of them, and being I2C, I am not sure how to do so (each one has only 2 address, and the Teensy has 2 I2C channels, which gives me 4 as the max amount of sensors usable).

First issue is: how do I hook up these sensor to the Teensy, so they won't conflict?

Second is: did anyone wrote a library for this sensor? I would like to try to write one, but I never did it, so any suggestion is appreciated.

I found some using on Arduino, the library for the 6150; but I am not sure if they were getting the raw data, or they were actually using the processor inside the chip, to get normalized data. I would love to have something ready to use, so if anyone has a teensy library for this chip, would be awesome.
Otherwise I will have to write my own library.

BTW is there another way to program the teensy? or the arduino language is the only way?
 
Thanks for your reply.

So I can actually flip between couples of sensors that has the same address, on the same I2C channel? I need to get to 6 sensor on the same Teensy 3.1,

The library is awesome, and even more awesome, is the doc that goes in detail about it! Thanks a lot! I am waiting to get the sensors anyway now, so I can try the sketch.
 
Even more awesomer are the little MPU9250 add-on shields I make for the Teensy 3.1.

Which I really like :) My problem is that I am hooking up at least 6 of these on the Teensy, so can't get 6 shields and stack them ;)

What do you think about this configuration?

2x9150 on the first i2C bus (pin 18 and 19)
2x9150 on the second i2C bus (pin 29 and 30)
2x9250 on the SPI bus (pin 2 and 6 for the CS, and 11-12 for data I/O)

Would this work? In this way I have no need for a multiplexer. I also have a few 6050, which I could use, but they have no magnetometer, so they would be more prone to drift.

I will try to hook up one per channel and see what happens. BTW; how do I know if the chip is working, without hook it up to the Teensy?
I bought some cheapo 9150 and 9250 ones from a Chinese vendor, which cost me less than $10 each; and they support both 3.3 and 5V; but I don't trust anything unless you guys have experience with these modules

GY-9150
GY-521
GY-6500-GY9150 (both names on the board).

I don't want to burn the Teensy or the chips...I heard horror stories about these chips and their nasty effects, due to bad craftsmanship. They are cheap for a reason I assume.

Once I get my project up and running, I will replace these cheap ones with good ones probably from Sparkfun or Adafruit (unless you can tell me that I will be OK with the cheap Chinese manufactured breakout boards).

And btw thanks for your comments; it is awesome to see that people are helpful, instead than just treat you bad because you don't know things :)
 
I am not sure I understand your configuration and why you need six IMUs but I think you might need to use pins 10-13 for the hardware SPI. In fact, it should be possible to talk to several IMUs through the single hardware SPI port by using the chip select functions of the Teensy SPI library. I haven't done it so take this as just a suggestion and search the forum for SPI threads.

The GY-521 and GY-9150 are fine designs and should work well. You can test the I2C function with a bus pirate, but the easiest way to test them is to just breadboard them with the Teensy to make sure they work right. You will need to calibrate them in your final configuration but breadboarding is simple and cheap.

Do not buy any purple Chinese boards. These are poorly designed and will likely not work or not work well.

It sounds like you intend to have one Teensy drive six distributed sensors; but it might make more sense to have six Teensy + sensor setups that talk to each other or to one master.

In fact you could stack multiple MPU9250 add-on boards, at least one micro board on the bottom Teensy pads, and probably two mini boards at the end of the Teensy with different addresses. So you could in principle get three IMUs per Teensy; although I'm not sure why you would want to.

Of course, you could go crazy and design an add-on board that has six IMUs. But whyever for?
 
I am hooking up different sensors to make a device that can analyze the movement of 4 legged animals (I also have other sensors on top of the IMU sensors, which are only for the data acquisition of legs, tail and head of the quadrupeds).

This is in general lines the project that I have in the pipeline now; it is not a mocap device; I am collaborating with a company that want to research how animals move, and analyze the movements to figure out possible issues before that the animal joint will be damaged (degenerative diseases for the joints, like arthritis and such). Starting with dogs and cats; but ideally it may work for any kind of quadruped.

I was looking at the Teensy 3.1 diagram, to use pins that are only for a specific function (and leave the others free, like the analog ones); and unless I am mistaken, pin 2 only function is CS for SPI; while pin 6 share the CS with a PWM functionality (no way to avoid to loose a PWM, since all the CS pins seems to be on the same pins for CS).
Is not suggested to use these pins for the CS? I indeed forgot SCK, which is on pin 13. I will investigate further; thanks for checking!

Ok, so the 521 and 9150 are reliable for a field product? I just don't want to invest in something that could fail (especially because the code has to be adapted to the sensor, so it may cause a change in design, which is scary). Are these boards reliable when you supply 5V? Or should I just rely on the 3.3v pin that the Teensy use to output the voltage? Each sensor use at most 4 mA under full load, so at most I would drain 24mA for the 6 IMUs, and the 3.3V pin has plenty left (100mA top, which means don't drain more than 80 mA to be safe).

I will keep an eye on the purple ones; the one that I have are all greenish/blueish. I was about to get one on Ebay, that was purple...it was a 3 sensor combo (ADXL 335, 6050 and a magnetometer, which I forgot the chip ID); then I change my mind because there were no libraries to use them :)

6 Teensy plus sensor is not feasible in my case, for 2 reasons: first is costs; the device has to be under a certain cost, since they have to make a considerable amount of those. The second reason is space: the unit has to be very small; for reasons that I am not disclosed about, so I have a limited surface to add components, which means that the only thing that should go on the areas to monitor, is the smallest sensor that I can find.

Design is something out of my capabilities :) I am more versed in software than hardware...in fact this is one of my few attempts at hardware (learned to solder few months ago...just to give you an idea of my level :p I make nice header solder points now! )

Ideally, if I had the skills, I would love to make a board that has a space for a Teensy socket plug-in (to save space compared to a header), where I would be able to have WiFi/Bluetooth, and a different MC that allow you to hook various multiple sensors. All would be sent to the Teensy as cleaned up data, or shot via BT/WiFi to a receiving device :) This is of course impossible for me, since I don't have the basis of circuit design; maybe one day I will learn.
 
I would say the GY-521 and GY-9150 are reliable for testing and prototyping. When you want to go to the field with hundreds of these you would be best served by having someone design a sensor board specific to your application. For example, as you mentioned, you don't need the voltage regulator since you can drive the sensors with Teensys 3V3. You probably will need to package the board against moisture, etc. In other words, you will need to design the sensor package for the specific environment and use case. There is a nice MPU9150 micro board for sale on Tindie that might be even better for your testing since it is very small.
And of course, you could commission boards with other sensors if you need them.
 
Thanks for the hints; could you suggest how to proceed to actually have someone to design and make custom boards? Does it cost a lot?
I don't have neither the skill nor the knowledge to make them at home...saw some videos about making traces using acid, but I don't feel like that's feasible for me :)

From the designs that I received, the main unit has to be located on the collar area; which makes it a safe area from humidity; but the sensors may require some packaging to protect them from abuse thou.

These looks really tiny! Altho how do you change the address for the i2C? Via software?
 
If you want custom sensor boards, I might be able to help. Send me a private message and we can discuss it. If you want to make your own, OSH Park offers excellent quality at a too low price with rapid turnaround. Much better than home pc board making. You would have to use the digital input on the address pin for each sensor to toggle the I2C address. The MPU9150 board I linked might not have broken this out. You could do so on a custom board.
 
Back
Top