Showing posts with label Battery gauge. Show all posts
Showing posts with label Battery gauge. Show all posts

Saturday, January 9, 2010

Launch of Development of the PakTrakr application

Sorry for the long wait between posts.  I spent a week at the insanity called Disneyland, then had a very relaxing week between Christmas and going back to work on January 4.  I didn't do any physical work on the car in that time, but I did spent a lot of time on the development of of a program that reads the data out of the PakTrakr battery monitoring system that I'll be buying later on in the process.  The PakTrakr has a small dashboard display, but it also outputs a data stream each second on a serial port.  My idea is to read that raw data and build an application that would show the data in an improved manner, and also derive important user information like distance to "empty".

See this blog post for the details on my choice of device.

I first had to download and install the free software development kit.  Then I started playing with sample code, and slowly build up the features of my application.  After a couple of weeks of learning, searching and experimentation, I've got a lot of stuff done.  I ported the PakTrakr parsing code from Doug Teeple.  I then built the application skeleton based on a series of tabs.  The first tab will exploit the GPS and mapping functionality to track the progress of each trip:


The next tab will show the readings of the battery pack as a whole, in analog gauge format.  I couldn't find any gauge controls in the Android toolkit or on the web, so I wrote my own.  There's a Percentage of Charge gauge, pack temperature, pack voltage and another custom gauge I wrote that shows the flow of current into the pack during charging, or out of the pack during driving:


The next tab will show the details on each battery in the system, with voltage readings and any errors:
The next tab will show a list of current and past problems with the batteries.  I'm still working on that so there's nothing to show.


The last tab will show the settings controls.  Right now, most are used only during development of the code, but others will be used in the course of running the app during driving and charging.


More updates on the code as things progress.

Sunday, November 22, 2009

Plans for the battery management and gauge system

People might think that electric car conversion is a bleeding-edge activity.  Not so!  I fact I'm going to leverage some hard work done in the past with some futuristic technology for my battery management gauge system.

First, we start with the PakTrakr.    I don't know why they hate the letter c so much; must have had a bad Sesame Street experience...  This device measures the voltage on each battery in the system, battery pack temperature, current draw while in use and alerts when any reading goes out of spec.  These are all of the values you need to know your % of charge and, after a few trips, your full-charge driving range and remaining driving range.  The unit comes with a dashboard mounted display that does the job, but screams out for a sweeter display.


Where the awesomeness really comes in, is the PakTrakr has a serial port output.  It spits out a CSV (comma separated values) data stream each second, with all of the relevant data.  If I had a computer of some kind that read the data and displayed some graphs, that would be perfect.  I did some investigation of "car PC" equipment and found most people go for a tiny PC with an LCD display.  Of course, these car PCs normally have music, GPS, video, cellular telephone and other features included.  I wasn't sure I wanted a dedicated, expensive device so I started thinking about using one of the new generation smart phones as my computer.  Most phones have a USB connection and I can easily convert the PakTrakr's serial cable to USB.  Writing an app that reads the USB port, parses the data and displays the graphs gets me what I want.  There is one downside - I would have to plug the USB cable in each time, and hack the wire to deliver +5V to keep the phone charged.  I suddenly realized that smart phones have a wireless Bluetooth facility, and I found serial-cable-to-Bluetooth adapters on the web.  So all I need to do now is to write code that reads the Bluetooth connection, and I don't have to be hardwired into the car!

Now what phone to get.  iPhone is the obvious choice due to market popularity, but frankly there are a couple of problems writing apps for the iPhone.  First, you have to develop your code on a Mac, nothing else.  I don't have a Mac or Mac development skills, but I'm willing to leverage my Java skills to get me where I need to be.  The second problem is the bizarro-world of iPhone app approval.  I don't like the way Apple is handling this, in typical mysterious we-know-what's-best-for-you style.  So iPhone is out.


This leaves an Android-based phone.  Android is Google's open-source Linux-based smart phone operating system and development platform.  The whole operating system is completely open source, apps are written in Java, and there is no "approval process" for apps that developers write.  Sounds like this solution is for me!  There are several Android-based phones on the market now, and the latest is Verizon's Droid phone.  I played with it at the store the other day and it's just beautiful and feature-packed.  I installed the Android 2.0 development kit and there is support for reading Bluetooth serial port sockets.  Now I just have to switch from T-Mobile to Verizon, sign up for the plans and get a Droid.


The heart of the code will be parsing the PakTrakr's CSV data stream.  I read about Doug Teeple's Sharp Zaurus project where he did the same thing I want to do, but on an older PDA device.  Doug's web site shows off his Karmann Ghia electric car conversion efforts.  In the spirit of community I emailed Doug and asked him if he would be willing to accelerate my development by contributing his CSV parser code he's already written.  He quickly wrote back to say he would do so.  It's in C, so I'll easily translate it over to Java, and then write the rest of the app around it.  I will make the final application and all of the source code available for free download here. Stay tuned for updates in this area.