Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BBS02] Speed sensor loses tracking #114

Open
MrHumanRebel opened this issue Apr 23, 2023 · 92 comments
Open

[BBS02] Speed sensor loses tracking #114

MrHumanRebel opened this issue Apr 23, 2023 · 92 comments
Milestone

Comments

@MrHumanRebel
Copy link
Contributor

MrHumanRebel commented Apr 23, 2023

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!

@danielnilsson9
Copy link
Owner

No idea. I think there is one other guy on a BBS02 who had similar issue too along with a lot of other issues. Haven't seen a this on my BBSHD or TSDZ2. I can leave the issue open but if this was a common firmware issue on the BBS02 I would have expected quite a few reports.

I own no bike with BBS02 so I have no experience of how it runs on that controller, support was added blindly by me and then tested by others.

@kb79000
Copy link

kb79000 commented Apr 23, 2023

Hi, i did not notice this problem on my bbs02b

@silenec
Copy link

silenec commented Apr 23, 2023

Yeah I did notice this on my last longer ride with road speed limited PAS levels. The motor randomly cuts power for no apparent reason and spins up again while the speed on the display goes up to 50s. Not very often though as you say so it is hard to diagnose.

@ronmicro
Copy link

Yeah I did notice this on my last longer ride with road speed limited PAS levels. The motor randomly cuts power for no apparent reason and spins up again while the speed on the display goes up to 50s. Not very often though as you say so it is hard to diagnose.

My bbs02b with v1.3.1 has this same problem of random power cuts, it happens about 2 or 3 times in a 10 mile ride

@danielnilsson9
Copy link
Owner

Alright, definitely sounds like a firmware issue then. Was anyone of you running 1.2? Was the issue present there too or is it new in 1.3?

@MrHumanRebel
Copy link
Contributor Author

Alright, definitely sounds like a firmware issue then. Was anyone of you running 1.2? Was the issue present there too or is it new in 1.3?

Personally, I started using this firmware from 1.3.1 so I have no information regarding this.

@ronmicro
Copy link

I started from 1.3.1 too but i just tried version 1.2.0 on a long ride and it still happened a couple of times

@Larswagner1987
Copy link

Ich habe auch mit 1.3.1 angefangen, aber ich habe gerade Version 1.2.0 auf einer langen Fahrt ausprobiert und es ist immer noch ein paar Mal passiert

that's a shame, do you have any idea what could be wrong, when does it happen, is there a trigger or did you notice something?

@Gonespa
Copy link

Gonespa commented Apr 29, 2023

Hi,

I Have 1.2.0 too and noticed the same. I though this was related to the fact that i have max current set to 33 amps in a bbs02 and it was hitting some kind of extreme condition but I see it might be due to other thing. In my case, I noticed that behaviour when locking the rotor and demanding max current for a few seconds. I managed to see an error coming in the log.

@Larswagner1987
Copy link

I also suspect that it has something to do with the current, every time the motor is supposed to give current it happens, on the road it's just not a problem but as soon as there is an increase it starts as soon as he has to give more current then he interrupts 1-2 seconds and then the line comes back, I have a bbs02b motor 48v 750Watt

@dav0000000
Copy link
Contributor

Are you guys using pas or throttle when it happens and if you are in SPORT, is it still in SPORT after the problem?

@Larswagner1987
Copy link

ich benutze nur pas und die normal , also kein Gas oder Sport

@Gonespa
Copy link

Gonespa commented Apr 29, 2023

