Skip to content

Instantly share code, notes, and snippets.

@daeken
Created May 20, 2014 04:52
Show Gist options
  • Save daeken/a3d3c4da11ca1c2d2b84 to your computer and use it in GitHub Desktop.
Save daeken/a3d3c4da11ca1c2d2b84 to your computer and use it in GitHub Desktop.
import serial
class Lifespan(object):
def __init__(self):
self.connect()
def connect(self):
self.port = serial.Serial('/dev/tty.IHP-Serialport', 19200, timeout=1)
while self.port.read(1) != '':
continue
def interrogate(self, type):
self.port.write(''.join(map(chr, (161, type, 0, 0, 0))))
return tuple(map(ord, self.port.read(6))[2:])
@property
def seconds(self):
msg = self.interrogate(137)
return msg[0] * 60 * 60 + msg[1] * 60 + msg[2]
@property
def time(self):
msg = self.interrogate(137)
return msg[0:3]
@property
def distance(self):
msg = self.interrogate(133)
return msg[0] + msg[1] / 100.0
@property
def speed(self):
msg = self.interrogate(130)
return msg[0] + msg[1] / 100.0
@property
def calories(self):
msg = self.interrogate(135)
return msg[0] * 256 + msg[1]
@property
def steps(self):
msg = self.interrogate(136)
return msg[0] * 256 + msg[1]
lifespan = Lifespan()
while True:
print 'Walking for: %i:%i:%i' % lifespan.time
print 'Walked %f miles (currently %f mph)' % (lifespan.distance, lifespan.speed)
print 'Burned %i calories in %i steps' % (lifespan.calories, lifespan.steps)
print
@jpjodoin
Copy link

jpjodoin commented Apr 2, 2023

@lukescott : Did you made any progress on this ? On my lifespan I have
Pin 1: 12V
Pin 2: GND
Pin 3: 5V
Pin 4:?
Pin 5:?
Pin 6: 12V
Pin 7: ?
Pin 8: N/C
Pin 9: N/C
I have an oscilloscope, so I'll play around and try to figure out the rest.

@lukescott
Copy link

@jpjodoin I didn't make any progress. The software I found was all based on bluetooth. I'm not even sure if the protocol used is anything standard. I didn't want to risk damaging my treadmill with my limited tools/knowledge. I ended up buying the newer console from Lifespan (they were willing to sell it to me standalone). Would be really cool to be able to connect direct without Bluetooth though!

@JohnstonJ
Copy link

JohnstonJ commented Feb 26, 2024

@jpjodoin I don't suppose you ever figured out the pinout between console and lower motor controller - especially whether you put a scope on it? My older LifeSpan TR1200-DT3 erratically counts steps (mostly doesn't count any, but sometimes does count a few normally at a time). It also sometimes fails to update the speed: I'll adjust the speed on the console, but the treadmill keeps on at the old speed as if I didn't change anything. Or sometimes, there's a delay before the new speed kicks in. Once, I told the console to stop, and the console behaved like it had stopped normally... but it hadn't. It is super weird, and feels like the communication between console and treadmill isn't behaving normally.

Anyhow, if somebody already did the work of learning more about these pins, I'd love to know what they do, just so I can think about it in my troubleshooting.

I tried probing the pins myself with a cheapo $10 digital multimeter using the DC voltage setting. So take these measurements with a big grain of salt, it's a very cheap & slow voltmeter. Here's what I got:

Pin	Color	Label
1	Black	+12V ?? (12.48V, fluctuates by a couple 10 mV)
2	Brown	GND
3	Red	5V data ??? (multimeter fluctuates from 4.5V to 5V)
4	Orange	5V data ??? (multimeter fluctuates from 4.5V to 5V)
5	Yellow	5V, either supply, or data that mostly remains high (multimeter fluctuates from 5.03 to 5.04 V or so)
6	Green	+11.80V ?? (fluctuates by a couple 10 mV)
7	Blue	Goes to 1.00V or so on power-on, then gradually droops to 0.00V over a few seconds.  It then seems to stay solidly at 0.00V.

The numbering and wire colors seem to be consistent across the motor controller connector PCB, the DB9 connectors, and the console hub PCB.

Pins 3 and 4 seem fairly likely to me to be a fairly active data connection of some kind, given the wild fluctuations of my multimeter.

Pin 5 could be a 5V supply as it seemed relatively stable around 5.03V. On the other hand, the 5V power of the USB port is connected to a fat 470 uH inductor inside the console, so I think the console has its own 12V --> 5V buck switching regulator. So, not sure why there would be 5V power supplied over this wire, if they're already providing 12V and have their own voltage regulators to generate lower voltages where needed. Therefore, I'm not entirely convinced this isn't some kind of very low speed digital data pin that is usually high 99% of the time.

My guess is pin 1 is the power supply to the console, since it has the higher voltage. What is going on with pin 6 is a mystery to me: it seems to be consistently 0.7V lower than pin 1. (voltage drop from a diode, or some transistor switching the voltage?). I wonder if there is something more going on with it. I never really noticed it change value, though.

Pin 7 is a complete mystery to me.

The lower motor controller has one of these in it: STM32F102C6T6A: https://www.st.com/content/ccc/resource/technical/document/datasheet/2d/f9/30/2b/b7/96/47/d1/CD00210833.pdf/files/CD00210833.pdf/jcr:content/translations/en.CD00210833.pdf --- along with a basic Microchip I2C EEPROM. It's a basic ARM Cortex M-3 microcontroller, 48 MHz. It's clearly got some smarts on that board. Per the datasheet, the MCU has USART, USB, I2C, SPI interfaces on it, so I'm guessing we're seeing one of those on the data lines. The MCU runs at up to 3.3V nominal, but has 5V tolerant I/O pins.

I did not observe any obvious, dedicated RS232 or RS485 transceiver ICs on either board. Between that, and the fact that data voltages seem to be between 0 and 5V, I'm assuming it's simple 5V digital logic, rather than +/- 15V voltages of e.g. RS232.

I really should go buy an oscilloscope.

Also, it turns out this complex lower PCB has no protection from debris from the belt, and is caked with hair, dust, and God knows what else that was thrown off the belt. I wouldn't be half-way surprised if my problems somehow stem from that. If you have a better-looking PCB than mine, and you'd like to keep it that way, it might be worth fashioning some kind of wall or barrier between the belt and the motor PCB to protect it...

@jbschooley
Copy link

Pins 4 and 5 could just be UART: https://www.reddit.com/r/treadmills/comments/1529dov/lifespan_treadmill_tr1200b_console_detective_need/

I am considering getting one of these treadmills and hooking up my UART adapter is probably one of the first things I'm gonna do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment