TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Discussions related to motors other than hub motors.
This includes R/C motors, botttom bracket, roller and geared drives.
User avatar
rananna   1 kW

1 kW
Posts: 347
Joined: Jul 07 2018 4:31am

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by rananna » Apr 06 2021 9:36am

casainho wrote:
Apr 06 2021 9:01am
rananna wrote:
Apr 06 2021 5:13am
Yes, but we configure the nrc as gpio so they work as button input.
I measure no increased power consumption on this pin compared to other gpios.
I also see nothing on the nordic forum suggesting the use of these pins are an issue with power consumption.

Have you found a power issue with this pin?
Well, after 24h, seems the battery is dead again. So, I really need to monitor the current by myself. Why you are not using yet the wireless remote?
Unfortunately I have had some health issues that prevent me from riding.
All I can do is bench testing for now.
Is the battery draining when the nrf52840 is out of the enclosure?
I would request that you please test on the bench so we can at least eliminate any enclosure related issues.

casainho   100 GW

100 GW
Posts: 5150
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by casainho » Apr 06 2021 4:40pm

rananna wrote:
Apr 06 2021 9:36am
Unfortunately I have had some health issues that prevent me from riding.
All I can do is bench testing for now.
Is the battery draining when the nrf52840 is out of the enclosure?
I would request that you please test on the bench so we can at least eliminate any enclosure related issues.
I wish you a quick recovery.

About the issue, I used a 15 ohms resistor in series with 2 AAA NiMh batteries (2.3 volts), to power the wireless remote. I did measure with oscilloscope the voltage across the resistor and here is the result:

1. Wireless remote without any power supply - 9.85mV for 0 amps current:

Image


2. Wireless remote working, no LED on, TSDZ2 wireless board off:

Image

3. Wireless remote working, no LED on, TSDZ2 wireless board on with TSDZ2 motor off:
Image

On 3. there are peaks of 166 - 10mv = 156mv, which means peaks of 10mA.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5150
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by casainho » Apr 06 2021 11:00pm

And this is with brake pin active (connected as original schematic):

Image

So, PWM every 1ms and very small duty-cycle to turn on the red LED of brake signal. The large impulse at middle of the image, happens every 250ms and is the ANT+ LEV reception and processing.

In my calculations, if TSDZ2 wireless board ANT+ LEV is not transmitting, the wireless remote battery will work at best for about 2.5 years but if ANT+ LEV is always transmitting, the remote battery at best will only work for 8 months.

I did put the NRF52 board inside the wireless remote and measured again and I did not see nothing about the possible issue. The current values all seems the same and ok.

Maybe the next step should be to build a wireless remote but with 1 hole to put outside the resistor to measure the current and also wires to measure the battery voltage, so I can monitor it.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5150
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by casainho » Apr 08 2021 10:05am

Finally I was able to find the issue!!

Easy to replicate: with the TSDZ2 wireless board is off, click on any button of the wireless remote to make it work. Then, click 1 or more times on the down button and then long press on the down button (sometimes you need more than 1 long press) -- then the wireless remote will pull continuous 6.5mA and stop responding to the buttons press, so keeping draining the battery!! The CR2032 battery has about 180mAh, meaning it will drain in about 27 hours!! -- this is for sure what was happening to me all the time.

The same happens if TSDZ2 wireless board is on and then I see the same 6.5mA + the impulse of current used by receiving the ANT from the wireless remote (1 pulse every 250ms).

Now, how to solve this?? what is the source of this issue?? Note that seems to happen only with DOWN or ON/OFF buttons, not with the other buttons. If I click the reset button, the system resets and go back to normal as usual.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5150
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by casainho » Apr 08 2021 2:04pm

Meanwhile I found:
- the used current is the same as if the microprocessor is running at 100%
- if a debug and stop the system, I can not see the place in code it is running and if I click continue, it will continue and using the same amount of current (it is like if is running on an infinite loop and without the softdevice running, otherwise there would be an exception after I click continue)
- if I disable the power on/off pin on the initialization, then the long press on this will not trigger the issue
- if this issue is triggered while the red LED is on, then it will keep always on at max brightness (like if the PWM stops at a fixed position)
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

beemac   100 W

100 W
Posts: 276
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by beemac » Apr 08 2021 2:24pm

casainho wrote:
Apr 08 2021 2:04pm
Meanwhile I found:
- the used current is the same as if the microprocessor is running at 100%
- if a debug and stop the system, I can not see the place in code it is running and if I click continue, it will continue and using the same amount of current (it is like if is running on an infinite loop and without the softdevice running, otherwise there would be an exception after I click continue)
- if I disable the power on/off pin on the initialization, then the long press on this will not trigger the issue
- if this issue is triggered while the red LED is on, then it will keep always on at max brightness (like if the PWM stops at a fixed position)
my guess is nrf_delay_ms being called somewhere in the remote code - but haven't looked at the code. I think as well as effectively causing 100% cpu - they also block interrupts which would explain the pwm hang... but just a guess!

edit: I should check before pointing fingers - I can't find any nrf_delay being used in the remote code - so can't be that - sorry rananna :)

User avatar
rananna   1 kW

1 kW
Posts: 347
Joined: Jul 07 2018 4:31am

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by rananna » Apr 08 2021 3:28pm

