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

casainho said:
perryscope said:
I thought that may be the case. I did get this screen 2nd hand some time ago (dec 2018) as a spare for my BBS-02 setup so the original seller is unknown unfortunately, but I have tried to contact them in case that can share where they purchased it from. My guess is its an earlier version but it was described as a 'Bafang (Luna) 850C (DPC-14) Advanced colour display with USB' and it did indeed have the Luna Bafang firmware on, so I suspect it came from Luna Cycles originally.

Here is a photo of the case that may help other users avoid it.

IMG_20181231_174301.jpg

DP C14.UART
DPC14L0100021
V5.2 1609060400


Anyone know how to upload the original bafang firmware back on it ;)
Ok, nice to know it is a DPC14, I will put a warning on wiki about that model, saying it does not work.

I would say there is no way to put the original firmware back as at least if it works as 850C, it has encrypted bootloader that you erased and I guess no one has that bootloader unless the manufacturer. The original firmware "is locked" on purpose so no one can do a backup and flash again.

The DPC-14 and 850C are in fact the same. I have confirmed this with the manufacturer. The DPC-14s are the ones manufactured specifically for Bafang and sold by Bafang. The 850C is APT, the manufacturer's, model number. The issue is the age of the display as there have been many hardware and firmware iterations of both. Since about mid 2018 the 850C has used the same firmware. However, prior to that, the display was changing so often we had to match the firmware to the numbers on the back of the display before flashing it. If the wrong firmware was loaded, it bricked the display. Fortunately, the boot loader still works and if you have the right firmware, you can get it working again. I don't know if that last statement is true after flashing the open-source firmware (OSF).

I guess the bottom line here is that if you have an older 850C, you could brick it as perryscope discovered. Casainho, if you could post the numbers on the back of your working displays, I will do the same so people can have some confidence that flashing the OSF upgrade will work on their display.
 
I'm sad I just bought 3 KT-LCD3's but now I see the Bafang LCD :oops: is supported, lol...

Well the issue I am having is, what should I use to connect to the LCD itself? My ST-Link and KT-LCD3 did not come with a cable that has external pins, and my LCD model just has holes (no pins soldered on).

As you see where I circled in the pic, mine just has some holes. Is there a name for this connector?

DA2TE3q.jpg
 
NM I found it, Jst Xh 2.5-4 Pin Connector. I found loads of them in my motherboard bits.
 
Successfully flashed my first 850C. Very cool. Nice work Casainho! This is the new first choice display.

The 850C I flashed was manufactured 17 june 2018 version number TFTGDV2.1C60

Main screen is very readable and looks good. :thumb:
Config screen is awesome. It is completely intuitive and self-explanatory with no need to refer to the configuration guide. :thumb:

A few things I noticed:
- Config is set up like v18.2 even though this is working with v19.0 firmware.
- Could not find a way to enable the throttle.
- Could not find a way to power down the display/motor without disconnecting the battery.
- Could not find a way to jump to a config menu number rather than scrolling from the beginning through all of the settings.
 
Rydon said:
The DPC-14 and 850C are in fact the same. I have confirmed this with the manufacturer. The DPC-14s are the ones manufactured specifically for Bafang and sold by Bafang. The 850C is APT, the manufacturer's, model number. The issue is the age of the display as there have been many hardware and firmware iterations of both. Since about mid 2018 the 850C has used the same firmware. However, prior to that, the display was changing so often we had to match the firmware to the numbers on the back of the display before flashing it. If the wrong firmware was loaded, it bricked the display. Fortunately, the boot loader still works and if you have the right firmware, you can get it working again. I don't know if that last statement is true after flashing the open-source firmware (OSF).

I guess the bottom line here is that if you have an older 850C, you could brick it as perryscope discovered. Casainho, if you could post the numbers on the back of your working displays, I will do the same so people can have some confidence that flashing the OSF upgrade will work on their display.
1. So, first user need to buy the LCD but it can have sure what version it is before buying. I think a good way is to recommend to buy from PSWPower as I bought from there and they work. Would be nice if other sellers could claim if the version they are selling work or not with our firmware.

