Skip to content
mspider65 edited this page May 11, 2020 · 54 revisions

About the TSDZ-ESP32 project

This project adds Bluetooth LE capabilities to the the TSDZ2 e-bike engine.

The project provides:

  • A new TSDZ2 controller firmware based on the TSDZ Open source Firmware
  • A small PCB board connected between the Engine Controller Board and the Display.
  • An Android application used to interact with the TSDZ2 Engine Firmware through the Bluetooth interface

Controller Firmware

Actually the TSDZ2 Controller firmware is based on the TSDZ Open Source Firmware version 0.20.0-beta1 (the last Firmware released for the LCD3 display) to which I added some small changes and improvements. I have also in plan to support in future the last Open Source Firmware developed for the 860c and SW102 displays.

Add on Board

The board is a small PCB (24x42mm) based on the ESP32 microcontroller. The board is small enough to be inserted inside the motor just over the controller board. The board exposes the Bluetooth interface used by the Android application but exposes also the BT 4.0 Cycling Power Profile. In this way you could also use third party app (like Oruxmaps) and the app will be able to receive various parametrs like speed, cadence, istantaneous Power, accumulated energy etc.

The PCB board operates as "man in the middle" between motor controller and LCD. It receives the messages sent from the controller, translates the messages to the OEM LCD protocol and then send the messages to the OEM LCD. This means that the current setup uses the OEM LCDs (VLCD5, VLCD6, HX18). I own the VLCD5 and this is the LCD i tested. But i'm confident that also VLCD6 and XH18 works since they uses the same protocol. In the future it will be possible to add support for different LCDs (as long as the protocol is known)



Android Application

The Android application offers the following functionalities:
  • Two Dashboard showing all the current riding values like (Battery volt, battery current, speed, cadence, motor temperature, etc..)
  • Configuration of all the TSDZ2 Controller firmware parameters
  • OTA (Over The Air) ESP32 board Firmware update
  • OTA TSDZ2 Controller Firmware update
  • History log of all riding values (1 week of data retention)
  • Graphical visualization of the log data












Note

The project requires some small hardware modifications that require a minimum of soldering skill.

The HW part is outdated.

I'm actually on the phase 2 of the project which, after the initial positive experimentation, involves the engineering of the HW part.

For this reason I designed a small PCB board that is completely integrated inside the motor. The only external part will by a small wire antenna routed together the LCD cable. See https://github.com/TSDZ-ESP32/ESP32_TSDZ-PCB

As soon as the new PCB arrives from PCB factory in China and the test is completed, i will update the Wiki.

Wiring scheme

Wiring scheme

ESP32 DevKit Wiring

ESP32 GPIO Pin Name ESP32 funct. Function 6 pin Cable color
GPIO 16 RX2 UART 2 RX to Controller TX Brown
GPIO 17 TX2 UART 2 TX to Controller RX Orange
GPIO 33 D33 UART 1 RX to LCD TX Orange
GPIO 32 D32 UART 1 TX to LCD RX Brown
GPIO 4 D4 One Wire In. DS18B20 Signal -
GPIO 1 TX0 UART 0 TX debug RX -
GPIO 3 RX0 UART 0 RX debug TX -
- VIN Power In 5V supply -
- GND GND GND -
- 3V3 3.3V out to Logic converter LV -

The power is taken from the battery Vin signal coming from the LCD cable. In this way, turning on the display involves turning on the motor controller and the ESP module simultaneously (this helps also the controller firmware update procedure).
The current absorbed from Vin during normal operation is less than 30mA (measured about 27mA on 38V battery), therefore there are no problems for the display mosfet switch in supplying this current.
A resistor in series at the step-down input, limits the short-time current that occurs at switch-on when the step-down input capacitor is discharged.

Temperature sensor

Optionally is possible to add an external temperature sensor (Dallas DS18B20 sensor) to monitor the motor temperature. In this case it will be possible to monitor the motor temperature without modifying the motor controller board or removing the throttle control.

DS18B20 Temperature sensor

If enabled, the ESP32 module will limit the max motor current value sent to the controller board, according to the actual motor temperature and the configured temperature thresholds.