TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

casainho said:
Benoit said:
I thought about it but I wasn't sure to implement it, or in a first time only a manual reset.
But it's a nice feature and I'll made it configurable (manual and/or auto reset with configurable amount of hours).
Good to be able to disable as on some 850C/860C / users, the clock fails. On my ebike that is not happening because I am being riding at least every 2 days but my girlfriend bike, it fails as she rides sometimes once a week.

I saw that on the forum. Do you know why it happen ? The 850/860C has however an intagred RTC with its own battery.

casainho said:
Benoit said:
And for the manual reset, what do you think is better : combination of pressing buttons or through a menu ?
I think a menu is less user friendly and more complex to add, except if using the current configuration menu ?
I think we should try to be consistent with buttons usage so will be easy for user to remember, leading to less frustation.

1. user must be seeing one of that variables on a custom field
2. user start customizing fields
3. user select to customize the variable he wants to reset
4. user use the same button combination for graph change x axis scale (I think is UP and DOWN simultaneous)
5. nice if the variable could fast blink for 3 seconds and just after that reset (or do no fast blink if is hard to implement)

I'll see what I can do :wink: For now, as I don't use to develop in C and, in general, with low level language, it ask me lots of time and debug is not easy... modify code, compile, flash display, test... and repeat the process again until it works. I don't know if it is possible to do that better/easyer. But I'm getting there !
 
Benoit said:
casainho said:
Benoit said:
I thought about it but I wasn't sure to implement it, or in a first time only a manual reset.
But it's a nice feature and I'll made it configurable (manual and/or auto reset with configurable amount of hours).
Good to be able to disable as on some 850C/860C / users, the clock fails. On my ebike that is not happening because I am being riding at least every 2 days but my girlfriend bike, it fails as she rides sometimes once a week.

I saw that on the forum. Do you know why it happen ? The 850/860C has however an intagred RTC with its own battery.
May be a capacitor instead of a battery, I found online that capacitors are also used on RTC circuits instead of battery.
 
I’m fairly hands on, but I’ll admit, I’m not great with programming, etc. Ive got a USB UART programming cable that came with a “smart” BMS. It’s basically got RX, TX, GND, VDD pin outs. Any idea if this would work for flashing the firmware?
 
Benoit said:
I'll see what I can do :wink: For now, as I don't use to develop in C and, in general, with low level language, it ask me lots of time and debug is not easy... modify code, compile, flash display, test... and repeat the process again until it works. I don't know if it is possible to do that better/easyer. But I'm getting there !

for serious development, it is recommended to get a 850c and use JTAG for debugging and development. it is nice if you want to continue developing on the 860c, because i dont think it will see new features coming from casainho or me.

But as you are a Web dev like me, you may be interested in joining the fully wireless TSDZ2 project.

my short-term plan is to replace the 860c by an mobile app with the same features, because i think this is what we will use in the future (10+ years view). while the 860c is limited in its functionality and hard to develop, an mobile app will allow for cleaner code, faster development, better UI, more features (because of more sensors and connections and existing libraries). for the price of a 860c you can even buy a dedicated smartphone for your bike.
The app will run on android and ios with an easy to understand and open JSON-API to the motor. I design it that way that it is firmware- and motor-agnostic, so the same app can be used on different tsdz2 forks and even motors (if we see a bafang motor open source firmware in the future) without changes, as long as they implement the bluetooth protocol.
it will also be no problem to use one app with multiple bikes... if a friends wants to borrow your ebike, you can just say "download the app, search for bluetooth, pair with code 12345 and you are ready to go!".

the app will be made using flutter, which is really fun and very quick and easy to develop after you understand its basic concepts - especially when coming from a web dev background with reactive programming. i am currently designing the API and building a app prototype. let me know in the other thread if you want to join us.
 
andyme said:
andyme said:
casainho said:
andyme said:
What can it be?
Disable BOOST and try again. If it solves that issue, then I will disable the BOOST code until someone correct it.

I will let you know on Friday. It will most probably be raining tomorrow.

Ok, Now it is clear. Boost is the problem. Disabled it and now it works flawlessly and clearly even better than when I thought it was good already. Boost obviously interfered all the time...it is a pity, because I really need it, living on top of a steep hill. Sometimes I have to stop when a car comes my way and then it is not easy to get it going again without boost. I must think of a workaround while this is not functional. Anyhow: now it is clear, and it is even better then I thought so it really is a stunning achievement!
 