2. Second, since the user have to open the LCD before flash it, I think the safest way to verify is by looking at the reference of the microcontroller which is not hard to do and compare to this image:
Bafang_850C_board-01.jpg


After validating 1. and 2., I think is pretty sure the that our firmware will work. I will put this notes on the wiki, unless anyone has a better idea.

My LCD (works):
2019-07-16-08-40-13-1.jpg


Perryscope LCd (does no work):
file.php
 
Rydon said:
Successfully flashed my first 850C. Very cool. Nice work Casainho! This is the new first choice display.
Thanks and although the firmware needs a bit more work, which I plan to do on next days, I already put a recommendation on wiki for this LCD over the KT-LCD3. Maybe this is not fair as KT-LCD3 firmware is more stable, however, judging by your feedback and number of users that decided to use it on this first 5 days of this firmware, I think it will boost even more the TSDZ2 comparing to the KT-LCD3 and I think that is really important!!

I need time to take some good pictures of this LCD, showing a graph and data after a 10 minutes ride. This pictures should be used on wiki main page, I think this will spark interest from new users, will increase the value of TSDZ2 :)

Rydon said:
Config screen is awesome. It is completely intuitive and self-explanatory with no need to refer to the configuration guide. :thumb:
Yes and this is a big advantage over KT-LCD3. Nice to have this feedback.

Rydon said:
A few things I noticed:
- Config is set up like v18.2 even though this is working with v19.0 firmware.
- Could not find a way to enable the throttle.
- Could not find a way to power down the display/motor without disconnecting the battery.
- Could not find a way to jump to a config menu number rather than scrolling from the beginning through all of the settings.
- I need to update the configurations, there is a structure already for the menu configurations and adding new items it is not hard
- To power off, you need a long press on on/off button. Before I had a bug like that and the solution was to enter the configurations menu and then power off and it always worked. I could not replicate yet this bug on this first version of the firmware
- Yes, the menu is big, I wish to implement a collapse/expand of each category but that will take some days and I will not do it soon. Yes, I want to save current menu entry before turn off the LCD, I think this is what you refer.
 
Aquakitty
Hi you need this and I have it this way in everyone
 

Attachments

  • IMG_20190714_094148.jpg
    IMG_20190714_094148.jpg
    85.2 KB · Views: 2,576
  • IMG_20190715_170000.jpg
    IMG_20190715_170000.jpg
    89.8 KB · Views: 2,576
  • IMG_20190716_105046.jpg
    IMG_20190716_105046.jpg
    99 KB · Views: 2,576
  • IMG_20190716_112102.jpg
    IMG_20190716_112102.jpg
    58.7 KB · Views: 2,569
  • IMG_20190714_081440.jpg
    IMG_20190714_081440.jpg
    47.9 KB · Views: 2,569
Quick update for anyone interested.

I am very satisfied with how everything is working but have a couple of things to do. Am now focusing on the cadence sensor. There has always been a delay from when we stop pedaling to the point where the motor stops giving assistance. This was also a problem during startups in the form of "power lag". I solved the lag during startups but for slowdowns it is a bit trickier. The best thing would be an almost instant response so we can have a nice ramp of power. One user just recently reported this issue:

jimmyfergus said:
I'm assuming that you're also improving the slow-down responsiveness. In 0.19 the run-on is pretty strong, feels like ~1s after stopping pedaling, and to me at high assist even feels like a ramp up and then sudden stop. This is a problem for me with an internal gear hub, where gear shifts are very abrupt - unlike a derailleur when the chain ramps between cogs - I'm pretty sure if my shift comes through under power I'm really stressing that poor blue gear, but avoiding it means a very long, slow gearshift.

So this is what I am focusing on now. Will effectively use every cadence sensor signal change as they are verified to be equally spaced and then we will hopefully get twice the resolution. Meaning the lag time will be halved, at least! With some clever software we can have the system feel even more responsive.

fed.jpg
 
beardydave said:
Hi! Sorry if this is the wrong place for this.

I have been very happily running v17 of the software for a while now (36v, PAS only) but recently started having issues where power reduces then goes to 0, whilst the centigrade 'c' in the bottom right hand corner of the display blinks. The display still shows torque inputs, but 0 motor watts. Seems to happen when battery is roughly half spent with about 36.5v left. Disconnecting and reconnecting the battery doesn't help, charging the battery does. Any ideas what might be going on?!