I have only noticed this when using the throttle. I am not 100% sure about the mode, but I would say thay the mode is not changing.
If it happened I would probably not notice it since I have configured the "standard" mode as full power mode (and the one I use 99% of the time0 and "sport" mode as a tamed down one.

@Larswagner1987
Copy link

I have no gas in use, I tried again to generate the error and it only comes when the engine draws power, then the power goes away and comes back then it's fine and at some point it starts again, it's weird, it can but just look at my display and see how the watt reading goes to 0 in time and then is full again. must be a small thing, but where only in the log is there nothing in it for errors.

@danielnilsson9
Copy link
Owner

@Gonespa Probably not related to this issue unless others also have their current set that high. It's been reported before that it's not possible to set current above 25A for BBS02 because some other hardware protection is triggered outside the control of this firmware, that is probably what you are seeing. Set max current to 25A and it should work normally.

@Larswagner1987
Copy link

@danielnilsson9 I have mine set to 23a and it can be 25a, could it be because the engine had the misfires as a result???

@Gonespa
Copy link

Gonespa commented Apr 30, 2023

@Gonespa Probably not related to this issue unless others also have their current set that high. It's been reported before that it's not possible to set current above 25A for BBS02 because some other hardware protection is triggered outside the control of this firmware, that is probably what you are seeing. Set max current to 25A and it should work normally.

Agreed, I only mention it since the described behaviour looks exactly as I saw. I mean, behaves just like when the motor control micro returns an error: power disconnects completely for 1 or 2 seconds and the resets. Looks to me it is returning some kind of error. I was thinking, is it possible to save in permanent storage "the first error" returned, so that it can be retrieved like a car MCU does with the app?.

Anyways, other than that extreme condition, I also noticed this a few times when using the bike in much less stressing conditions.

@Larswagner1987
Copy link

@danielnilsson9 The only thing I have done now is connect the laptop and start and then the error comes, but it only shows Motor target current changed to 0% for 1 second and then it goes back to normal, and once it says Failed to read voltage from motor controller, everything was fine so far.

@Larswagner1987
Copy link

@danielnilsson9

I've tried everything now and it's a pity that this error is there, as soon as the laptop is connected it doesn't come up anymore as soon as it's not connected it comes up which is strange, the cables are new. I tried different settings but it didn't work, I don't know what the problem is anymore, sometimes it's there immediately, sometimes it's only there after 4 km, then it doesn't work at all, it just breaks off and then the performance comes back after 1-2 Seconds, I've got the original bbs02 version back on it now, if you find the bug and then have a new version I'll try it.

@danielnilsson9
Copy link
Owner

I see, yes you are probably better off with the original firmware. These issues are not likely to be fixes as I don't have a bbs02 and are not doing any work on that motor. So unless someone else decides to do some investigation here it will probably stay this way.

@Larswagner1987
Copy link

@danielnilsson9

ok shame, like I said, it's great except for the error, I can only send you a bbs02 controller or the original hex file, can you do something with it then?

@silenec
Copy link

silenec commented Apr 30, 2023

I got back from another ride and I can say this bug appears way more often and / or is more noticeable when going uphill.
I can pretty much predict some situations where it happens. It almost always happens when approaching a hill.

  • when road speed goes down and current goes up, the motor stops and starts again like 90% of the time
  • it rarely happens when road speed goes up and current goes down (going downhill)
  • it happens less often when going at constant speed in lower PAS levels
  • it happens less often when road speed is higher (= more pulses from the speed sensor) even with stronger assist level
  • it is probably the same problem I mentioned in PAS + Throttle + MaxSpeedPercent = problem #105
  • when going uphill in PAS5 (PAS + MaxSpeedPercent, config file in the link above), I got the motor to constantly skip even without throttle - previously I thought it only happened with PAS + Throttle + MaxSpeedPercent but that is not the case
  • it does not happen when using throttle only (no PAS)

I think we should test some bare minimum firmware - no temperature monitoring, no throttle, no keep current, no push walk, no ramping anything that is not necessary, maybe even no speed sensor if possible etc. and see when it starts working properly.

@Larswagner1987
Copy link

@silenec then try it and let me know, I definitely need the speed sensor and the shift sensor too, I don't need the rest like the gas, I hope that the error trigger is found, the original version is really not nice to use there this version is perfect. thank you already 👍

@danielnilsson9
Copy link
Owner

danielnilsson9 commented Apr 30, 2023

@Larswagner1987 Thanks but I have a BBS02 controller and firmware but diagnosing things that only occurs while riding on high power is hard with a controller on my desk.

@silenec That makes sense, I was never able to reproduce that issue, I have ridden > 100km since then using PAS and throttle on high power on my BBSHD but it's rock solid, I have not seen a single glitch.

Weird thing is that there is not really any BBS02 specific code here in this firmware apart from pin assignments and motor MCU configuration. Search "BBS02" in all files and you will find very little. The motor MCU config was directly mirrored from the original BBS02 firmware.

Does the speed on you display show incorrect value each time this happens?

@silenec
Copy link

silenec commented Apr 30, 2023

Sometimes I see speed glitches on my display when it happens but sometimes I do not yet the motor still stops. It is weird. Maybe something in the NEC MCU does not like how the new FW behaves? Maybe there are some limits like maximum change of current / % of requested power per second or something and the limits might be different for BBSHD? And when something goes over the limit, NEC MCU "resets" and starts again? I have no idea honestly.

@danielnilsson9
Copy link
Owner

Ye maybe, I was thinking along these lines too as there is actually an error code reported from NEC MCU on BBS02 described here https://github.com/danielnilsson9/bbs-fw/wiki/NEC-Motor-Control-Protocol which I guessed was an overcurrent error but could be anything really. It's not exported to any error code sent to the display so you will never se an error when it occurs. Would be interesting to know if that error is set when this issue occurs.

NEC MCU shutting down doesn't explain the speed sensor reading issue though, since speed sensor reading is done by this firmware..

@silenec
Copy link

silenec commented Apr 30, 2023

Now that I think about it... I put new chain on an older cassette once and the chain used to skip. The motor somehow detected that and every time the chain skipped, the motor did exactly this - stopped and spinned up again. Same thing when my rear tire slipped on ice in winter - motor stopped and started again. Not sure how that worked exactly. That was a few years ago on stock FW. Might it be the "chain skip protection" (if there is one) getting triggered by glitchy speed sensor values? Is the speed sensor reading reported to the NEC MCU or not? I guess not so this would not make sense then... hmm

@dav0000000
Copy link
Contributor

I had speed sensor rise with a watchdog reset a while back. Only way I knew was SPORT mode always reset to STANDARD as the system restarted.

@Larswagner1987
Copy link

Hello

have you tested everything? a friend of mine thinks it could be something with the magnets, because when you drive and the power is gone, he took a closer look and noticed that it could be in the pas leagues, but there could also be incorrect information, the second could be there it's all mirrored what's wrong with the current values, since the BBs motor does a mini reset and then it's full again, or could it be that the memory/ram is too full and that's why it's happening?

@danielnilsson9
Copy link
Owner

@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
Copy link

silenec commented Aug 28, 2023

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
Copy link

silenec commented Aug 30, 2023

@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
Copy link

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

@silenec
Copy link

silenec commented Aug 30, 2023

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
Copy link

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

@Larswagner1987
Copy link

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
Copy link

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

@Larswagner1987
Copy link

Larswagner1987 commented Sep 13, 2023

@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
Copy link

Zensaition commented Sep 14, 2023

@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
Copy link

@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
Copy link

Zensaition commented Sep 14, 2023

@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
Copy link

silenec commented Oct 14, 2023

@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
Copy link

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
Copy link

silenec commented Oct 15, 2023

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
Copy link

@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
Copy link

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
Copy link

@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
Copy link

silenec commented Oct 15, 2023

@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
Copy link

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

@silenec
Copy link

silenec commented Oct 15, 2023

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 #195

@danielnilsson9
Copy link
Owner

@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
Copy link

silenec commented Oct 15, 2023

@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 7ec3cc5
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
Copy link

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

@silenec
Copy link

silenec commented Oct 21, 2023

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
Copy link

Zensaition commented Oct 25, 2023

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
Copy link

silenec commented Feb 17, 2024

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
Copy link

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
Copy link

silenec commented Feb 17, 2024

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
Copy link

silenec commented Apr 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

11 participants