I have a netduino and a MinIMU-9. I´ve tried to get the minimu to run but i have problems to get the right data.
So i checked the samplecode on github and converted it to c#.
The values i get did not make sense.
I hope someone could help.
The sources are placed by github, so that everyone could look at it and hopefully help.
Thanks in advance
I recommend working on one sensor at a time. Can you post the values you are reading that do not make sense? Also can you post a wiring schematic?
here you get some data:
Roll:NaN Pitch:NaN Yaw:NaN Gyro X:14 Gyro Y:6 Gyro Z:65527 Acc X:771 Acc y:771 Acc Z:771 Mag x:9 Mag y:65437 Mag z:381
and a picture from the wireing
Your wiring looks fine to me. I am not excited about your whole approach to this problem. You ported a lot of code and then are looking at the final output and expecting it to be correct, and when it isn’t correct you are asking us to look through all your lines of code to find your problem. Can you focus in on one sensor that you think is wrong and investigate what is going on with that particular one? Just one line of debugging output is not useful. Try running it for a while, doing things with the sensor, and try to match your expectations to what you are getting. Some of your numbers look very high, like perhaps you are overflowing unsigned variables in the negative direction. If you are still having trouble discovering the problem, I recommend making simple programs that test a single part of your system and building up from there. For example, testing that you can read device address registers would let you know that your I2C communication is working correctly.
Yes you are right, that was also my feelings to it, so i reduced it only to the magnetometer to see what i get.
I was looking for the max an min values and get the following:
xmin:4 ymin:5 zmin:1
xmax:65534 ymax:65532 zmax:65522
in some directions the value for the heading is jumping from 0 to 45. i don´t understand why.
I would be nice if you can have a look on it.
You might find this forum post relevant to your problem.
In your magnetometer code where you do:
_rawData.x = (xhm << 8 | xlm);
_rawData.y = (yhm << 8 | ylm);
_rawData.z = (zhm << 8 | zlm);
It should probably be:
_rawData.x = (Int16)(xhm << 8 | xlm);
_rawData.y = (Int16)(yhm << 8 | ylm);
_rawData.z = (Int16)(zhm << 8 | zlm);
Can you try that and see if it helps? If it does, can you try applying the same principle to the other sensor conversions?
the int16 was it. now the magnometer works well.
Now i´m at the gyro. if i´m not moving the minimu i get the following values:
X: -23.00 Y: 2.00 Z: 0.00
X: -71.00 Y: -15.00 Z: 8.00
X: -28.00 Y: 1.00 Z: 14.00
X: -59.00 Y: -2.00 Z: 39.00
X: -41.00 Y: 17.00 Z: -9.00
X: -29.00 Y: -5.00 Z: 17.00
X: 6.00 Y: 6.00 Z: 36.00
Do i have here also a conversion problem ?
Thanks in advance
Glad to hear you got the magnetometer working.
That looks like normal gyro noise. Can you see if it changes significantly if you turn it ( by a few hundred or thousand) if you turn it?
If i´m moving it in all direction i get the following:
X: 70.00 Y: -1034.00 Z: -6452.00
X: -10566.00 Y: -3518.00 Z: -414.00
X: -4906.00 Y: -2203.00 Z: 6768.00
X: 5000.00 Y: 505.00 Z: 7205.00
X: 5758.00 Y: 497.00 Z: -4784.00
X: 3262.00 Y: 1014.00 Z: -3230.00
X: -6787.00 Y: -2441.00 Z: -796.00
X: -6364.00 Y: 506.00 Z: 5629.00
X: 1867.00 Y: 1956.00 Z: 14590.00
and if i hold it then still in some direction i get the “normal” noise
i thought that the gyro is still holding it position and give me the difference to it
Those numbers look normal. It sounds like you are expecting the gyro to tell you how much you have turned it (an angle). That is not what it measures; it measures how fast you are turning it (angular velocity). Keep in mind that the gyro will have a certain amount of noise and offset.