andyme said:
andyme said:
andyme said:
casainho said:
Disable BOOST and try again. If it solves that issue, then I will disable the BOOST code until someone correct it.

I will let you know on Friday. It will most probably be raining tomorrow.

Ok, Now it is clear. Boost is the problem. Disabled it and now it works flawlessly and clearly even better than when I thought it was good already. Boost obviously interfered all the time...it is a pity, because I really need it, living on top of a steep hill. Sometimes I have to stop when a car comes my way and then it is not easy to get it going again without boost. I must think of a workaround while this is not functional. Anyhow: now it is clear, and it is even better then I thought so it really is a stunning achievement!
I hope I will find time and motivation the implement again the BOOST.
 
casainho said:
andyme said:
andyme said:
andyme said:
I will let you know on Friday. It will most probably be raining tomorrow.

Ok, Now it is clear. Boost is the problem. Disabled it and now it works flawlessly and clearly even better than when I thought it was good already. Boost obviously interfered all the time...it is a pity, because I really need it, living on top of a steep hill. Sometimes I have to stop when a car comes my way and then it is not easy to get it going again without boost. I must think of a workaround while this is not functional. Anyhow: now it is clear, and it is even better then I thought so it really is a stunning achievement!
I hope I will find time and motivation the implement again the BOOST.

Please move to a steep area with narrow streets where cars come your way. :lol:
 
Hey there!

I installed 1.0.0 on TSDZ2 and SW102. No serious problems so far on a 50 km ride.
But there is a bug in SW102 code. The Display hangs sporadically if you enter a configuration menu. Happened several times entering SOC/Display/Motor config , this seems to be randomly happening and changing.

Have a great day!
Nick
 
Hello again and sorry for the late response


casainho said:
See that maybe you did a mistake:
#define TORQUE_SENSOR__PORT GPIOB
#define TORQUE_SENSOR__PIN GPIO_PIN_3

Thats correct, however in the ADC conversion the torque signal is read from PIN 4
Code:
#define UI8_ADC_TORQUE_SENSOR         (ADC1->DB4RH) // AIN4

casainho said:
Max speed because there is a min limit of about 28 points to draw the SVM voltage signals. That was the reason why I increased the PWM frequency compared to original firmware.
Ok that makes sense to me. Just out of curiosity: is there a reason why 28 points is the limit or is it just something you know by experience?


casainho said:
Please share your notes about the derivation so we all can learn.
And how did you tested? I hope you also put the motor under different loads with at least pulling 10 amps.

I have written something in a latex document here: https://www.dropbox.com/s/vy4yvcxufweg0ur/foc.pdf?dl=0
If something is not clear, im happy to explain.

I have tested with some resistance on the wheel and erps ranging from 200 to 400 and got consistently
better results with an additional factor of 2, 8/3 as derived in the formula seemed to be slightly to high. The maximum current i was drawing was 9 Amps.
 
sbartle said:
I’m fairly hands on, but I’ll admit, I’m not great with programming, etc. Ive got a USB UART programming cable that came with a “smart” BMS. It’s basically got RX, TX, GND, VDD pin outs. Any idea if this would work for flashing the firmware?