beemac wrote:
Apr 08 2021 2:24pm
casainho wrote:
Apr 08 2021 2:04pm
Meanwhile I found:
- the used current is the same as if the microprocessor is running at 100%
- if a debug and stop the system, I can not see the place in code it is running and if I click continue, it will continue and using the same amount of current (it is like if is running on an infinite loop and without the softdevice running, otherwise there would be an exception after I click continue)
- if I disable the power on/off pin on the initialization, then the long press on this will not trigger the issue
- if this issue is triggered while the red LED is on, then it will keep always on at max brightness (like if the PWM stops at a fixed position)
my guess is nrf_delay_ms being called somewhere in the remote code - but haven't looked at the code. I think as well as effectively causing 100% cpu - they also block interrupts which would explain the pwm hang... but just a guess!

edit: I should check before pointing fingers - I can't find any nrf_delay being used in the remote code - so can't be that - sorry rananna :)
No problem!
All ideas all welcome.

casainho   100 GW

100 GW
Posts: 5150
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by casainho » Apr 08 2021 3:37pm

Seems the problem is here: void send_page16(ant_lev_profile_t *p_profile)

do
{
err_code = sd_ant_acknowledge_message_tx(p_profile->channel_number, sizeof(p_message_payload), p_message_payload);
// } while (err_code == NRF_ANT_ERROR_TRANSFER_IN_PROGRESS);
} while (err_code);

If I comment the send_page16(), there is no more issue. I had luck because the debugger once did stop on the send_page16().
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

User avatar
rananna   1 kW

1 kW
Posts: 347
Joined: Jul 07 2018 4:31am

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by rananna » Apr 08 2021 4:00pm

casainho wrote:
Apr 08 2021 3:37pm
Seems the problem is here: void send_page16(ant_lev_profile_t *p_profile)

do
{
err_code = sd_ant_acknowledge_message_tx(p_profile->channel_number, sizeof(p_message_payload), p_message_payload);
// } while (err_code == NRF_ANT_ERROR_TRANSFER_IN_PROGRESS);
} while (err_code);

If I comment the send_page16(), there is no more issue. I had luck because the debugger once did stop on the send_page16().
Interesting..... I added this code to ensure that the send page 16 command gets an acknowledgement form the motor for the page16 command before proceeding. obviously when the acknowledgement fails it goes into a continuous loop and burns up power!!
Good catch and sloppy coding on my part.
It would be better to simply press the button again if the message does not get received.
I will eliminate the do loop and give you a PR

casainho   100 GW

100 GW
Posts: 5150
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by casainho » Apr 10 2021 1:20pm

Some news:

1. I did a nice update on the project page, like main page focus on TSDZ2 EBike wireless controller, mobile app and fully wireless remote and wired remote. On this main page there are pictures of this 3 parts. I also added screenshots on the mobile app page and wrote some notes.

2. @rananna documented a different build and 3D design for the wireless remote: https://opensourceebike.github.io/remot ... emote.html

Image
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

stek692003   1 µW

1 µW
Posts: 2
Joined: Aug 01 2020 10:40am

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by stek692003 » Apr 14 2021 1:05pm

Great work with this project. I'm currently wanting to cut down on wires on my bike so this project sounds interesting.

Would this project work without a remote (ie power on the battery and the motor would turn on at default levels set previously with the app)?

Thanks

beemac   100 W

100 W
Posts: 276
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by beemac » Apr 14 2021 1:59pm

stek692003 wrote:
Apr 14 2021 1:05pm
Great work with this project. I'm currently wanting to cut down on wires on my bike so this project sounds interesting.

Would this project work without a remote (ie power on the battery and the motor would turn on at default levels set previously with the app)?

Thanks
Not as things stand - you still need something to turn on the motor other than the battery switch - but you don't need a remote - you can use the android app to switch on - then turn the app off if you like and leave phone at home although that's not recommended as you then wouldn't be able to turn the bike on again if the battery got disconnected.

Essential components are the wireless controller and the android app - the buttons (wired or wireless) are effectively optional...

edit: It's not a bad feature though - to be able to configure the controller to turn on the motor as soon as things are ready... definitely something i'd use - I'll add it to the list of things I'm looking at for the next release...

ctcomputers   1 µW

1 µW
Posts: 4
Joined: Aug 14 2016 4:26pm

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by ctcomputers » Apr 14 2021 7:49pm

beemac wrote:
Apr 14 2021 1:59pm
stek692003 wrote:
Apr 14 2021 1:05pm
Great work with this project. I'm currently wanting to cut down on wires on my bike so this project sounds interesting.

Would this project work without a remote (ie power on the battery and the motor would turn on at default levels set previously with the app)?

Thanks
Not as things stand - you still need something to turn on the motor other than the battery switch - but you don't need a remote - you can use the android app to switch on - then turn the app off if you like and leave phone at home although that's not recommended as you then wouldn't be able to turn the bike on again if the battery got disconnected.

Essential components are the wireless controller and the android app - the buttons (wired or wireless) are effectively optional...

edit: It's not a bad feature though - to be able to configure the controller to turn on the motor as soon as things are ready... definitely something i'd use - I'll add it to the list of things I'm looking at for the next release...
This sounds exactly like the direction I am looking to do on a simple/minimalist experimental build. Either use the phone app to turn the system on in "headless" mode with pre defined parameters or potentially just power on a pre-configured system without the phone at all.

casainho   100 GW

100 GW
Posts: 5150
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 EBike wireless standard (like Specialized Turbo Levo) - OpenSource

Post by casainho » Apr 15 2021 6:39am

I received the EBike buck dd7818ta 80V and is bigger than what I expected. Well, at least I hope it will not burn as the previous DC-DC I was using :-)

I will need to build again my TSDZ2 wireless, so I hope to get the opportunity to take some good photos for the documentation. And looking at the area of this DC-DC, there will be no need to cut the USB part of the NRF52 board:

Image
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Post Reply