
Unbricking a $2k bike with a $10 Raspberry Pi - ptx2
https://ptx2.net/posts/unbricking-a-bike-with-a-raspberry-pi/
======
flak48
> A simple fix is to just use the previous power value if ever: the cadence is
> non-zero and the previous power is non-zero and the current power is zero. A
> slight improvement is to keep track of the slope and factor it in when
> calculating the predicted value.

Looks like somebody rediscovered the Kalman filter without realising it :)

I recall implementing one for an IoT device, to de-noise gas sensor readings a
few years ago.

Pretty fun read. Makes me wish I could gather the courage and patience to get
back into hacking on embedded stuff

------
gkoberger
That's horrible that Peloton was able to do this. Maybe there's more to the
story, but it seems like the court allowed them to shut down a competitor for
simply building a similar (relatively obvious) product?

In fact, the CEO of Peloton had the idea for Peloton... IN A FLYWHEEL CLASS.
That's insane.

~~~
xsmasher
Clicking through the Verge links it sounds like Peloton had a patent that
Flywheel infringed on.

We'd need to do a lot more reading to have on opinion on that case.

~~~
stefan_
These are the patents I assume:

[https://patents.google.com/?inventor=john+foley&assignee=pel...](https://patents.google.com/?inventor=john+foley&assignee=peloton&oq=john+foley+peloton)

They are as absurdly simple as you would expect, so I assume Flywheel simply
didn't want to/had the money to fight this. Like, here is the ultra-obscure
"KETTLER World Tours" in 2018 having you race online against others on
archived footage retrieved over the internet:

[https://www.youtube.com/watch?v=7YfhyDrp5Yg](https://www.youtube.com/watch?v=7YfhyDrp5Yg)

~~~
toomuchtodo
Is there enough prior art to bust the patent? I’d be interested in donating to
the EFF specially to invalidate this patent.

[https://en.wikipedia.org/wiki/Patent_Busting_Project](https://en.wikipedia.org/wiki/Patent_Busting_Project)

------
noodlesUK
It’s a shame that more exercise bikes don’t have open APIs. Zwift is an
absolutely awesome way of keeping in shape if you like cycling, but the
barrier to entry is that you need to own a bike and a bike trainer that are
both pretty expensive. Maker projects like this one always make me happy,
because it’s repurposing an old piece of equipment to function just as well as
a new one. Next step would be adding smart controls to the resistance ;)

~~~
emb-fit
It's a $2k training bike. You could spend $1k and get a really nice brand new
road bike and a smart trainer that controls resistance like a Wahoo Kickr Snap
(or several others) for ~$500.

I just don't get why the Peloton thing is so popular when you can get a smart
trainer and a bike you can actually take outside for sooo much cheaper. You
could even sign up for Zwift and a Trainer Road subscription and come out
waaay ahead of $50/month.

The protocols coming out of these things have become pretty much a standard as
well. Get an ANT dongle for your computer and the data can be consumed from so
many apps, even an open source project like Golden Cheetah. Or just read the
data from a head unit that already supports it.

~~~
aesclepius
> I just don't get why the Peloton thing is so popular when you can get a
> smart trainer and a bike you can actually take outside for sooo much
> cheaper. You could even sign up for Zwift and a Trainer Road subscription
> and come out waaay ahead of $50/month.

You'd be surprised how much twiddling and research you need to do to find a
correctly sized bike and which smart trainer (elevation? resistance? etc?) to
get something that will work for the average person. It's the same reason
people go for iPhones or Macs or anything else that 'just works', the time
cost for getting to where one can actually use it vs. just unpacking a box w/
a 'good enough' smart bike means that a shiny package like a Peloton will
always be preferred for a large chunk of the population.

~~~
emb-fit
Go to any half decent bike shop and say you'd like to spend that much on a
bike/trainer and they will bend over backwards to make sure you get exactly
what you want and need. They will very likely even throw in a custom fitting
using all the special tools they have at their disposal.

Not sure what twiddling you are doing with resistance and elevation, smart
trainers pick the resistance based on what the app tells it to do in real
time.

By no means can a 'large' chunk of the population afford $2,500 up front plus
$60/month.

With a real bike on a trainer some people might even decide to try riding
outside, who knows...

~~~
djrogers
> By no means can a 'large' chunk of the population afford $2,500 up front
> plus $60/month.

Where did you get $60/mo from? GP mentioned $50 which is also off base... A
peloton sub is $13/mo. The only way you could pay $60/mo is if you’re
financing the bike.

~~~
gpanders
Peloton has 2 subscriptions available: one for just the app without the
accompanying bike which is $13/mo, the other that accompanies the bike which
is $40/mo.

------
Johnny555
This is the reason I bought a Keiser bike instead of a Peloton, it has a
simple display that works with Bluetooth sensors (I use my watch to record my
sessions). I use the Peloton app in an iPad (I could pair the bike with the
iPad app, but don't).

The bikes are about the same price, but the Keiser screen is a simple LCD
display that's much cheaper to replace if it gets broken and is fully usuable
without a subscription.

Plus, I think the bike looks better.

[https://www.keiser.com](https://www.keiser.com)

~~~
mttjj
Hmmm. Both of you are getting me very close to pulling the trigger on the M3i.
Just so I’m clear, you have to buy the “M Series Converter” bluetooth device
as well so it can connect to 3rd party apps, correct? Or I could just record
an Indoor Cycling workout manually on my Apple Watch, right?

~~~
Johnny555
I had to get the converter to sync with my (Garmin) watch, so I imagine that
you'll need it to pair with apps. It wasn't really clear whether I'd need the
converter or not, but turns out that I did -- I figured I'd return it if I
didn't need it.

I haven't actually tried pairing it to my iPad or other devices.

~~~
mttjj
Thanks for the info!

------
ohazi
Products like this make me furious.

Selling a product whose interface/API/whatever is deliberately obfuscated so
that the manufacturer also has a monopoly on a subscription service or an app
for said product is blatantly anti-consumer, anti-competitive, anti-
environment, and should be illegal.

Fuck Peloton. Fuck Flywheel. Fuck all the proprietary IoT companies.

And apparently fuck _me_ for having the gall to want to control my air
conditioner from my computer rather than GE Android app #12 that has God-
knows-what baked in and that's going to be abandoned in two years anyway.

Nobody should ever feel like they have to throw out an otherwise functional
refrigerator-sized appliance because of software obsolescence.

I am absolutely willing to die on this hill. We need a GDPR-sized hammer to
fix this.

~~~
thereisnospork
Its a pretty good hill to die on. Everything IOT should be forced to
communicate over transparent and self-documenting protocols so a. anyone can
write an app to control said device and b.[0] Alexa/Cortana/Siri can query to
set up a voice control interface.

[0] Maybe in the future when their capabilities get a bit better, but the gist
is every device should respond to a 'hello' ping with a list of commands and
NLP'able descriptions such that for an air conditioner 'alexa set temp 67
degrees F' just works.

~~~
btashton
This kind of response is a big part of why I have given up building commercial
IoT products for now. It's great to want to have some super abstract high
level self discovering protocol, but when you actually start to build on it it
really hampers the product.

If you want to build a smart light switch you are trying to get the response
time very low and worry about things like syncing behavior around the network.
Doing these things ends up being very domain specific and you do creative
engineering to make it happen. These are very different than the requirements
for say a vacuum cleaner.

Then we have standards that come out like Bluetooth mesh or HomeKit that say
this is exactly how a light switch should work. Great, except your light
switch has this cool feature that Philips did not think of in the committee
meeting and now you are forcing it in and your product once again suffers.

These standards all suck, some small percentage of your customers want custom
access (rightfully so), and a large percentage are comparing you on price and
experience. The outcome is a closed off product. With maybe a cloud API.

Like I said this is why I don't want to work on these products anymore. You
cannot win.

~~~
mattmanser
I completely understand and sympathise with this sentiment, as I'm sure many
others will.

It's one things to want standards, but when it's still an emerging field, with
so much different functionality, it's an impossible task.

Any poster who advocates standardization at this stage would probably be wise
in reading about the early computing days, when you had so many different
standards, before it crystallized behind IBM MS-DOS. Or even HTML, where would
we be today if MS had listened to "standards" and not released
XMLHttpRequest/MSXML library.

No ajax, no modern web.

This is a perfectly normal, and perhaps desired, period of experimentation
where standards will just hold the industry back.

~~~
elephant_talk
You have a valid point about velocity being held back by standards. But you
don’t do yourself any favors, IMHO, pointing to the modern web as an example.
If anything, the modern web is the perfect cautionary tale. Walled gardens,
app churn, bloated apps. No way to use part of a service without all the crap
that comes with it.

The modern web could stand to let off the gas.

~~~
strken
Are walled gardens and app churn really the fault of AJAX requests, though?

For that matter, would removing AJAX and modern JS have fixed anything, or
would people have routed around the problem? Any alternate web I can imagine
just ends up with everyone using Flash/Shockwave/Silverlight/Java applets,
which are even worse. A handful of diehards stay on plain HTML, just like they
do today, while everyone else moves to gigantic ad-ridden behemoths.

~~~
elephant_talk
Walled gardens aren’t the result of Ajax, no. They’re the result of
insufficient or missing standards (or at least lack of standards enforcement).

How many times do you encounter a website that doesn’t support your OAuth
provider of choice? So you keep 2 or 3 around, and oh this site only does
their own password based auth, OK I’ll use my password manager to make a one-
off for this site.

Keep in mind, JS itself was developed by one browser vendor (Netscape IIRC)
because there was a lack of a standard for interactivity on the web. These
tools arise out of need, but because of capitalism the players creating the
tools don’t work together. They stand to benefit if they can “win” and starve
the others until the other solutions die, so that’s what they hope to do. It’s
anti-consumer.

I don’t know what the answer is. Maybe it should be illegal for apps not to
allow certain levels of interoperability and freedom to migrate. Hence a
previous poster’s term, “GDPR-sized hammer”.

------
mikece
Awesome project. I wish more smart devices offered a “run it locally on a Pi
if you’re paranoid or a control freak.” I avoid IoT devices in general because
I have no idea where the data is being stored, if it’s stored securely, or if
it’s being sold. I prefer to manage this all myself.

~~~
foxrob92
>I wish more smart devices offered a “run it locally on a Pi if you’re
paranoid or a control freak.”

Wouldn't that defeat the purpose of the "smart device" (from the
manufacturer's point of view)? The business model often seems to be locking
you in to a subscription (rent seeking) or selling your personal information
(surveillance capitalism).

------
TaylorAlexander
Just wanted to plug repair.org who is working to protect actions like this (I
have no connection to the org). You can join as an individual member to
support their mission financially:

[https://repair.org/individual-supporter-
membership](https://repair.org/individual-supporter-membership)

------
ChuckMcM
This is a great reverse engineering project.

What it points out to me, painfully, yet again, is that cool stuff can
actually do everything its bought to do without a "monthly service fee." And
yet here we are.

------
userbinator
It's interesting to see the discussion here focusing mainly on "open from the
producer/manufacturer" side, when what I think is the really important point
here is that " _opening_ from the consumer/user" side can be easy and
empowering: companies and services will come and go, but your ability to take
control effectively depends only on your willingness to discover and explore.

I avoid a lot of "smart" products in general, but feel comfortable with
working on the equipment I do have --- whether it's maintenance, repair, or
modification --- and I think that's the most important thing to keep in mind;
to not be scared of treating things as anything other than mysterious black
boxes. It seems that a lot of people treat "reverse engineering" as some
equally mysterious and imposing idea, when it's really just about problem
solving or figuring out how something works.

Also, I don't think the RPi is necessary here; the bike is a Bluetooth device,
so any computer with a Bluetooth interface can receive its data and process
it. I'm not an RF expert, but rebroadcasting BT seems like it would create
more interference.

~~~
usrusr
> Also, I don't think the RPi is necessary here; the bike is a Bluetooth
> device, so any computer with a Bluetooth interface can receive its data and
> process it. I'm not an RF expert, but rebroadcasting BT seems like it would
> create more interference.

The rebroadcasting is done because the goal was to get the data into a
proprietary piece of software that expects data to come in over Bluetooth.

And rebroadcasting will actually be just fine on the air medium because right
after receiving is exactly the time when the bike won't send another message.

The RPi is complete overkill of course, a tiny $3 nRF52 module could do that
job just fine.

------
amluto
> First, the node binary needs permission to advertise Bluetooth services:

> sudo setcap cap_net_raw+eip /usr/local/bin/node

Use AmbientCapabilities= in the unit file instead.

~~~
ptx2
That's much better, thanks for the tip!

------
gojomo
Drat, I was hoping this would _also_ have a recipe for
unlocking/reinitializing the attached Android-based tablet, on some of these
bikes. Then it could run other biking apps - or just provide reading/music
while riding. (Maybe even: it could do the BLE translation?)

The community hasn't figured out how to root the tablet, yet, but there are
some hints as to the manufacturer/boot-launch-software –
[https://www.reddit.com/r/FlywheelAnywhere/comments/gexqte/ha...](https://www.reddit.com/r/FlywheelAnywhere/comments/gexqte/has_anyone_wiped_the_software_on_their_flywheel/fq1wz19/)
– if anyone has any ideas or is interested in a challenge.

~~~
sagz
I'm trying to create an Android recovery for a peloton, which is similar
[https://github.com/Goayandi/mediatek_mt8176_development/issu...](https://github.com/Goayandi/mediatek_mt8176_development/issues/1)

------
ggm
Was it really "bricked"

~~~
askvictor
No; this is hyperbole, and cheapens the meaning of the word bricked. It's core
function still worked perfectly. The app no longer works. The app was always a
subscription service. There was an offer to swap (for free) with another bike,
which continues to let you pay to another subscription service for similar or
better functionality.

I'm all for hacking your gadgets, and open APIs, but let's get a sense of
perspective.

~~~
ggm
"I reverse engineered the data feed protocol on my spinner" would have made me
click.

------
vikramkr
Reading into this - flywheel apparently stole patented ideas from peloton
including streaming on demand exercise classes? And that's why their service
is shutting down? How is that supposed to be a protectable/patentable concept?
That sounds like some first class patent trolling at face value.

~~~
ponker
It wasn’t just patent infringement — they stole corporate documents and assets
from Peloton Levandowski-style. There are other companies doing exercise
streaming like Mirror which haven’t had to shut down so I don’t think this is
some kind of massive patent roadblock for the industry.

------
Zigurd
There are other machines, like rowing machines, for which an open solution is
hard to incentivise, since the machine, the app, and the sensors will all come
from a single vendor.

I'm a little surprised, however, that Peloton, and Peloton-alikes ever
happened because cyclists have training devices with open interfaces: Bikes,
mounted on smart trainers that have standardized wireless links and protocols,
connected to a choice of apps.

All it takes is taking the rear wheel off a bike. Or not even that for the
most basic trainers, which clamp the rear axle and provide resistance to the
rear tire. A fascinating case of a market segmentation that is less
susceptible to being breached than one might think.

~~~
jasonvorhe
I have one of those Tacx trainers where you just put your bike in. It's a
hassle. You need to use their own quick release to hold the bike in place. The
cord with the gear shifter (which sets the resistance) is always somewhere
where it's annoying the rider and the shifting control itself doesn't fit on
all handle bars. It's also really noisy.

I have been tempted very often to just buy one of these ready to use training
bikes because of the frustration of: put some yoga mat cut-outs underneath the
Tacx to suppress the vibration of the spinning weight, get the bike from the
cellar, exchange the quick release, store the old one somewhere where it's not
getting lost, put the bike in place by its rear wheel, place the front wheel
in a fixed position, get a fan to put in front of the bike trainer, mount the
gear shifter, which clumsily hangs on the handle bar because my handle bar is
too big. (It's a standard road bike handlebar)

Did I mention this thing was really loud?

I'm also sometimes worried about the fixed pressure on my carbon frame but I
think that's actually unreasonable.

~~~
kingosticks
But they are quite cheap and they fold away. The next tier up 'wheel-off'
trainers are much quieter. But you've still got all that faff (add chain oil
to the mix when taking the rear wheel off) of getting the bike upstairs, the
wheel off, mat down (for the sweat), positition the fan etc. But I don't have
a load of space so a dedicated exercise bike is a complete no.

By the way, clip the resistance switcher on the top of your front wheel rather
than your handle bars. Fits well there and is out of the way but still
reachable.

------
Fricken
If the bike doesn't take you anywhere when you pedal it, it's still a brick.

------
layoutIfNeeded
There are standard BLE GATT attributes for reporting power output, cadence,
etc. from indoor bikes (and tons of other standards for other fitness
appliances, smart scales, blood sugar measurement devices, etc.). If the
vendor had used these standard attributes there won’t be any need for reverse
engineering their protocol.

Moral of the story: choose appliances that support standard protocols.

------
jdechko
Some interesting info here. I have a Garmin speed sensor and a “dumb” mag
trainer (CycleOps Mag). Given the trainers known resistance curve, I was
thinking about trying to come up with a script to approximate power based on
speed.

Basically I want a home brew alternative for Zwift and TrainerRoad virtual
power.

~~~
rconti
That would be a cool project. Do you already know the resistance curve, or
you're just saying SOMEONE knows it? I'd worry that it would be impacted by
heat, but perhaps not significantly.

I've got a Peloton, have a Stages power crank on my road bike, and previously
had Favero Assioma power meter pedals (highly recommended product BTW). I ran
the pedals on the Peloton for a few rides to get a feeling for how close the
calibration was. (surprisingly close, in my case).

~~~
jdechko
Saris (now owner of cycle ops) has an approximate graph on their blog. It’s
probably not very accurate, but I could probably get close enough by taking
some “known” points, some approximations and applying some math to the
problem.

The other option is to see if I can dig into the zwift or trainer road code.
Both of those applications support “virtual power” for this specific trainer.
Which is another way of saying that SOMEONE knows it. I’m sure that Saris
actually shared the exact curve with Zwift and Trainer Road, but I’m not sure
they’d share it with me.

------
olliej
Wow, I love expensive equipment that can’t work once the company goes out of
business. If you want to have a subscription based hardware device the
hardware should be free.

------
m00x
This is the kind of article I love to see on HN. Someone had an issue with a
product and solved it using clever technical skills and deep dives.

------
Maha-pudma
The 2k exercise bike aside, this is a brilliant article. I love reading stuff
like this and wish I had the smarts/knowledge to do this sort of thing.

------
anonymousiam
You left out step 3 on your ToDo list: 3) Spoof the data to the social media
apps and make yourself into a super-human athlete!

(Probably best done with a different account.)

------
arkanciscan
An escalator can never break: it can only become stairs. You should never see
an Escalator Temporarily Out Of Order sign, just Escalator Temporarily Stairs.
Sorry for the convenience.

Mitch Hedberg

~~~
mschuetz
They can fail quite spectacularly:
[https://www.youtube.com/watch?v=o1SjQfwLieU](https://www.youtube.com/watch?v=o1SjQfwLieU)

~~~
saagarjha
Sometimes they eat people too :(

------
forgingahead
Imagine inventing the wheel and expecting that in the distant future, the
wheel itself would stop working because of a stupid reason like this.

------
p1esk
Why would a bicycle need a subscription service?

------
Wolfenstein98k
I'm fairly open-minded, but sometimes a product comes along and blows me away
with how preposterous its central pitch is.

And then I discover there is actually a market for it, and I am further
dismayed... And amazed at the robustness of Say's Law.

Anyway, this bike and the whole associated product is preposterous.

------
einpoklum
> a $2k bike

Maybe that's your problem right there. Get a simple bike, leave the house (ok,
I know there's Corona, I didn't say congregate), find someplace planar, and
cycle in the real world.

In Amsterdam, a decent used bike will cost you the equivalent of 80 USD, maybe
less.

~~~
syshum
Amsterdam also has a large public cycling culture, with a public
infrastructure to support public cycling

It also has a climate geared more towards outdoor cycling.

Not everyone has one or both of those factors, making indoor cycling more
reliable, safer, and more enjoyable

