Pololu minIMU9 Step-by-Step

Posted: June 28th, 2014 | Author: Mike | Filed under: DIY | No Comments »

The 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:

https://github.com/DavidEGrayson/minimu9-ahrs/wiki

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:

i2c-dev
i2c-bcm2708

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:
groups

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:
groups
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

https://github.com/DavidEGrayson/ahrs-visualizer
https://github.com/DavidEGrayson/minimu9-ahrs
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

 

then
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
make

 

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:
./minimu9-ahrs

 

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:
make

 

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”
to
#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!

 


LED Ringlight for the Lego Camera

Posted: June 4th, 2011 | Author: Mike | Filed under: Photography | Tags: , , , , , , , , | No Comments »

Lego Camera Ringlight

I’ve always loved the look of photos taken with a ringlight.  About 6 years ago, before my son was born, I built a ringlight using some circular fluorescent lights and a chip and dip bowl from Big Lots.  It produced the look I wanted, but the ballast required to power the lights made it a bit heavy and unwieldy.

In November of 2009, a fellow by the name of Jani ‘Japala’ Pönkkö made a cool DIY ringlight using automotive LED rings.  Since those LED rings could be battery powered, I thought that would be a good fit for the Lego camera.

Read the rest of this entry »


The Lego Tripod Mount

Posted: May 29th, 2011 | Author: Mike | Filed under: Photography | Tags: , , , , , , , , , | 2 Comments »

Here are the build instructions for the Lego Tripod Mount that accompanies the Lego camera.  Please keep in mind that unless you’re willing to bond the tripod mount to the Lego camera (and glue together all the Lego pieces that make up the camera), the camera can still be knocked off the tripod with any decent amount of force.  With that said, this tripod mount is very handy for keeping the camera steady for making videos like the one below.

Read the rest of this entry »


Working DIY Lego Camera!!!

Posted: May 17th, 2011 | Author: Mike | Filed under: Photography | Tags: , , , , , , , | 12 Comments »

This is a working digital Lego camera that takes real photos.

One day recently, I was sitting with my son and we were tinkering with his Legos.  I made something that looked like a camera and pretended to take some photos of my son with the Lego camera.  Then thought that it might be fun if I could build a little case for the iPhone 4 so that I could actually take some photos and videos with something that looked like a little Lego toy.  I used a wheel as a fake lens, a window as a fake viewfinder, and round button-like piece as the fake shutter release button.

If you actually build something like this, you’ll notice right away how much easier it is to hold the camera steady in almost all situations.  If needed, a tripod mount can easily be created by gluing a 1/4″ nut into a couple sacrificial Lego pieces.  But the functionality of the case is only half the point of this thing.  Try taking a toy camera like this to a party – it is the ultimate ice breaker.  You’re sure to enjoy compliments from curious onlookers about your one-of-a-kind photographic device!  C’mon, who wouldn’t want their portrait captured with a Lego camera?!

This is a very simple and fun project and can be used to turn any smartphone into a Lego “camera”.

Update (7/19/2011) – I finally got around to making a build video. Enjoy!

Update: Click here for step-by-step instructions on how to build this particular version.

Read the rest of this entry »


My DIY iPhone Tripod Mount

Posted: March 6th, 2011 | Author: Mike | Filed under: Photography | Tags: , , , , , , , , , , , | 6 Comments »

What I made…

Why I made it…

So I have had an iPhone since mid 2008 and I’ve always been a huge fan of it.  Last year, I upgraded to the iPhone 4 and was excited to use its 720p recording capabilities along with all the other cool things.  I used the video camera a few times and after a few weeks, it became one of the less frequently used apps on the phone.  One of the reasons was that it was very difficult to record good looking video.  I knew that it was prone to the “wobble” effect if you panned too quickly, but even when trying to minimize panning, the small form factor of the phone made it difficult to hold steady.

Read the rest of this entry »


Chava on Closr

Posted: April 25th, 2010 | Author: Mike | Filed under: Photography | Tags: , , , , , , , , | No Comments »

Here is another portrait from my archives. This one is of Chava, a local surfer. Usually, I like my subjects to look into the camera because I feel like it is a bit more personal and more likely to connect the viewer with the subject. Perhaps it is because of the extreme closeup nature of the shot, but Chava’s off-camera stare still seems to invite the viewer into his personal space.

Click on the full-screen button in the upper-right corner of the image below for the best viewing experience!

Chava (for anybody without the Flash player)