Pololu minIMU9 Step-by-Step

minIMU9The steps below are the things that I had to do with my Raspberry Pi A running Raspian. The steps are based on David Grayson’s excellent tutorial located at:


Prerequisites: You will need to make sure that your device supports i2c. I have a Raspberry Pi A running Raspian and it was not configured out of the box.
First check if you’re ready to go:
ls /dev/i2c*

If you do not see /dev/i2c-0 and /dev/i2c-1 then run the following command:
sudo modprobe i2c-dev && sudo modprobe i2c-bcm2708

Then run the following command again just to verify that you see the two /dev/i2c-0 and /dev/i2c-1 devices.
Also, you will likely want these modules to load on boot so add them to the /etc/modules file.
cd /etc
vi modules
* You can use any text editor to modify the file (I just happen to like vi), but at the end of the file add the following two lines:


Grant permissions for i2c devices:


For granting permissions, I wasn’t able follow the directions on David Gray’s minimu9 tutorial to a tee. I started by typing:

br />

Check to see if i2c is on the list (it was not on my list initially).
sudo usermod -a -G i2c ‘whoami’
When I ran this command, I received a message stating that group ‘i2c’ does not exist.
So, I ran the following commands (assuming that you’re still running all this stuff as the pi user):
sudo groupadd i2c
sudo usermod -aG i2c pi
Now log out (by typing exit) then logging back in as pi. Then type the command:
Now, i2c should show up in the list.
cd /etc/udev/rules.d
Create a file called i2c.rules that has the following line in it.
SUBSYSTEM==“i2c-dev” GROUP=“i2c”
Then type the following command:
sudo udevadm trigger
Now run the command:
ls -l /dev/i2c*
You will see something like this:
crw-rw—T 1 root i2c 89, 0 Jun 22 18:50 /dev/i2c-0
crw-rw—T 1 root i2c 89, 1 Jun 22 18:50 /dev/i2c-1
Make sure that the 4th column of data says i2c as you can see above.


Connecting the MinIMU9
Solder up the MinIMU9 and wire it up with the Raspberry pi as directed in David Gray’s wiki tutorial.

Get the ahrs-visualizer-master and minimu9-ahrs-master files directly from github

check out the README files for each thing then make…
Figuring out which I2C bus you are using:
i2cdetect -y 0 (or)
i2cdetect -y 1 (this one worked for me even though I’m on a 256MB Raspberry Pi)


*When I tried to run this command, I received a message stating that the command could not be found. So I rant the following command:
sudo apt-get install i2c-tools


Then I was able to run the i2cdetect command successfully.
Whichever one gives the 3 hexadecimal values indicates which bus you are using.


Installing minimu9-ahrs


Unfortunately, I wasn’t able to use the Debian package to install because I am using the armhf EABI so instead, I downloaded the source and compiled it.


I used the following command to get the tar file:
wget http://www.davidegrayson.com/minimu9-ahrs/debian/minimu9-ahrs_1.1.1.orig.tar.gz


tar zxvf minimu9-ahrs_1.1.1.orig.tar.gz


which decompresses the files into a directory called “DavidEGrayson-minimu9-ahrs-99f1807”
If you open the README.txt file you will see that it wants you to run the following commands:
sudo modprobe i2c_dev
sudo apt-get install libi2c-dev libboost-program-options-dev
(this second command took a few minutes to run)
Then I typed


to compile the minimu9-ahrs program. (I received a few warning messages about how swp{b} use is deprecated for my architecture, but I don’t think that seemed to cause any issues with the program running successfully.)
If you’re using the i2c-0 bus, then run minimu9-ahrs with the following command:


if you’re using the i2c-1, then run with the following command:
./minimu9-ahrs -b /dev/i2c-1


I tried to run the file, but the program complained that I didn’t have a calibration file or something to that effect. The directory has a program called minimu9-ahrs-calibrate. I tried to run it by typing ./minimu9-ahrs-calibrate but it didn’t work for me. I had to type in the following command to generate the calibration file.
./minimu9-ahrs -b /dev/i2c-1 –mode raw | head -n2000 | python minimu9-ahrs-calibrator > ~/.minimu9-ahrs-cal


(from this point on, I will be using just the command that worked for me.) You can run the raw mode to see if it is working:
./minimu9-ahrs -b /dev/i2c-1 –mode raw


Installing ahrs-visualizer


As before, I wasn’t able to use the Debian package so I had to download the source files and compile:
wget http://www.davidegrayson.com/minimu9-ahrs/debian/ahrs-visualizer_1.0.0.orig.tar.gz
tar zxvf ahrs-visualizer_1.0.0.orig.tar.gz


Again, when looking at the README, it instructs you to run a command:
sudo apt-get install libpng-dev libboost-program-options-dev


Once that is complete, then you can run the make command:


When I did this the first time, the compilation terminated because the compiler couldn’t find a file called vchost_config.h. The file that references that vchost_config.h file is /opt/vc/include/interface/vmcs_host/vcgencmd.h


I modified the file so that it could find the vchost_config.h file. Open the vcgencmd.h file and change line 33 from:
#include “vchost_config.h”
#include “linux/vchost_config.h”


Then I ran make again and it gave me a few warnings about the deprecated swp{b}, but the compile finished!


Then run the following command:
sudo make install_assets


In order to run the visualizer, the calibration file must exist. So if you haven’t already done so, run the following command:
./minimu9-ahrs -b /dev/i2c-1 –mode raw | head -n2000 | python minimu9-ahrs-calibrator > ~/.minimu9-ahrs-cal


This will hopefully say something like:
Reading data… done. (this step takes a 1 or 2 minutes)
Optimizing calibration… done.


When this is done, then you can pipe the output into the visualizer:
./minimu9-ahrs -b /dev/i2c-1 | ../ahrs-visualizer-master/ahrs-visualizer


This last step assumes a directory structure where the folders for the minimu9-ahrs and ahrs-visualizer are in the same parent directory. In my case, I had a project directory called minimu9. Within that I had folders for minimu9-ahrs-master and ahrs-visualizer-master (these were the downloaded folders names from github). The executables are compiled into the master folders.


If this works, enjoy the fruits of your labor and hit ctrl-c when you’re ready to move on to building your awesome minIMU9 based project!


That’s What I Get

Well, I goofed up.  I was doing a bunch of things at once and one of those things was updating my website.  Then I noticed how old my version of WordPress was.  I was on like a 2.x version and the current version is 4.0 so I was like, “Hey, maybe I should upgrade…”

Of course, I didn’t back up my old WordPress so when the automatic upgrade process failed, I was hosed and my website seems completely toasted.  That’s what I get for not taking the necessary precautions.

But I’m going to look at this more as an opportunity to improve the site than a complete web management disaster.  So rather than spend hours trying to get the old thing back up, I am going to cut bait and start fresh.  Plus, my site was looking a bit outdated and I’m sure that the current version of WordPress has a bunch of new features that will make the website a whole lot better going forward so I’m gonna start from scratch.

I’ll start adding more stuff soon and start looking for a theme that is a good starting point for some cool design work.  For now, it’s the default installed theme.  Stay tuned for upcoming changes!

As time allows, I will start reconstructing some of my posts from my old blog.


Whatever is going on in my strange little head…