FMA Direct Cellpro 4S Serial Protocol

The FMA Direct Cellpro 4S is a great RC LiPo battery charger. It reports status over a 3 pin serial interface, see the RS-232 adaptor here. The serial protocol is proprietary; someone reverse engineered it and wrote a nice windows client but did not publish the protocol. I want to monitor it in Linux, so I reversed most of it:
Sample: S012C03AD03AF03AF0000 03000216000000000095044B0 703
Key   : S012Caaaabbbbccccllll ????????????????????????? d?e

Sample: 0000014301FF 0205 00C1 0062 23230000 23230000 03AE 
Key   : ???????????? ffff ???? iiii ???????? jjjjkkkk ????

Sample: 03D0 03AA 0095 1006002C0511
Key   : gggg hhhh mmmm ???????????1

(Normally it's all on one line; split here for readability)


aaaa -> cell 1 voltage (hex)
bbbb -> cell 2 voltage
cccc -> cell 3 voltage
llll -> cell 4 voltage
  unit = 4mV

d - state:
  - 1 discharging
  - 2?
  - 4 waiting for battery
  - 5?
  - 6 charging battery
  - 7 balancing battery
  - 9 charge complete

e - number of cells (1-based)

ffff -> supply voltage (0205=12.20V)
 -> unit = 23.59375mV

gggg - battery percentage
     00AA = 17%
     0300 = 77%
     03AA = 94%
     1000 = 410%
     -> unit = 0.10%

hhhh - battery percentage when first connected (?)

iiii - seconds elapsed

jjjj - mAh in lower (1000 hex = 11 mAh; 8000 hex = 91 mAh)
kkkk - mAh in upper (1000 hex = 745472 mAh; 0100 = 46592; 0001 = 182 mAh)

mmmm - charge current
     - 1000 = 25A (unit = 6.10mAh)

Does CyanogenMod Have Wimax Yet?


python service exception logging

I run a few python services through GNU screen; the problem is that if/when they crash, the exception and stack trace information is lost, the screen exits, and I need to manually restart them. Here's some template code I've started using to improve that situation: import logging, traceback log_fn = 'except.log' log_fmt = '%(asctime)s\t%(message)s' log_dfmt = '%Y-%m-%d %H:%M:%S' logging.basicConfig(filename=log_fn, level=logging.DEBUG, format=log_fmt, datefmt=log_dfmt) console = logging.StreamHandler() console.setLevel(logging.DEBUG) fmtr = logging.Formatter(log_fmt, log_dfmt) console.setFormatter(fmtr) logging.getLogger('').addHandler(console) while True: try: run() except KeyboardInterrupt: raise except: logging.error(traceback.format_exc()) pass

svn to git repository migration


EEE PC 1015PEM-PU17 BCM4313 Linux Wifi Support In Debian Squeeze

The Asus EEE PC 1015PEM-PU17 uses BCM4313 for wifi. Broadcom released a BCM4313 Linux driver about a month ago, and it's already been backported into Debian squeeze's 2.6.32 kernel. But you still need to manually install the non-free BCM4313 firmware.

High Quality Wireless Audio From An Android Phone

I've been thinking about ways to use the EVO as a car audio player (augmenting/partially replacing a carpc with dash-mounted touchscreen). What's the best way to get high quality audio from it? Options:
  • Headphone Jack. But it's a hassle to connect a cable all the time. And the headphone output on the HTC EVO is almost 1990s-laptop-bad; it's pretty clear that HTC cut corners on the analog filtering. The bass is badly distorted.
  • USB. Apparently some head units can mount a smartphone as a USB storage device, and then play audio from it. This approach requires only 1 cable to both charge, and get audio from, the phone. And it can provide high quality given the decoder, DAC, and amp are entirely outside the phone. But, I want to control playback from the phone itself, and don't have (nor want to buy) one of the few headunits that support USB. Finally, the USB storage approach is incompatible with streaming audio over 3G (Pandora).
  • HDMI. Might be possible, but still has the cabling problem.
  • Phone-as-Wifi-AP: This is not so bad -- allows lossless audio streaming over IP, but, it prevents the phone itself from accessing the Internet via wifi (which is a bummer when parked outside a Starbucks).
  • Ad-Hoc Wifi: Isn't supported by Android yet
  • Car-as-Wifi-AP: More difficult to implement (most USB Wifi dongles don't support AP mode in Linux; I don't want to add a standalone AP in addition to the CarPC). And it would probably break internet access on the phone, as the CarPC is not a gateway.
  • Bluetooth: Connect a $20 USB BT dongle and then use the CarPC as an A2DP SBC sink (or, buy/build a standalone BT DAC). Unfortunately, Android doesn't support A2DP MP3 or AptX, and SBC is a poor codec. But the headphone output on the EVO is so aweful, that a good USB DAC on the CarPC should easily beat it, even after the SBC losses. And this approach doesn't require cabling and doesn't conflict with internet access over wifi.

Top 50 Twitter Clients By Number Of Tweets


Google Prettify Syntax Highlighting With Django Mingus

Apparently Google Prettify is built into django-mingus. Instructions
Test: # comment while True: print('hello')

Sprint Visual Voicemail on Cyanogenmod HTC Evo 4G


OpenGL ES Tutorial for Android

Very clear and helpful: OpenGL ES Tutorial for Android

Tuning SSDs In Linux

Just giving this some PageRank help, to hopefully improve Google's mostly old/wrong/useless results on this topic.

Tuning Solid State Drives in Linux


Charging A Blackberry In Ubuntu Lucid Lynx

sudo apt-get install barry-util

And then plug it in.

There's also a kernel module for this. But, the userspace option above is nicer.


The Un-American Energy Sector

12 of the 20 biggest public energy companies are now non-American. And the gap increases if you count state and privately controlled companies in Russia and the Middle East.

http://www.google.com/finance?catid=60918252&sort=MARKET_CAP#link_Market Cap


Hello World

Up and running with django-mingus.