I think it should work. Personnaly, I use an Arduino Due board (Due, not Duemilanove, it's a board with ARM microcontroller and with I/O ports on 3.3V) as a USB<->serial converter (with just simply connecting reset and GND).
raw said:
Benoit said:
I'll see what I can do :wink: For now, as I don't use to develop in C and, in general, with low level language, it ask me lots of time and debug is not easy... modify code, compile, flash display, test... and repeat the process again until it works. I don't know if it is possible to do that better/easyer. But I'm getting there !

for serious development, it is recommended to get a 850c and use JTAG for debugging and development. it is nice if you want to continue developing on the 860c, because i dont think it will see new features coming from casainho or me.

But as you are a Web dev like me, you may be interested in joining the fully wireless TSDZ2 project.

my short-term plan is to replace the 860c by an mobile app with the same features, because i think this is what we will use in the future (10+ years view). while the 860c is limited in its functionality and hard to develop, an mobile app will allow for cleaner code, faster development, better UI, more features (because of more sensors and connections and existing libraries). for the price of a 860c you can even buy a dedicated smartphone for your bike.
The app will run on android and ios with an easy to understand and open JSON-API to the motor. I design it that way that it is firmware- and motor-agnostic, so the same app can be used on different tsdz2 forks and even motors (if we see a bafang motor open source firmware in the future) without changes, as long as they implement the bluetooth protocol.
it will also be no problem to use one app with multiple bikes... if a friends wants to borrow your ebike, you can just say "download the app, search for bluetooth, pair with code 12345 and you are ready to go!".

the app will be made using flutter, which is really fun and very quick and easy to develop after you understand its basic concepts - especially when coming from a web dev background with reactive programming. i am currently designing the API and building a app prototype. let me know in the other thread if you want to join us.
That's a nice project but personnaly I would prefer to use an ESP32 board instead of 850/860C display which could directly host a web interface, instead of a smartphone app. That way, no need to develop something for Android/iOS, the smartphone would connect to the ESP32 with WiFi. Then it could work with any smartphone, even with a PC/Mac, anything with WiFi and web browser !
And with that kind of board, we can update its firmware OTA.
 
benno said:
Hello again and sorry for the late response
1. So I would say torque sensor is connected to PB4/AIN4.

2. I saw the specifications of the other motor controllers. Also, original firmware goes to 4000 RPM that is the 533 RPS. Also I tested a bit higher speeds and started to saw strange current spikes and the current waveform distorced.

3. Thanks!! I will look at it later with more attention. Can you please write a wiki page with a bit more details on each step? - this knowledge should be shared on the project page!!

And are your riding with that changes on your bicycle?
 
Benoit said:
which could directly host a web interface, instead of a smartphone app. That way, no need to develop something for Android/iOS, the smartphone would connect to the ESP32 with WiFi. Then it could work with any smartphone, even with a PC/Mac, anything with WiFi and web browser !
That is not how devices works usually. A mobile app is like the standard. Even when comparing only with the ebikes on the market. I think is good to implemented as the users do expect it to work.

Also, with ANT+ LEV ebike standard, user will be able to choose use many different displays on the market and not only 2 different models as right now. That is not possible with ESP, even if ESP is very popular.

Benoit said:
And with that kind of board, we can update its firmware OTA.
Also with this wireless board, update just like on SW102 by Bluetooth, since is very similar microcontroller.
 
mallesepp said:
mallesepp said:
AZUR said:
Hi,

I forgot to mention it in the last post, but the Garmin Remote doesn't always work well. I do not know why.
I use it mainly to change the Garmin screen, as the Garmin touch screen doesn't work very well with gloves.
Sometimes I have to press the Remote key more than once to be able to change the screen.
Sorry, i have the same Garmin Remote to change screens on my Edge 1000. It works fine! Without problem.
Hello Azur, now i think i know what is your problem. By beginn of ride you press button first to connect remote with the Garmin! By trip with a long break the remote automatic turn off. The next time you must remote new initialize with a button press! Only now is the remote ready and every button press has function.

Hi, Mallesepp

Yes, that must be it. I use the Remote very little, only when I want to change the screen or start a new lap.

That is why I am afraid to use the Remote to change the level of assistance in the TSDZ2.

If we need to quickly change the level of assistance, at the end of an aggressive donwhill, to attack a slope that appeared suddenly and the button fails is a complicated situation.

Furthermore, the buttons on the Garmin Remote do not have the ergonomics of the 850, which is what I use at the moment. They don't even look so robust for continuous use.

For casual or sporadic use, they fit perfectly.

It is my opinion at this point, but I may be wrong. Never know. The experience is that it will give us the final feedback.
 
casainho said:
Benoit said:
which could directly host a web interface, instead of a smartphone app. That way, no need to develop something for Android/iOS, the smartphone would connect to the ESP32 with WiFi. Then it could work with any smartphone, even with a PC/Mac, anything with WiFi and web browser !
That is not how devices works usually. A mobile app is like the standard. Even when comparing only with the ebikes on the market. I think is good to implemented as the users do expect it to work.

Also, with ANT+ LEV ebike standard, user will be able to choose use many different displays on the market and not only 2 different models as right now. That is not possible with ESP, even if ESP is very popular.

Benoit said:
And with that kind of board, we can update its firmware OTA.
Also with this wireless board, update just like on SW102 by Bluetooth, since is very similar microcontroller.

You're right and I agree with you.
And I think using a smartphone and using a Garmin like display are two different projects with different features (ANT+ for Garmin, no need to buy other devices for the smartphone).
 
I am new to the open source, and I have some questions, feel free to point me to another thread if this is the wrong one. I bought my motor from electrify bike last week and was promised that it had the latest firmware, I am running a 860 display. where do i switch to torque mode? 2: I am running the base 20 assist levels, currently using level 6 for flat, 8 for slight incline, and 10 for hills, on those levels it all feels pretty good and smooth. I also have boost on. However when I push to level 12 or 15 then it seems to take too long for the power to kick in and it seems to cut off soon after.
3: I would like to cut back to like 6 assist levels. I saw where to turn down the number of levels, but the full list of all 20 still is there, soo, if I turn to 6, will it just use the first 6, or will it take like 1 3 6 9 and soo on?
4: where I do the torque calibration, I turn it to enable. Can I leave it in enable or do I enable calibrate then turn it back off?
 
cavi said:
I am new to the open source, and I have some questions, feel free to point me to another thread if this is the wrong one. I bought my motor from electrify bike last week and was promised that it had the latest firmware, I am running a 860 display. where do i switch to torque mode? 2: I am running the base 20 assist levels, currently using level 6 for flat, 8 for slight incline, and 10 for hills, on those levels it all feels pretty good and smooth. I also have boost on. However when I push to level 12 or 15 then it seems to take too long for the power to kick in and it seems to cut off soon after.
3: I would like to cut back to like 6 assist levels. I saw where to turn down the number of levels, but the full list of all 20 still is there, soo, if I turn to 6, will it just use the first 6, or will it take like 1 3 6 9 and soo on?
4: where I do the torque calibration, I turn it to enable. Can I leave it in enable or do I enable calibrate then turn it back off?
If you have the last stable version, then you will find the option on Motor -> Motor control / Motor ctrl. And it is enabled by default.

For the other questions, I updated the page to try clarify them.
 
Battery percentage in the headline seems not to be resetting to 100 % after charging. Instead it stays at the emptied level of the last ride and then takes it from there although switched off ave charged. Actual Voltage is recognized though.
 
andyme said:
Battery percentage in the headline seems not to be resetting to 100 % after charging. Instead it stays at the emptied level of the last ride and then takes it from there although switched off ave charged. Actual Voltage is recognized though.
What have you set the reset voltage level to? It only resets on power up, so if your charger has competed a charge cycle and the bms has disconnected the charger, when you power up the display, it reads the resting battery voltage (53.2 in my case). So you should set your reset voltage to this level, not your charger cc/cv setpoint voltage (54.6 for me)
 
HughF said:
andyme said:
Battery percentage in the headline seems not to be resetting to 100 % after charging. Instead it stays at the emptied level of the last ride and then takes it from there although switched off ave charged. Actual Voltage is recognized though.
What have you set the reset voltage level to? It only resets on power up, so if your charger has competed a charge cycle and the bms has disconnected the charger, when you power up the display, it reads the resting battery voltage (53.2 in my case). So you should set your reset voltage to this level, not your charger cc/cv setpoint voltage (54.6 for me)

Gotcha, thanks! I have changed values and am charging now. Should be fine, I guess.
 
casainho said:
cavi said:
I am new to the open source, and I have some questions, feel free to point me to another thread if this is the wrong one. I bought my motor from electrify bike last week and was promised that it had the latest firmware, I am running a 860 display. where do i switch to torque mode? 2: I am running the base 20 assist levels, currently using level 6 for flat, 8 for slight incline, and 10 for hills, on those levels it all feels pretty good and smooth. I also have boost on. However when I push to level 12 or 15 then it seems to take too long for the power to kick in and it seems to cut off soon after.
3: I would like to cut back to like 6 assist levels. I saw where to turn down the number of levels, but the full list of all 20 still is there, soo, if I turn to 6, will it just use the first 6, or will it take like 1 3 6 9 and soo on?
4: where I do the torque calibration, I turn it to enable. Can I leave it in enable or do I enable calibrate then turn it back off?
If you have the last stable version, then you will find the option on Motor -> Motor control / Motor ctrl. And it is enabled by default.

For the other questions, I updated the page to try clarify them.

Thank you, I just looked at the page, and I still am in doubt, can I leave the torque calibration enabled? Or do I have to dissable it after doing my calibration?
 
The wiki says:

Street mode on/off: click first on DOWN and then ON/OFF long press
Motor max power: click first on UP and then ON/OFF long press
Virtual throttle: after enter on Motor max power, click again first on UP and then ON/OFF long press


Shouldn't this be: Street mode on/off: "while holding DOWN, long press ON/OFF" etc ...
Or is it really click (=press & release DOWN) and after that long press ON/OFF?

Same goes for the other modes?!

And another question: What does "Motor max power" do? When I enable it the screen shows 1500W. I can click up/down to change that value by 50W, and then? I don't get what this mode does and can't find the description on the WIKI.

An idea regarding "Throttle mode". I does work fine, and I understand that it's meant as an emergeny mode in case eg the torque sensor fails, a crank falls off etc ... It's a good idea to instantly set throttle to 0 when you release UP/DOWN. But it would be nice if it took of at some higher value but 0 when you press it again - maybe only if you press UP (means you need power) or starts from 0 when you press DOWN.

And it seems I can't make the motor engage at zero speed. It is even "worse" - the motor needs at least 60W human power to even engage - but human power only goes up during pedaling. What do i oversee?
 
Hello

First time poster, trying to write the firmware to the 860C, with no luck. From what I gather, this is the place to ask for help(?)

Power and ground comes from the bike (52V battery), serial from a USB2UART adapter, all four wires are connected to Higo Mini cable which is connected to display.
Display turns on. Also, I checked serial wiring and adapter (by exchanging messages between USB2UART and an Arduino), so I'm pretty sure that's all good. I also tried two different USB2UART adapters.

When I click on 'Update FirmWare' in API Burn Tools, TX starts counting up right away (which is consistent with EcoCycles' video, so this seems to be fine). When I then press the power button, RX increases by about 300 per (short) click, so RX definitely works and wires seem to be plugged in the right way around (however, it's only increased by 1 in EcoCycles' video). However, nothing happens after this, except for the perpetual "Waiting..." message.

Does this mean anything to anyone? I wouldn't know what else to do / check out, so any help would really be appricated.

Thank for all the work you're doing!
 
twokeys said:
Hello

First time poster, trying to write the firmware to the 860C, with no luck. From what I gather, this is the place to ask for help(?)

Power and ground comes from the bike (52V battery), serial from a USB2UART adapter, all four wires are connected to Higo Mini cable which is connected to display.

Hello you must also connect ground from USB2UART. You habe done this?
 
cavi said:
Thank you, I just looked at the page, and I still am in doubt, can I leave the torque calibration enabled? Or do I have to dissable it after doing my calibration?
Please propose the text on wiki that would clarify you for both cases.

izeman said:
The wiki says:

Street mode on/off: click first on DOWN and then ON/OFF long press
Motor max power: click first on UP and then ON/OFF long press
Virtual throttle: after enter on Motor max power, click again first on UP and then ON/OFF long press


Shouldn't this be: Street mode on/off: "while holding DOWN, long press ON/OFF" etc ...
Or is it really click (=press & release DOWN) and after that long press ON/OFF?

Same goes for the other modes?!
I think you are correct. Please update the wiki.

izeman said:
And another question: What does "Motor max power" do? When I enable it the screen shows 1500W. I can click up/down to change that value by 50W, and then? I don't get what this mode does and can't find the description on the WIKI.
Try by yourself to ride with a value like the 50, 75 or 100W and you will see. Then, please update the wiki.

izeman said:
An idea regarding "Throttle mode". I does work fine, and I understand that it's meant as an emergeny mode in case eg the torque sensor fails, a crank falls off etc ... It's a good idea to instantly set throttle to 0 when you release UP/DOWN. But it would be nice if it took of at some higher value but 0 when you press it again - maybe only if you press UP (means you need power) or starts from 0 when you press DOWN.
Seems a good idea! Maybe even resetting that value every time the users leaves the menu. Please add to the issues as an enhancement.

izeman said:
And it seems I can't make the motor engage at zero speed. It is even "worse" - the motor needs at least 60W human power to even engage - but human power only goes up during pedaling. What do i oversee?
Yes, motor startup without pedaling a bit (make motor rotate, easy motor startup form 0 speed) is not the best implementation on the firmware - something that should be improved. Put on the issues.
 
mallesepp said:
twokeys said:
Hello

First time poster, trying to write the firmware to the 860C, with no luck. From what I gather, this is the place to ask for help(?)

Power and ground comes from the bike (52V battery), serial from a USB2UART adapter, all four wires are connected to Higo Mini cable which is connected to display.

Hello you must also connect ground from USB2UART. You habe done this?

Thank you! I haven't. However, still no luck. At the risk of demonstrating my ignorance in all things electrical even more (which has bothered me for a while now, as a computer person...) - is this how it should look?

schema.png


If I do that, the one USB2UART adapter that has a LED for RX always shows it illuminated.
setup.jpg

However, it won't increase anymore in the software upon pressing the power button.

With the other adapter, in now increases by exactly one when I press the power adapter. Weird differece I guess, but verified twice.

In any case, the end result is still the same.

Thanks again for your consideration!
 
Back
Top