chipKIT® Development Platform

Inspired by Arduino™

Library for the Pololu MinIMU

Created Sun, 04 Mar 2012 04:15:31 +0000 by JerryH


JerryH

Sun, 04 Mar 2012 04:15:31 +0000

I'm new to the UNO32 and I'd like to use it with the Pololu MinIMU which is a 9DOF sensor. Pololu offers two Arduino Libraries for this device: one for the L3G4200D and the other for the LSM303.

(I wanted to include links to the part and the libraries, but as a noob I guess I'm not allowed to post links).

Has anyone attempted to convert these libraries for use with the Uno32? Is there a lot of work involved in doing a conversion like this?

Thanks,

-J


dangeljs

Sun, 04 Mar 2012 15:35:13 +0000

That is interesting that you asked this question. It was my goal this week to port this over for a project I'm working on. I don't think that it should be too hard, but I haven't dug into the .CPP files yet. A problem that I know off the bat is that it is set up for Arduino 1.0 which uses different key words for writing and reading the I2C (wiring). If I have any luck I'll post back. If you decide to try please let me know if you have any success.

Thanks,

Jason

If anyone else is interested here is the link:

http://www.pololu.com/catalog/product/1265

Just click on the resources tab in the middle of the page.


dangeljs

Sun, 04 Mar 2012 16:04:30 +0000

I made the changes I spoke of above (refering to i2c) and modified the top of the header files to read:

#include "WProgram.h"

instead of:

#include "Arduino.h"

and it compiles. I don't have time today to test library with the hardware, but I'll let you know tomorrow.


JerryH

Sun, 04 Mar 2012 19:59:24 +0000

Sounds great Jason! I'm eager to hear how it turns out. I can help with debug and test if you'd like-I was just unsure where to start.

Thanks.

-J


dangeljs

Sun, 04 Mar 2012 23:49:15 +0000

Here are the modified libraries. I was able to do a little testing today afterall, and there appears to be some issues still. When I run it with the provided python script the cube does a couple 360s and then a error pops up saying:

ValueError: invalid literal for float() -2147483648.-2147483648-2147483648

I believe there is probably some sort of variable type issue, but I'm not sure if it is in the library or the sketches provided by polou. I had this working a couple days ago with an arduino, so I know the python script is working. Since I don't know Python this is a good thing. If you care to try it out let me know if you have any luck.

Jason


dangeljs

Mon, 05 Mar 2012 14:03:25 +0000

Okay Jerry,

I have it working with the provided Python script. I had to find all of the

int

declarations and change them to

int16_t

in the .cpp/.h and the actual sketches (.pde). This allowed for the program to show the roll/pitch/heading, but there seems to be a lot of drift in the roll and pitch. When I let the IMU sit for 5 minutes or so the roll has gradually rotated CCW about 45 degrees. I'm trying to track down were it comes from, I think the Gyros may be throwing off the calculations a bit. The constantly output low negative numbers and don't seem to be averaged around zero, more like -5 or so. In any event, if you use the previous attachments and make the type changes you should be on your way.

Jason

Edit:

Try this attached it should work for you. You'll have to calibrate your compass and add the proper values in the 303 .cpp file. The roll and pitch seem to be stable (just a little latency in moving). Don't worry about changing the .pde file.


JerryH

Tue, 06 Mar 2012 05:39:09 +0000

Jason, Thanks for working through this and supplying the corrected code. I'll give it a try in the next day or two and let you know what I find.

I'm excited to get this working!

-J


JerryH

Sun, 15 Apr 2012 04:32:55 +0000

Sweet! :lol: I finally got some time to mess with the 9DOF sensor and Jason's code--I got it to work. I've calibrated my compass and I'm off and running.

That python program is nice!

Thanks again Jason,

-J