PersonalSoundtrack: Development Blog

The open-source music player that detects your walking or running speed and plays songs from your music library that match your pace. Song speed is adjusted in real-time to match subtle variations in your gait, while larger, deliberate pace changes cause the device to change songs. You simply put it on and begin moving; that's it.

Monday, December 04, 2006

Version 3.0 Complete.

So, in almost exactly 30 days, I've accomplished my goals. I have the finished product in my hand (though I still need to figure out how to custom design a case for it).

First, here are some fuzzy (sorry, it's late!) pics of the device without its jacket:





Time to go over the meta-list of what I've accomplished thus far:


  • Develop power solution that requires only one single-cell Li-Ion battery

  • Develop a pocket-sized, light version

  • Develop a deployable method for recreating the OS easily should the image become corrupt

  • Decrease power consumption by 75%

  • Reduce computational load by %50

  • Develop a custom circuit for measuring steps

  • Custom circuit must be cheap, light, require little power, and be robust

  • Custom circuit must fit into 1"x1" space, and be only .15" thick.

  • Custom circuit must accurately detect steps in less rigid and stable environments (pockets instead of belt)

  • Cost of ALL parts must be below $250 including battery, case, memory cards, etc.



Many of these require elaboration.

To reduce power usage to allow for a single-cell li-ion battery, I had to build my own accelerometer circuit. This was odd because li-ion's tend to run from 3.7 down to 3.0/2.8, and the gumstix has a minimum voltage of 3.3. Thus, my custom circuit needed to function well in the 3.3 to 3.7 range. This affected the capicitors and oscillator i used in the custom circuit.

To develop the pocket-sized version, i had to essentially cut the previous thickness down to 1/4 the size of version2, and reduce its height and weidth down to the size of the audiostix board. I did this by dropping the compact flash board and using MMC storage instead, using li-ion batteries, creating the custom step-detection circuit that is the size and thickness of a silver dollar, and rewriting logic to compensate for the bizarre vibrations that as a result of the device beingi placed in the pocket. Versoin 2.0 was securely fastened to the waist with a large belt, which helped minimize noise on the accelerometer. While this works, and other developers rely on armbands and such for accurate accelerometer data, I wasn't satisfied with being forced to wear a belt or armband. The pocket version only requires vertical orientatoin at this time, but works fine while being bounced off the leg during walking. Orientation will be compensated for in subsequent versions. Unfortunately, the largest part of the device is the antenna used for bluetooth communication. I'm looking into smaller, chip-based antennaes as an alternative.

Typically, the gumstix has 16MB of flash memory onto which the OS is flashed. This is a slow process requiring access via serial to the gumstix console. The problem is that the jffs2 based images can become corrupt if power is unexpectedly lost, or for a host of other reasons. In the past, this happened to me and I had to disasseble the entire device, reattach the serial board (none of my previous purchased boards had breakouts for ttyS0), and reprogram it. Furthermore, the process would have to be duplicated for additional devices. Instead, an involuntary requirement forced me into a better solution. There was a shortage of bluetooth motherboards from gumstix during the time I needed to purchase another (I was still demoing version 2.0). I ended up tracking down an old gumstix bluetooth motherboard that someone was selling. Unfortunately, it only had 4MB of flash memory (python alone takes up 7MB). Thus, I wouldn't be able to flash the entire OS onto the gumstix motherboard. After some communication with a gumstix developer, he told me there was a method of placing the filesystem on the mmc card and pivot-root'ing that after boot. After several exchanges, he provided me with many commands to achieve this. After some testing and modification to his commands, I was able to create the filesystem and pivot-root from a small OS stored on the 4MB flash to the full-sized filesystem stored on the MMC card. The benefits of this are obvious: if the filesystem on the MMC becomes corrupt for whatever reason, it can simply be removed, plugged into my laptop, where i keep a backup copy of the mmc card files, and i just copy the filesystem back over. plug the mmc card back in, and i'm back up and running in less than 5 minutes. of course, its always a possibility that the filesystem stored in the 4MB flash could become corrupt, but since its very unlikely that the system will be powered on and powered off right at the time when the default OS has booted, but before the new root has been pivot-root'd (which gracefully unmounts the filesystem stored in the on-board flash), this is much less likely.

To decrease power consumption by 75% and reduce computational load by 50%, i simply had to create the custom circuit and reduce computational load. By offloading processing on the pic (which is better suited to high-speed analog reading than the linux motherboard), the gumstix boards do VERY little, and use less power. Furthermore, the pic can be run at lower voltages, which allows for smaller/different battery types. Previously, the gumstix board was forced to read from the accelerometer over serial at 30hz, which tied up quite a bit of IO and computational power.

The development of the custom circuit was the main push of my time. I ended up using a pic chip that reads a PWM accelerometer, determines if a step has occurred, computes steps per minute, and sends that value over the serial line to the gumstix. The code was written in assembly, and timed at the microsecond level. An LED is lit up whenver a step is detected for feedback. The trials and tirbulations of developing this circuit is spelled out in length in this blog and in my reports.

In order to fit the circuit into the size requirements, i ended up cutting off the pins of the pic chip, and soldering the parts directly to the chip. no circuit board was used as it added too much thickness. the entire circuit could be no thicker than the height of the pic chip if it was to fit nearly flush with the li-ion battery. This was difficult and required several prototypes including a breadboard version, and debug version, a final version 1, and a resoldered version to that moved the custom circuit to a different spot on the gumstix board and incoporated an on/off switch and led for step detection feedback.

Cost of parts was limited to the best value parts available where substitable (that is, anythign other than the gumstix):
Gumstix Motherboard w/ Bluetooth: $179
Gumstix Audiostix: $40
MMC card 1gig: $35
Pic Chip: $0.75
Li-Ion 860mAh battery: $7
Caps, oscillators, resistors, LED: $1
Total: $262

So my goal was $250 and it costs $262. pretty close. I haven't added the cost of a case as it hasn't been designed, but it should be worth noting my original estimate didn't include the MMC card, which would have made my goal $285.
In fact, the current device sitting next to me is an older gumstix board.

The final things to implement are creature comforts: volume control via GPIO interrupts (easy) and case design.

I'll be building the second device next week as I've already received the parts, so I expect to just solder together the step detection circuit and copy over the mmc card files to the new mmc, and that should be it! Very easy to assemble, actually.

Lastly, I'll include a final abstract diagram of the hardware components involved, which I may use someday to develop a completely custom device.

1 Comments:

At 5:15 AM, Blogger kazi said...

sorry to comment here, but I couldn't find a contact on you synchstep page, so this is the way I've found to reach you: how can I download and test synchstep?
my e-mail is jmmkazi@gmail.com
thanks

 

Post a Comment

<< Home