Thanks in advance!

There can be a number of reasons why this is happening but before we start debugging, would you mind upgrading to 0.19.0 or do you really want to be on 0.17.0? Please let me know and we will do our best to help.
 
buba said:
So this is what I am focusing on now. Will effectively use every cadence sensor signal change as they are verified to be equally spaced and then we will hopefully get twice the resolution.
Note that on wheel speed sensor as also on pedal cadence, the calculated final value needs at least 2 signal impulses or otherwise sometimes there can be very wrong values calculated. Like, we need to know the time between 2 pulses, so we always start counting from one pulse to next one, so we always need 2 pulses (this at startup only!) -- unless you found a better way :)

For we be able to measure slow cadence values like 20 RPM, we must permit long time between pulses as: cadence = 1 / pulses time.

Maybe the original firmware uses the torque sensor + pedal pulses. We are waiting for cadence value, but min calculated cadence value is 20.

if ((torque_sensor > 0) AND (2 pulses of PAS in the same direction))
{
start_motor()
}

Also note that min time to detect cadence = 0 is at 20 RPM, which is 3 seconds for a full pedal rotation but we have 20 PAS magents = 3 seconds / 20 = 0.15ms. Adding more delay like 100ms, it should be no more than 1/4 of second, which I think is ok for a delay.
 
casainho said:
buba said:
So this is what I am focusing on now. Will effectively use every cadence sensor signal change as they are verified to be equally spaced and then we will hopefully get twice the resolution.
Note that on wheel speed sensor as also on pedal cadence, the calculated final value needs at least 2 signal impulses or otherwise sometimes there can be very wrong values calculated. Like, we need to know the time between 2 pulses, so we always start counting from one pulse to next one, so we always need 2 pulses (this at startup only!) -- unless you found a better way :)

For we be able to measure slow cadence values like 20 RPM, we must permit long time between pulses as: cadence = 1 / pulses time.

Maybe the original firmware uses the torque sensor + pedal pulses. We are waiting for cadence value, but min calculated cadence value is 20.

if ((torque_sensor > 0) AND (2 pulses of PAS in the same direction))
{
start_motor()
}

Yes! I think the original firmware has the implementation you describe, if I remember correctly. But is a long time since I thoroughly tested the original firmware. You originally implemented motor assistance only if we have cadence detected and I feel this is much nicer and safer. As a user you always know that the motor will not start unless there is pedal rotation. And on my development version the startups are instant as it detects low cadence values so it works great! Only need to move the pedals a tiny bit and the motor is activated.

But for it to work even better and to solve the runaway bug I hope I can make the cadence measurements better. Will implement today and test tomorrow!



casainho said:
Also note that min time to detect cadence = 0 is at 20 RPM, which is 3 seconds for a full pedal rotation but we have 20 PAS magents = 3 seconds / 20 = 0.15ms. Adding more delay like 100ms, it should be no more than 1/4 of second, which I think is ok for a delay.

Have increased the cadence resolution and it works great. But the runaway becomes longer. So tested the cadence sensor and saw an opportunity to increase the resolution with considerably less delay.

By the way, the current code I have now changes the resolution depending on wheel speed. So the faster you go the lower the resolution. This makes it very responsive. Minimum cadence measurements go from 4 RPM to 10 RPM depending on speed. But I do not like it now when I see another, better, way to improve the resolution. Will do my best to implement something that works very good!
 
PhotoPictureResizer_190716_184252676_crop_2132x2192-852x876.jpg

I Lost 8oz on my main drive gear....next I'm going for 4 more oz with a smaller needle clutch bearing.
This thing is built like a tank with a Prius motor!
 
dameri said:
I'd like to know what is pinout for Bafang 850C cable.
I'm thinking to buy this https://tinyurl.com/y4yvrlgl and connect it to bafang cable.

Bafang cable:
850Ccable.JPG

Here is the Bafang display harness pinout and everything else in the 1 to 4 cable. Don't forget to reverse it for the opposite gender.
Bafang BBSHD-BBS02 Wiring Diagram.png

You can also just buy one of these from any number of sources and cut it in two. https://www.electrifybike.com/store/p125/Display_Extension_cable_50cm_%2820_in%29.html#/
 
twiersum said:
I Lost 8oz on my main drive gear....next I'm going for 4 more oz with a smaller needle clutch bearing.
This thing is built like a tank with a Prius motor!

Would be interesting to know how this feels !!
 
Rydon said:
dameri said:
I'd like to know what is pinout for Bafang 850C cable.
I'm thinking to buy this https://tinyurl.com/y4yvrlgl and connect it to bafang cable.

Bafang cable:
850Ccable.JPG

Here is the Bafang display harness pinout and everything else in the 1 to 4 cable. Don't forget to reverse it for the opposite gender.
Bafang BBSHD-BBS02 Wiring Diagram.png

You can also just buy one of these from any number of sources and cut it in two. https://www.electrifybike.com/store/p125/Display_Extension_cable_50cm_%2820_in%29.html#/

Thank you. Wery good diagram.
 
There is not yellow wire coming from Bafang 850C display, it's white. This changes situation.
850CPinOut.png

This is from wiki:
 

Attachments

  • Summary of connections between KT-LCD3, Bafang 850C and TSDZ2 motor cable.png
    Summary of connections between KT-LCD3, Bafang 850C and TSDZ2 motor cable.png
    21.1 KB · Views: 2,394
twiersum said:
PhotoPictureResizer_190716_184252676_crop_2132x2192-852x876.jpg

I Lost 8oz on my main drive gear....next I'm going for 4 more oz with a smaller needle clutch bearing.
This thing is built like a tank with a Prius motor!

Wow, a lot of work!! Very good job! I think that if you not use the cruise function as me and many others, you can safely remove the clutch bearing and use an thickness of aluminum keyed! This paired with along with your lightening solution would save a lot of weight :thumb:
 
Hm, i do not understand the intention of the "street-mode" after the changes >18.0.
How do you use your bike?

For me, most of the time i'm on the public streets where (at least in germany)
you are not allowed to get assistance over 25 km/h and have to limit the power to 250 watts.
Of course, cruise-mode is also not allowed...

If i get off the public roads, i would like to use a button-combination (that should not be to "easy" and get
activated "by accident" :twisted: ) to enable an offroad-mode or disable the new "street-mode".

Why is this changed in the new version? For me, it just looks like an inversed offroad-mode. Why would somebody
want a mode, that obviously get attraction by the blinking assist-symbol for "street-mode"?
 
Please regard, that in Germany the maximum average power is limit on 250 W. Most of the OEM pedelecs (Bosch, Yamaha, ...) have peak power up top 500 W and more.
 
troebi said:
Please regard, that in Germany the maximum average power is limit on 250 W. Most of the OEM pedelecs (Bosch, Yamaha, ...) have peak power up top 500 W and more.
Yes, you are right. But i already got in trouble because some officers don't get the "peak power" calculation and just see the Power-Meter on the LCD3.. So i limited that on my bike, too :?
 
Original firmware have a peak of 540w, ad it's legal. All the controller of legal hub are 7-14 amp. For me 250w of limit it's too low for climbing on hills
 
fi7ippo said:
twiersum said:
PhotoPictureResizer_190716_184252676_crop_2132x2192-852x876.jpg

I Lost 8oz on my main drive gear....next I'm going for 4 more oz with a smaller needle clutch bearing.
This thing is built like a tank with a Prius motor!

Wow, a lot of work!! Very good job! I think that if you not use the cruise function as me and many others, you can safely remove the clutch bearing and use an thickness of aluminum keyed! This paired with along with your lightening solution would save a lot of weight :thumb:

Not sure you can get rid of the clutch bearing.. when you stop pedaling the motor still assists you for a little while therefore without the bearing the pedals, and so your leg, receive a unwanted "kick".. am I right?
 
buba said:
Quick update for anyone interested.

I am very satisfied with how everything is working but have a couple of things to do. Am now focusing on the cadence sensor.

Sweet! I'm just about to go on vacation, and very enthusiastic about trying all the new stuff some time after I get back in August.

Thank you!
 
Back
Top