OPEN-SOURCE FIRMWARE TURNS A CHEAP MID-DRIVE E-BIKE MOTOR INTO A SMOOTHER RIDE

Cheap mid-drive motor, terrible factory firmware — open-source replacement makes it read torque properly.

by OpenSourceEBike community

FULL CAD BOM FIRMWARE DOCS

AutomationOpen-hardware

difficulty
●●●○○
time
an afternoon
license
GPL-3.0
repo
repo ACTIVE276 stars

WHAT YOU’LL NEED

  • Electronic partsfull list with part numbers in the repo BOM
  • Dev board / microcontrollerruns the project firmware

Partner

Run your scrapers in the cloudThis build needs data collection that runs 24/7. Apify's free plan includes $5 in credits every month — no card needed.Try Apify free
1

COMPAREE VERDICT

The TSDZ2 is one of the cheapest mid-drive motors and its factory firmware is the worst part of the package — jerky power delivery, crude torque sensing. This GPL-3.0 firmware replaces it and reads the motor's torque sensor frame-by-frame, so assistance follows how hard you pedal instead of stepping through fixed levels. The result is smoother, more natural, and much less tiring on long rides. The project is mature, with years of community use and active forks. Flashing requires opening the motor casing, soldering or buying an ST-Link programmer cable, and following a Windows-based guide (or running a VM). The single biggest trap is buying a motor kit that does not include the torque sensor version of the TSDZ2 — the non-sensor version exists and the firmware cannot fix that. If you already own a TSDZ2 and hate how it rides, this is the obvious fix. If you are buying new, budget 800–1,100 dollars for motor plus battery, then add the afternoon to flash it.

NOT IN THE REPO

  • GPL-3.0 licence, free for any use including commercial.
  • Firmware source, flashing instructions, and configurator app all present.
  • Bill of materials is the motor kit itself (TSDZ2) plus battery and optional displays — not a PCB build.
  • No STM32 programming cable is included in most kits; you will need to buy or make one.
  • Active fork emmebrusa/TSDZ2-Smart-EBike-1 has most recent commits (last push May 2026).
  • Local e-bike speed and power limits apply; the firmware lets you configure beyond legal limits but riding that way is your liability.

Can I build this?

Printnothing required
BuyTSDZ2 motor kit with torque sensor (450–600 USD), e-bike battery (300–500 USD), ST-Link V2 programmer if not included
Toolssoldering iron, ST-Link V2, Windows PC or VM, hex keys to open motor casing
SkillsComfortable opening a motor casing, soldering to a pin header, and following firmware flashing steps. No coding required.
Timean afternoon including opening the motor, soldering the programmer connection, and flashing
Cost$$$, dominated by the motor kit and battery — firmware is free
SafetyMotor runs at 36–52V depending on battery choice; treat as live when powered. No risk when flashing (motor disconnected from battery). Local e-bike speed and power laws apply — firmware allows illegal configurations.

Build at your own risk. Projects involve tools, electronics and sometimes mains voltage — follow the creator’s safety notes.

A desktop 3D printer that prints in full colorPartner · Kickstarter
A desktop 3D printer that prints in full color

HeyGears G1: 10M+ colors and transparent parts in one print, plus UV printing on flat objects. Figures, parts and labels — no painting.

See how it prints

Videos

Community installation video linked in payload; specifics not extracted.

Gallery

https://hackaday.com/wp-content/uploads/2026/07/middrive-DIY-feat.jpg
https://hackaday.com/wp-content/uploads/2026/07/thingino_thumb.jpg?w=600&h=600
https://hackaday.com/wp-content/uploads/2026/07/anders_nielsen_DSCF6937_thumbnail.png?w=600&h=600
https://img.youtube.com/vi/0jco-RKzRSo/maxresdefault.jpg

Start here

Navigation into the creator’s own docs — we don’t rewrite the guide, we route you to the source.

  1. 1.Confirm your motor kit is the TSDZ2 with torque sensor (not the cadence-only version)(The firmware cannot add torque sensing if the hardware lacks it.)
  2. 2.Read the flashing guide in the wiki (Covers opening the motor, soldering the ST-Link connection, and Windows flashing steps.)
  3. 3.Check the active fork emmebrusa/TSDZ2-Smart-EBike-1 for latest commits(Most recent development happens in the fork; original repo is the documentation home.)
  4. 4.Install the configurator app to tune assistance curves after flashing(Android app in the repo lets you adjust torque response and power levels from your phone.)

Resources

Documentation, files and community threads for this build — we link straight to the original sources and never rehost the creator’s files.

KNOWN ISSUES

  • Buying a TSDZ2 kit without torque sensor — the cadence-only version exists and looks identical in listings; firmware cannot fix missing hardware.
  • No ST-Link programmer cable in most kits — you will need to buy or make one, and soldering to the motor controller board is required.
  • Flashing guide is Windows-based; macOS and Linux users will need a VM or wine setup.
  • Opening the motor casing voids any warranty, and reassembly requires threadlock on certain bolts or they will vibrate loose.
  • Configuring power or speed beyond local legal limits is possible in firmware but riding that way is your own liability.
  • Some display units are not compatible with the open firmware — check the wiki list before buying a display separately.

Does this work with the non-torque-sensor TSDZ2?

No. The firmware reads the torque sensor frame-by-frame; if your motor has only a cadence sensor the firmware cannot add that capability.

Will this void my motor warranty?

Yes. You open the casing, solder to the controller board, and replace the factory firmware.

Which fork should I use?

emmebrusa/TSDZ2-Smart-EBike-1 has the most recent commits (last push May 2026). The original OpenSourceEBike repo is the documentation and community home.

Can I flash this without soldering?

No. The ST-Link programmer must connect to pads on the motor controller board, and those are not brought out to a connector.

Is this legal?

The firmware is GPL-3.0 and legal to install. Riding an e-bike with power or speed beyond local limits is a separate question and your own responsibility.

Community builds

No community builds yet — be the first, we feature the best ones.

Discussion1

FROM THE COMPAREE TEAM

The motor kit plus battery runs 800–1,100 USD, but the firmware that makes it rideable is free. If you have ridden both stock and flashed TSDZ2, what surprised you most about the difference?

CompareeTEAM21d ago

Practical notes from our verification: the most active development has moved to the emmebrusa fork (last push May 2026), but the original OpenSourceEBike repo remains the documentation home and the one most walkthroughs reference. The flashing guide is thorough but Windows-focused — macOS and Linux users report success with VMs, though setup takes longer. The single biggest mistake is buying a TSDZ2 without confirming it has the torque sensor; the cadence-only version looks identical in many listings and the firmware cannot fix missing hardware. One more note from the community: some people skip the configurator app and ride the default curves, but the app is where the firmware really shines — being able to tune torque response from your phone mid-ride is the difference between 'better' and 'completely different motor'.

OpenSourceEBike community

Started by contributors frustrated with the TSDZ2's factory firmware. Now maintained as a community project with active forks and years of field use.

GitHub

Star the project on GitHub

DISCLAIMER

  • Comparee is not the author of the projects featured here. All rights to each project belong to its creator — every page links to the original source, and we never host creators’ files.
  • Information is provided without warranty and may become outdated as projects evolve. Prices are indicative bands only — always check the creator’s parts list for current costs.
  • Building and operating any project is at your own responsibility. Protective equipment, safe workshop practice and compliance with local regulations are the builder’s responsibility.