danielnilsson9 / bbs-fw

Open source firmware for multiple electric bike motor controllers.
GNU General Public License v3.0
183 stars 37 forks source link

[BBS02] Speed sensor loses tracking #114

Open MrHumanRebel opened 1 year ago

MrHumanRebel commented 1 year ago

Recently rode the bike with the latest 1.3.1 version for a long run, I noticed around every 10-15 minutes the speed sensor data is not shown properly for a few seconds. For example cruising at constant 35 km/h and sor a few moments firstly a lower speed is shown like 15-20 km/h and then a spike up to the 50s, then it is back to normal. Might be a sensor pulse filtering issue, but I'm just guessing at this point, I have no more information about his anomaly.

The speed sensor and the magnet is located perfectly to each other, and working (and so blinking) perfectly fine. This is with a BBS02B.

Thanks in advance!

ronmicro commented 1 year ago

That is the edited function, if you compare the original i just prevented it from being able to default to ASSIST_0. You could probably test this on v1.3.1 by just programming assist level 0 to be active.

Larswagner1987 commented 1 year ago

Das ist die bearbeitete Funktion. Wenn Sie das Original vergleichen, habe ich nur verhindert, dass sie standardmäßig auf ASSIST_0 eingestellt werden kann. Sie könnten dies wahrscheinlich auf Version 1.3.1 testen, indem Sie einfach die Unterstützungsstufe 0 so programmieren, dass sie aktiv ist.

So enter a value at level 0 that it is active or am I wrong there?

aalm commented 1 year ago

So enter a value at level 0 that it is active or am I wrong there?

I think that would be rather non-optimal workaround, given you would have only one level of settings working without the issue, and to fix that, rebuilding with the above change by ronmicro will be easier.

Btw., which display are you having this issue with?

danielnilsson9 commented 1 year ago

@ronmicro Wow nice find! Thank you for investigating. Must be either some message sent that this firmware can't parse or some interference on the lines causing this. There are checksums on these messages which I had forgot to verify. Interference would explain speed sensor reading dropping out too...

I will add your fix in next version which should make this far less likely to occur.

MrHumanRebel commented 1 year ago

Built a beta from the "issue_114" branch, works fine, no dropouts now while riding (I only did about 50km though). But the speed still goes from 35 km/h to 22-25 km/h occasionally on the display for some reason while cruising at the same speed (35). So something is still in our way to find out...

Larswagner1987 commented 1 year ago

where can you find the beta version or is it still uploaded??

danielnilsson9 commented 1 year ago

@MrHumanRebel Thanks for testing, I will merge the changes. It's more of a workaround than an actual fix.

There are basically two things that are equally likely to cause these issues:

@Larswagner1987 There are no precompiled beta versions, you will have to build from source or wait for release.

Larswagner1987 commented 1 year ago

oh okay, then I'm curious when it will be published, or can someone create a file for me that I can upload it, I don't know how I can do it myself.

silenec commented 1 year ago

I flashed 1.4.0 and the workaround for this issue seems to work great - BBS02 is usable now. Speed reading still goes up and down sometimes so speed limited PAS levels / street legal setup cannot be really used because of quite violent power drops and restarts. Other than that I am very happy with it. Seems to work perfectly with no (100km/h) speed limits set.

Larswagner1987 commented 1 year ago

what do you mean ?? more details please

silenec commented 1 year ago

wie meinst du das ?? bitte mehr Details.

https://endless-sphere.com/sphere/threads/bbs-fw-open-source-firmware-for-bbshd-bbs02-controller.117092/page-15#post-1770959

Larswagner1987 commented 1 year ago

it turned out perfect thanks to everyone who helped 👍👍💪👍👍💪

danielnilsson9 commented 1 year ago

@silenec So the speed limit kicks in when the speed on display goes up? That would mean that it is not just a communication error but rather a computation error if the computed speed is wrong too.

silenec commented 1 year ago

I don't really know but I think so. With 100km/h speed limit nothing happens when the speed jumps up and down or at least I don't feel any change in power because as I understand it, PAS control is cadence based. However when I use PAS level with 25km/h speed limit set and my actual speed goes near 25km/h, all hell breaks loose - then it feels like the motor not only decreases power but suddenly and completely stops spinning and starts spinning again with virtually no ramp up only to stop again 0,5s later and this repeats until i stop pedaling (which I do almost instantly because I don't want to break anything). Now I just don't use any speed limits and that works fine for me. When I used v1.3.1 I tried Cruise control and that actually worked beautifully with max speed limits set, it just cruised at 20km/h with no problems. Almost as if the speed jumps only happen with pedals spinning / cadence based PAS active. Anyway I had no speed jumps with stock FW during the last few months so the hardware should be good. Really seems like also some computation error to me.

silenec commented 1 year ago

@Cabal83958 and do you use road speed limits? Motor works perfectly for me too even with weird speed readings (my C961 display does not show watts) but only with no speed limits used.

Larswagner1987 commented 1 year ago

I have my problems with me, it shows everything as it should be, no failure, no display problems

silenec commented 1 year ago

Yes, it's limited to 60 km/h

Well and do you normally reach that speed? If not, then that's probably why it works fine for you.

Zensaition commented 1 year ago

No fix for this issue at all is there no way to know what the system is doing with a data logger?

Larswagner1987 commented 1 year ago

I have also installed it on other Bafang e-bikes and no errors are displayed or detected.

Test Version 1.4.0 is the Best 👍

Zensaition commented 1 year ago

@Larswagner1987 what's your display? Mine is a dpc18 maybe screen shot your settings for the app?

Larswagner1987 commented 1 year ago

@Zensaition also installed the display on the second e-bike, including the Dz41, the settings on the display are all at the factory settings, I have version 1.4, which was newly released, installed on my controller, which one do you have???

Zensaition commented 1 year ago

@Larswagner1987 weird Idk I even flashed the firmware 2 times to make sure it stuck good? I have the STC15F2K60S2 on my bbs02b motor? im just confused if your dpc18 works... mine is from luna cycles? why is mine bugging out but works fine on stock firmware just goes crazy on this one!! ugh. Like others i saw have issues with this too. I installed 1.2 like last year or when ever it was released did kinda the same thing. I have 1.4 installed might try again, Im 100% sure i did all the steps right. could be the speed sensor being old? i could replace that to see. Can you show me the settings you inputted with the app? Does your ebike have a gear sensor and ebrakes?

Larswagner1987 commented 1 year ago

@Zensaition I use the gear sensor in the same way as the brake, unfortunately I don't know how to upload a picture, I installed the software 1.4 for my wife and children and for me too, everything without errors, I'll try the data to post on another site and then send you the link.

Zensaition commented 1 year ago

@Larswagner1987 You can drag the screen shot file or photo on the bottom bar of the box you type in its in grey writing its on the very bottom. but thats good it works for you and your family lmao. yeah weird we have the same setup then I guess besides the ebrake then maybe thats the issue

silenec commented 1 year ago

@danielnilsson9 I have managed to film a video with the latest FW version. I use PAS levels 1-4 with my BBS02. Global Max Current is set to 25A, all PAS levels use 100% max cadence and 100% max speed (100km/h). PAS1 = 12% max current PAS2 = 18% PAS3 = 30% PAS4 = 46%

PAS1 and PAS2 work just fine, no speed jumps on the LCD, no power drops PAS3 works mostly fine - small speed jumps on the LCD when going uphill sometimes, no power drops PAS4 works ok when going at fast and steady speed on flat terrain but shows massive speed jumps on the LCD when going uphill, motor randomly stops and restarts when going uphill when some unknown conditions are met (probably when the LCD speed jumps to maximum or minimum values). When the motor restart happens, it is very likely to happen again in a few seconds if I continue pedaling. Sometimes the motor does not restart but speed is jumping up and down on pretty much every hill. Anything higher than PAS4 / 46% max current just means more frequent motor restarts. Throttle only works just fine with 0-100% current - no speed jumps, no restarts even with full power. No pedaling = no speed jumps. PAS level with max speed set (like 25km/h or lower) = instant motor restarts once I reach that speed both on hills and flat terrain even with PAS1 / low current.
Stock FW = no problems at all.

https://uploadnow.io/s/766c41d2-f4c6-4d41-a534-0d065ca68cca?o=t

Larswagner1987 commented 1 year ago

Have you ever cleaned your magnet and is it positioned correctly, i.e. the distance??? For me and my wife it doesn't cause any problems, everything fits and works.

silenec commented 1 year ago

Yes magnet is fine, I checked it. LCD speed is perfect when using throttle only or with stock FW. So that pretty much rules it out I think. However I wonder if having a full suspension bike could have something to do with the motor restarts. PAS actually activates sometimes without pedaling because the frame rotates a bit with the shock travel. I need to raise the Start Delay which is currently set at 90 degrees. So maybe it could also register as backpedaling when the shock travels in the opposite direction? That would not explain the speed jumps though. Anyway, Stop Delay is now 200ms - is that too low for a FS bike? What else could cause the motor to stop? Is there any PAS minimum or maximum speed in the FW? Could it be disabled as a workaround for this issue? Motor temperature is <40C when this happens so that's probably not it.

Larswagner1987 commented 1 year ago

@silenec I also have a full-suspension bike, it's not like that for me, no matter what I set, everything works as it should, I don't use gas, but I've had problems with that too and when I take the throttle off, I have no problems, pedaling backwards The engine doesn't start, I don't know what's wrong with you, but for me it just gives me the reason to drive without the throttle and see if the problem is still there. Just try to adjust pas and deactivate the throttle and let me know if it's still like that. sorry my english is not that good and I use a translator,👍

ronmicro commented 1 year ago

What design of rear suspension do you have, is it possible for the magnet and sensor to shift out of alignment slightly as it compresses?

Larswagner1987 commented 1 year ago

@silenec It may be that it shifts if it is not properly fixed, of course you have to keep in mind that the position will then shift and it will then not display correctly. Try driving normally without it bouncing and then you drive and jump a little so that the frame moves then you notice that there is a jump on the display.

silenec commented 1 year ago

@Larswagner1987 I have no problems with throttle. Motor does not start when pedaling backwards, it stops like it should. It just stops when it shouldn't. @ronmicro I don't think so. Magnet is on the lower chainstay so it moves together with rear wheel. The bike: https://i.imgur.com/2vc1GRA.jpeg

Speed on the LCD jumps even on nice flat road without bumps in PAS4. That does not happen in PAS1 or PAS2 or with stock firmware.

Larswagner1987 commented 1 year ago

then you have to use the originals again, as I said, no one has had any problems with the new software so far.

silenec commented 1 year ago

Well not really. I need lower voltage cutoff with my battery and I only get that with BBS-FW. It rides just fine in PAS1-3 and that is all I need most of the time (I reach 30 to 35+ km/h in PAS3). I can also use the throttle when I need more power. If you look at the original post, clearly I am not the only one with this problem. There are some more recent issues also https://github.com/danielnilsson9/bbs-fw/issues/195

danielnilsson9 commented 1 year ago

@silenec Thank for detailed error description.

Power cut at high speed could be caused by calculated speed exceeding 100km/h... That means it's not a display communication issue like the other one mentioned in this thread.

That does however not make much sense when combined with only happening while using PAS. You say "No pedaling = no speed jumps.". Do you have problems if you pedal while using throttle (on a throttle only level) or is it only in PAS?

silenec commented 1 year ago

@danielnilsson9 I think the LCD shows a bit averaged value (?) so the individual spikes could be much higher, maybe even exceeding 100km/h like you say or go near 0km/h when moving?

I had problems with pedaling + throttle + 1.3.1 with or without PAS but that got fixed with 1.4.0 - maybe this helped https://github.com/danielnilsson9/bbs-fw/commit/7ec3cc532df4142163f09f614c258aebc35d9c81 So yes, I can now pedal without PAS and use throttle at the same time with no problems and no speed jumps on the LCD. Even full throttle (limited to 80% in config) works just fine, no speed jumps, no power cuts.

It only happens with active PAS and only above ~30% current. It happened even with low current when I was on 1.3.1 and throttle + pedaling also was not working so it got much better with 1.4.0 but it is not completely fixed yet.

ronmicro commented 12 months ago

You could test disabling the speed sensor in the config tool, it looks like it skips the apply_speed_limit function then

silenec commented 11 months ago

I could try that when I find the time. Correction: speed jumps are also present without PAS with heavy throttle + pedaling and I also see some at lower current PAS2 level when the motor spins up after a gear change. Much smaller speed jumps though and no power cuts in both cases.

Zensaition commented 11 months ago

I could try that when I find the time. Correction: speed jumps are also present without PAS with heavy throttle + pedaling and I also see some at lower current PAS2 level when the motor spins up after a gear change. Much smaller speed jumps though and no power cuts in both cases.

These are exactly my issues and a few others. No matter what setting I turn off or on, it just jumps and breaks the sensors to go to 100+. Sometimes even power is limited or wont go past 5% on full throttle. I gotta hard power off to reset the system.... its gotta be maybe the firmware install process or the usb cables we are using. like if others arent complaining alot, which would be good to know how many downloads to really know the ratio lol.... maybe mcu likes different mhz? could also be display compatibility issues... on stock this all works fine....

what I noticed is, when its at 600watts ish and on a uphill load with pas, breaks it completely. so its gotta be conflict with all those together or just the watt meter to speed sensor or install wasnt perfect for some reason. I did it 4times now... step by step.

silenec commented 8 months ago

You could test disabling the speed sensor in the config tool, it looks like it skips the apply_speed_limit function then

@danielnilsson9 @ronmicro Small update after a while - I have unchecked Speed Sensor in config tool and my problems are indeed resolved. I can finally use all of the power and I still see the speed on LCD even with speed sensor disabled so that is good. Only issue left is that I can't make the bike street legal with no speed limits but I can live with that for now.

ronmicro commented 8 months ago

i guess its missing a pulse, maybe the bafang firmware had some averaging to compensate for that. you could try stacking a stronger neodymium magnet on top of your spoke magnet

silenec commented 8 months ago

Good idea, I will try that. The frame and spokes could be flexing a little bit when accelerating hard so that could explain why the speed reading gets worse under those conditions. I still get some inacurrate numbers and that does not happen with stock FW so you might be right.

silenec commented 5 months ago

I used two magnets on top of each other with the sensor really close to them. It made no difference at all - speed still jumps around so I continue to run with speed sensor disabled.