car compass (fail)

So, recently I quit my old job at Eaton and started a new job at GM.  Both automotive companies, neither really much of a difference in the world and my part in them is doing even less useful stuff for the world.  That’s not important right now.  What is important is that I can get a better parking spot by having a GM vehicle (not entirely true, but I’ll go into that later).  I took this as the time to upgrade from my 2000 explorer eddie bauer edition with the most anemic engine and slushbox offered in that year, but all the bells and whistles to a 2003 saturn l200 with no options at all as far as I can tell.  This bumped my fuel economy from about 12mpg (as read by the green VFD in the explorer’s center console computer thing) to near 22mpg (as calculated by me keeping a spreadsheet of the fill ups I make in the saturn because I’m a nerd).  I also lost all the cool options I had, sun roof, power heated seats, cd changer, trip computer, and best of all: compass.  Some people may take for granted their old heap with all the options that’s worth about $800 had a compass and that any newer car will, but that’s not the case.  My new car didn’t (along with holes in the exhaust, a plate glass driver’s mirror, no hood release cable, broken windshield, and a really shitty radio) so I decided to add one.

When I’m driving around the most useful thing I can have to navigate is a compass, since this is Michigan (could you tell since I moved from one car related company to another) the clouds cover the sun and stars most of the time so I can’t use celestial navigation as much as I might want to.  If I’m in a subdivision that has lots of turns it helps to know which direction I’m pointing when I choose my route, or even when I’m on a main road that’s not a mile road, or one that intersects not at a right angle (I know, madness).  I have an IMU, I have an arduino, I have a display, how hard could it be?

The IMU I used is the mpu9250, a very popular one with enthusiasts interested in quadcopters, balancing robots, VR controls, whatever.  By picking a popular one I could use a nice library written by someone else.  That library even has optimizations for the teensy 3, which is cool.  I based my code off the teensy 3 example code but removed all the display code and substituted my own.  You may recognize my old code from this display I salvaged back in the day.  The cool thing about this IMU is that it also includes a temperature sensor which I can use. That gives me a total of X, Y, Z acceleration, gyroscope, and magnetometer as well as a thermometer all using only 2 pins!

Some of you may not recognize how useful a thermometer that updates live can be on a vehicle, let me disabuse you of that notion right now.  For some of you, the temperature outside your car may not change significantly from when you get in and start driving until you get out at your destination, but that is not always the case for me.  When you drive straight north for four hours in Michigan in winter you can go from slush, to ice, and back again several times which is nice to know considering that while you may be a consistent temperature and humidity in your seat the tires that keep you on the road are not so lucky.  That being said for my revision 1 I chose to put the sensor inside the cabin because I know from experience pushing i^2c over long distances near noisy electronics is a recipe for failure.

I also added a potentiometer and am reading that in a loop and mapping it to the brightness levels of the display.  I thought about trying to tie into the dimmer circuit in the car, but for now what I have is a stand alone device that I can velcro to the dash.  Should I want to integrate it into the vehicle wiring all I would have to do is adapt the dimmer signal from 0-12V to 0-3.3V and I’m done, the code’s already written.

That’s where this project stands, It’s a small self contained compass with temperature reading capabilities (limited range, but whatever).  I will also note that this does not work in my car.  This may not work in any car except this one but there is still a hope.  I originally stopped here when I got this working and realized that it had the exact same issue as a friend’s laser/radar scanner (in that it always read north east).  I was subsequently informed that certain aftermarket products have a calibration mode where you are instructed to circle clockwise and counterclockwise in a parking lot to establish ranges.  I know nothing about this calibration routine, but I should be able to figure it out some time soon.  As it stands this is a fail, but I use it as a thermometer in my bedroom since it’s just powered by a usb port.

My code is here

Additional images can be found here


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: