BT Interface for TSDZ2 Open Source firmware - Work in progress

Electric Motors and Controllers
gomyles   100 mW

100 mW
Posts: 40
Joined: Nov 13 2019 12:54pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by gomyles » May 18 2020 12:06pm

I see you put the instructions for getting a board from PCBway.com as well, so can get one there too. Thank you for the great work! Looks awesome

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » May 18 2020 5:06pm

Hi all,
this week i had some test rides in the mountains with the new board installed in my Bike and everything went well.
A total of 60Km and 3000m uphill.

Image

Here a couple of screenshots of a portion of the ride data of today.

Image
Image

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » May 19 2020 9:54am

Hi,
two new features are arriving, thanks to a suggestion i had on Reddit and a pull request on Github.

1) Anti-theft activated by Android app.
2) New BT Cycling Speed and Cadence Profile (CSCP) and the possibility to select between CSCP and Cycling Power Profile (CPP) from the android app. (to have compatibility also with devices unable to use the CPP like the Garmin Vivoactive).

casainho   10 GW

10 GW
Posts: 4849
Joined: Feb 14 2011 2:43pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by casainho » May 21 2020 5:00am

mspider65 wrote:
May 18 2020 5:06pm
this week i had some test rides in the mountains with the new board installed in my Bike and everything went well.
A total of 60Km and 3000m uphill.

Image
Very good work!! I asked for myself what was your ambition, what would be the new and most advanced feature you wanted to implement -- in my head could be map navigation on the Android app, but, after researching and talking with others, seems VERY hard for someone to do it. And on the journey I ended up seeing how the commercial products are doing it and then I found they are not doing it!! They are instead creating ebikes compatible with the wireless standard ANT+ Light Electric Vehicles (LEV) profile -- then a new world of map navigation and advanced fitness and cycling sensors opens!!

I would like to invite you to read more about this idea of a Fully wireless TSDZ2 mid drive motor (like Specialized Turbo Levo) and I hope we can collaborate in future. As you can see, your board and Android app are a reference, I hope they can be reused on this new project: viewtopic.php?f=28&t=106346

Image
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » May 21 2020 8:02am

casainho wrote:
May 21 2020 5:00am

I would like to invite you to read more about this idea of a Fully wireless TSDZ2 mid drive motor (like Specialized Turbo Levo) and I hope we can collaborate in future. As you can see, your board and Android app are a reference, I hope they can be reused on this new project: viewtopic.php?f=28&t=106346

Image
hello Casainho,
thanks, but I would have done nothing if your Open Source Firmware had not been there.
I don't have plan to add too many features to the Android App, my intention is to use the app mainly for the setup and monitoring of the motor.
I use the bike mainly for fun to ride in the mountains and normally i don't use nothing else than the switch to change assistance level :).
The only advanced feature i use when i ride on new traks, is map navigation, and for this feature i prefer to have a rugged Android Phone. I had in past also Garmin devices but i think now an Android Phone give a lot more flexibility (my favorite navigation app is Oruxmaps).
In any case your idea is really interesting and i think also ANT+ is now a consolidated standard for the ebikes.
I will be glad to follow the thread and, if i can, i will also give help.

Massimo

casainho   10 GW

10 GW
Posts: 4849
Joined: Feb 14 2011 2:43pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by casainho » May 21 2020 8:42am

mspider65 wrote:
May 21 2020 8:02am
casainho wrote:
May 21 2020 5:00am

I would like to invite you to read more about this idea of a Fully wireless TSDZ2 mid drive motor (like Specialized Turbo Levo) and I hope we can collaborate in future. As you can see, your board and Android app are a reference, I hope they can be reused on this new project: viewtopic.php?f=28&t=106346

Image
hello Casainho,
thanks, but I would have done nothing if your Open Source Firmware had not been there.
I don't have plan to add too many features to the Android App, my intention is to use the app mainly for the setup and monitoring of the motor.
I use the bike mainly for fun to ride in the mountains and normally i don't use nothing else than the switch to change assistance level :).
The only advanced feature i use when i ride on new traks, is map navigation, and for this feature i prefer to have a rugged Android Phone. I had in past also Garmin devices but i think now an Android Phone give a lot more flexibility (my favorite navigation app is Oruxmaps).
In any case your idea is really interesting and i think also ANT+ is now a consolidated standard for the ebikes.
I will be glad to follow the thread and, if i can, i will also give help.

Massimo
Maybe the advantage of ANT+ is the cycling sensors (and ANT technology belongs to Garmin). And Garmin advantage is probably their advanced fitness algorithms and metrics, and all integrations between different devices - they even buy the fitness algorithms to FirstBeat.

Since this wireless project have Bluetooth + ANT+ parts, and the Bluetooth part have the same objective as your project, makes sense to just use your project.

On the firmware side I just need a firmware that implements the same you are doing (I already have implemented UART and cycling Bluetooth profiles on SW102 display). Then I need to have ANT+ running simultaneous and implemented the specific profiles on ANT+.

So, I will keep following your project closely. And please implement the last firmware version, you will get motor cadence support up to 120 RPM!!
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » May 26 2020 5:16pm

New version released.
The new files(Android apk, ESP32 firmware, and TSDZ2 firmware) are un Github at the following link https://github.com/TSDZ2-ESP32/TSDZ2-ES ... master/bin

The main changes are:

- New Torque Sensor offset calibration procedure. The original 0.20.0 beta 1 code and also the current casainho version never worked well on my byke. Now i have always a correct Torque Offset ADC value calculated at motor startup.

- Further reduced the ADC sampling rate from 5,3MHz to 4MHz (for even better conversione precision).

- Added Theft protection function activated from the Android app. If the function is enabled, when the LCD is switched on, the LCD displays the Error E04 and the engine does not provide power until the Android application connects.



To update the previous version, you must first update the Android app and then, from the Android app, you must update the ESP32 board firmware and then the TSDZ2 firmware via OTA.

zappan   10 W

10 W
Posts: 71
Joined: Sep 27 2018 3:00am
Location: Sicilia

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by zappan » May 29 2020 2:37pm

Hi, then yesterday I got the PCB that Mspider65 sent me which I thank for the great availability and courtesy, today, after identifying the corresponding colors of my controller compared to the standard ones found in the project wiki, I connected and installed with the help of my trusted mechanic the Bluetooth transmitter and following the very precise instructions of the project the show started my TSDZ2 connects to the cell, I updated the firmware of the ESP32 card, I installed the SW Ver.3 of Mspider65 ( via PC I will then remove the protection), I set the engine, battery and temperature sensor settings from the mobile phone and then immediately took a test ride, what to say a show I felt a really great satisfaction also because all it worked on the first try and I still don't get tired of thanking Mspider65 for his wonderful project.
I use the VLCD 6.
:bigthumb: :bigthumb: :bigthumb:

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » May 30 2020 6:54am

Thanks for the compliments,
you are the first who got to try the project. I am glad that everything worked immediately.
I hope that the others to whom I have sent the boards are also satisfied.

Now, however, if all those who asked me for the board confirm, I no longer have any.

But ordering the boards on your own on PCBWay is very easy.
https://github.com/TSDZ2-ESP32/TSDZ2-ES ... et-the-PCB

If you have experience in PCB manufacturing, you can still order the boards wherever you want or assemble yourself. All the necessary files and informations are on Github.

Massimo

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Jun 02 2020 5:20pm

New releases:

Android v2.0.3
  • fix battery low voltage cutoff and battery Wh reset input limits
  • added screen always-on option

ESP32 v1.0.10
  • fix LCD auto-off
https://github.com/TSDZ2-ESP32/TSDZ2-ES ... master/bin

zappan   10 W

10 W
Posts: 71
Joined: Sep 27 2018 3:00am
Location: Sicilia

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by zappan » Jun 04 2020 5:17am

Hi Mspider65, I installed the new updates and everything works great! :D
Attachments
Screenshot_2020-06-03-00-52-47.png
Screenshot_2020-06-03-00-52-47.png (24.87 KiB) Viewed 1285 times
Screenshot_2020-06-03-00-52-33.png
Screenshot_2020-06-03-00-52-33.png (17.61 KiB) Viewed 1285 times

pgwguk   1 µW

1 µW
Posts: 3
Joined: May 14 2020 10:35am

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by pgwguk » Jun 05 2020 8:14am

Thanks to mspider65, I got my ESP32 board a little while ago.
Unfortunately, I'd been unable to start the installation process until today, but I can also confirm how well made the board is!

I installed the board on an 8 pin controller, so slight difference on the colours referenced in the wiki - I can help to update this if needed.
As I've got an 8 pin controller, I also used the 1t4 cable from EcoCycles. This means I've modified my VLCD5 to use a bafang connector. I haven't finished the installation enough to ride the trike yet, but hope to get that done this weekend and take some pictures.

As well as testing the VLCD5 which worked great, I also tested the SW102 from EcoCycles.
This mini display has TSDZ2 compatible firmware pre-loaded, so my hope was it'd be compatible with the ESP32 setup.
The great news is, it does! All the functionality of the SW102 appears active, power level and power mode selection also works!

mspider65, you've done a great job and I'll do some further testing with the SW102 to confirm it's 100% compatible.
This could be a great option for others to use the SW102 with OSF without having to open up the display!

One quick question, are there any plans to make this work with Casainho's latest firmware? I'd like to test the force weakening, etc.
Happy to help with testing.

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Jun 05 2020 8:55am

pgwguk wrote:
Jun 05 2020 8:14am
Thanks to mspider65, I got my ESP32 board a little while ago.
Unfortunately, I'd been unable to start the installation process until today, but I can also confirm how well made the board is!

I installed the board on an 8 pin controller, so slight difference on the colours referenced in the wiki - I can help to update this if needed.
As I've got an 8 pin controller, I also used the 1t4 cable from EcoCycles. This means I've modified my VLCD5 to use a bafang connector. I haven't finished the installation enough to ride the trike yet, but hope to get that done this weekend and take some pictures.

As well as testing the VLCD5 which worked great, I also tested the SW102 from EcoCycles.
This mini display has TSDZ2 compatible firmware pre-loaded, so my hope was it'd be compatible with the ESP32 setup.
The great news is, it does! All the functionality of the SW102 appears active, power level and power mode selection also works!

mspider65, you've done a great job and I'll do some further testing with the SW102 to confirm it's 100% compatible.
This could be a great option for others to use the SW102 with OSF without having to open up the display!

One quick question, are there any plans to make this work with Casainho's latest firmware? I'd like to test the force weakening, etc.
Happy to help with testing.

Hi Paul, have fun with the new setup!
Yes, as soon as I have a little more time I would also like to add the Casainho's field weakening option.

Massimo

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Jun 19 2020 7:37am

New TSDZ2 controller version (v4) released with the fix for the backward resistance when using the cadence sensor in "Advanced Mode".
Tested this morning on a short trip to "cima Vezzena".

Link to the new version:
https://github.com/TSDZ2-ESP32/TSDZ2-ES ... DZ2-v4.zip

P.S.
Thanks to mbrusa for the info about the fix!
Attachments
CimaVezzena.jpg
CimaVezzena.jpg (385.24 KiB) Viewed 1147 times

casainho   10 GW

10 GW
Posts: 4849
Joined: Feb 14 2011 2:43pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by casainho » Jun 19 2020 7:59am

mspider65 wrote:
Jun 19 2020 7:37am
New TSDZ2 controller version (v4) released with the fix for the backward resistance when using the cadence sensor in "Advanced Mode".
Tested this morning on a short trip to "cima Vezzena".

Link to the new version:
https://github.com/TSDZ2-ESP32/TSDZ2-ES ... DZ2-v4.zip

P.S.
Thanks to mbrusa for the info about the fix!
Beautiful mountains :-)
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa

hefest   100 W

100 W
Posts: 154
Joined: Jan 11 2019 4:55am

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by hefest » Jul 16 2020 2:27pm

Any progress on supporting tsdz2 firmware v1.0.0?

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Jul 27 2020 4:48pm

New release available.
The main changes are all related to the TSDZ2 firmware.
1) New Pedal start/stop detection algorithm.
Now both PAS sensors and both sensor transitions are used to detect pedal start/stop. The new algorithm is about two times more responsive than the previous "advanced cadence mode" but without the need to do any calibration.
2) Battery current is now always sampled at the middle of the PWM cycle (not using more the previous buffered sample)
3) 4 time faster eBike control loop (40 times/second instead of 10 times/second)
3) Many other small fixes and code refactoring.

The result is a much responsive but at the same time really smooth motor.

Before to start the implementation of the "field weakening" feature I have also done some tests with the current new firmware at high cadence in order to have a baseline and i had an unexpected result.
In my current setup (36V motor and 36V battery) i'm able to have assistance up to a cadence of 97 RPM.
The images below also shows that the limit is not the duty cycle (always below the max value of 254) but the motor Max ERPS that hit the max value of 520 set in the Software. For this reason, I think that by setting a higher value of max ERPS it will be possible to have assistanace even above 100 RPM.
Attachments
Screenshot_20200727-221502.png
Screenshot_20200727-221502.png (140.41 KiB) Viewed 898 times
Screenshot_20200727-221537.png
Screenshot_20200727-221537.png (147.82 KiB) Viewed 898 times
Screenshot_20200727-221701.png
Screenshot_20200727-221701.png (136.79 KiB) Viewed 898 times

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Jul 28 2020 6:11am

hefest wrote:
Jul 16 2020 2:27pm
Any progress on supporting tsdz2 firmware v1.0.0?
The Controller protocol and firmware parameters are different and the porting involves all the layers (ESP32 and Android app.), and since I am really satisfied with the current firmware, i don't have in plan (at least for now) to port the v1.0.0.

User avatar
stancecoke   100 kW

100 kW
Posts: 1335
Joined: Aug 02 2017 2:56pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by stancecoke » Jul 28 2020 9:45am

mspider65 wrote:
Jul 27 2020 4:48pm
For this reason, I think that by setting a higher value of max ERPS it will be possible
This limit exists to make sure to get a proper sinusodial shape of the phase current. If you get two less PWM updates per electric revolution, you won't get an proper current shape. With the limit of 520 we get 30 points on the sine- curve per revolution at the PWM frequency of 15625 Hz.

regards
stancecoke

casainho   10 GW

10 GW
Posts: 4849
Joined: Feb 14 2011 2:43pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by casainho » Jul 28 2020 9:58am

mspider65 wrote:
Jul 28 2020 6:11am
hefest wrote:
Jul 16 2020 2:27pm
Any progress on supporting tsdz2 firmware v1.0.0?
The Controller protocol and firmware parameters are different and the porting involves all the layers (ESP32 and Android app.), and since I am really satisfied with the current firmware, i don't have in plan (at least for now) to port the v1.0.0.
I really hope we can merge TSDZ2 wireless standard project and this one in the future, so everyone can enjoy the most updated firmware and features.

A video showing the Garmin GPS cycling computer controlling the battery voltage to turn on / off the motor -- changing assist level on the display and when value is zero it disable the motor voltage:

- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa

Elinx   1 kW

1 kW
Posts: 363
Joined: Aug 09 2019 6:58am

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by Elinx » Jul 28 2020 10:02am

mspider65 wrote:
Jul 27 2020 4:48pm
...

Before to start the implementation of the "field weakening" feature I have also done some tests with the current new firmware at high cadence in order to have a baseline and i had an unexpected result.
In my current setup (36V motor and 36V battery) i'm able to have assistance up to a cadence of 97 RPM.
The images below also shows that the limit is not the duty cycle (always below the max value of 254) but the motor Max ERPS that hit the max value of 520 set in the Software. For this reason, I think that by setting a higher value of max ERPS it will be possible to have assistanace even above 100 RPM.
imho is that what Jbalat did found already and what is implemented as "experimental high cadence"
That option changes the erps from 520 to 700, but also the foc angle from 80 to 115 and can go to 130 rpm cadence.
stancecoke wrote:
Jul 28 2020 9:45am
.... With the limit of 520 we get 30 points on the sine- curve per revolution at the PWM frequency of 15625 Hz....
imho this could be one the reasons why Casainho increased the PWM to 19kHz
Last edited by Elinx on Jul 28 2020 10:29am, edited 2 times in total.

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Jul 28 2020 2:59pm

casainho wrote:
Jul 28 2020 9:58am
I really hope we can merge TSDZ2 wireless standard project and this one in the future, so everyone can enjoy the most updated firmware and features.
Both changes (Current ADC sampling, and new PAS algorihm) are quite easy to implement.
For the battery current ADC just replace the code

Code: Select all

 
ui16_g_adc_battery_current = UI16_ADC_10_BIT_BATTERY_CURRENT;
with

Code: Select all

ui16_g_adc_battery_current = ADC1->DRH;
ui8_temp= ADC1->DRL;
ui16_g_adc_battery_current = (ui16_g_adc_battery_current << 2) |  (uint16_t)(ui8_temp & 0x03);
and the new PAS algorithm is the following and i think it is self explanatory.

Code: Select all


    /*
     * - New pedal start/stop detection Algorithm (by MSpider65) -
     *
     * Pedal start/stop detection uses both transitions of both PAS sensors
     * ui8_pas_state stores the PAS1 and PAS2 state: bit0=PAS1,  bit1=PAS2
     * Pedal forward ui8_pas_state sequence is: 0x01 -> 0x00 -> 0x02 -> 0x03 -> 0x01
     * After a stop, the first forward transition is taken as reference transition
     * Following forward transition sets the cadence to 7RPM for immediate startup
     * Then, starting form the second reference transition, the cadence is calculated based on counter value
     * All transitions resets the stop detection counter (much faster stop detection):
     */

// cadence sensor variables
#define NO_PAS_REF 5
#define CADENCE_TICKS_STARTUP 6250 // about 7-8 RPM
#define CADENCE_SENSOR_STANDARD_MODE_SCHMITT_TRIGGER_THRESHOLD    350

volatile uint16_t ui16_cadence_sensor_ticks = 0;
volatile uint32_t ui32_crank_revolutions_x20 = 0;
static uint16_t ui16_cadence_sensor_ticks_counter_min = CADENCE_SENSOR_CALC_COUNTER_MIN;
static uint8_t ui8_pas_state_old = 4;
static uint16_t ui16_cadence_calc_counter, ui16_cadence_stop_counter;
static uint8_t ui8_cadence_calc_ref_state = NO_PAS_REF;
static uint8_t ui8_pas_old_valid_state[4] = { 0x01, 0x03, 0x00, 0x02 };

    uint8_t ui8_pas_state = (PAS1__PORT->IDR & PAS1__PIN) | ((PAS2__PORT->IDR & PAS2__PIN) >> 6);

    if (ui8_pas_state != ui8_pas_state_old) {
        if (ui8_pas_state_old != ui8_pas_old_valid_state[ui8_pas_state]) {
            // wrong state sequence: backward rotation
            ui16_cadence_sensor_ticks = 0;
            ui8_cadence_calc_ref_state = NO_PAS_REF;
            goto skip_cadence;
        }

        ui16_cadence_sensor_ticks_counter_min = ui16_cadence_sensor_ticks_counter_min_speed_adjusted;

        if (ui8_pas_state == ui8_cadence_calc_ref_state) {
            // ui16_cadence_calc_counter is valid for cadence calculation
            ui16_cadence_sensor_ticks = ui16_cadence_calc_counter;
            ui16_cadence_calc_counter = 0;
            // software based Schmitt trigger to stop motor jitter when at resolution limits
            ui16_cadence_sensor_ticks_counter_min += CADENCE_SENSOR_STANDARD_MODE_SCHMITT_TRIGGER_THRESHOLD;
        } else if (ui8_cadence_calc_ref_state == NO_PAS_REF) {
            // this is the new reference state for cadence calculation
            ui8_cadence_calc_ref_state = ui8_pas_state;
            ui16_cadence_calc_counter = 0;
        } else if (ui16_cadence_sensor_ticks == 0) {
            // Waiting the second reference transition: set the cadence to 7 RPM for immediate start
            ui16_cadence_sensor_ticks = CADENCE_TICKS_STARTUP;
        }
        // Reference state for crank revolution counter increment
        if (ui8_pas_state == 0)
            ui32_crank_revolutions_x20++;

        skip_cadence:
        // reset the counter used to detect pedal stop
        ui16_cadence_stop_counter = 0;
        // save current PAS state
        ui8_pas_state_old = ui8_pas_state;
    }

    if (++ui16_cadence_stop_counter > ui16_cadence_sensor_ticks_counter_min) {
        // pedals stop detected
        ui16_cadence_sensor_ticks = 0;
        ui16_cadence_stop_counter = 0;
        ui8_cadence_calc_ref_state = NO_PAS_REF;
    } else if (ui8_cadence_calc_ref_state != NO_PAS_REF) {
        // increment cadence tick counter
        ++ui16_cadence_calc_counter;
    }
casainho wrote:
Jul 28 2020 9:58am
A video showing the Garmin GPS cycling computer controlling the battery voltage to turn on / off the motor -- changing assist level on the display and when value is zero it disable the motor voltage:
I am happy to see that the fully wireless TSDZ2 project is going well :)
Last edited by mspider65 on Jul 28 2020 3:09pm, edited 1 time in total.

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Jul 28 2020 3:09pm

stancecoke wrote:
Jul 28 2020 9:45am
mspider65 wrote:
Jul 27 2020 4:48pm
For this reason, I think that by setting a higher value of max ERPS it will be possible
This limit exists to make sure to get a proper sinusodial shape of the phase current. If you get two less PWM updates per electric revolution, you won't get an proper current shape. With the limit of 520 we get 30 points on the sine- curve per revolution at the PWM frequency of 15625 Hz.

regards
stancecoke
Thanks, you are right. Also the PWM frequency should be increased in order to have a correct interpolation of the phase current.
Maybe it's better if I take some time to reread the theory of electric motors :)

mspider65   10 W

10 W
Posts: 70
Joined: Aug 04 2019 2:10pm

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Jul 28 2020 3:22pm

Elinx wrote:
Jul 28 2020 10:02am
imho is that what Jbalat did found already and what is implemented as "experimental high cadence"
That option changes the erps from 520 to 700, but also the foc angle from 80 to 115 and can go to 130 rpm cadence.
The test was done using the standard 36V motor configuration.

hefest   100 W

100 W
Posts: 154
Joined: Jan 11 2019 4:55am

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by hefest » Jul 30 2020 1:26pm

mspider65 wrote:
Jul 28 2020 6:11am
hefest wrote:
Jul 16 2020 2:27pm
Any progress on supporting tsdz2 firmware v1.0.0?
The Controller protocol and firmware parameters are different and the porting involves all the layers (ESP32 and Android app.), and since I am really satisfied with the current firmware, i don't have in plan (at least for now) to port the v1.0.0.
Didn't you tell me when I was buying esp32 controller from you that you plan to upgrade to 1.0? I'm pretty sure because I asked.

Post Reply