Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Electric Motors and Controllers
casainho   10 GW

10 GW
Posts: 4099
Joined: Feb 14 2011 2:43pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by casainho » Sep 13 2019 5:00am

perryscope wrote:
Sep 13 2019 2:50am
casainho wrote:
Sep 10 2019 3:22pm
perryscope wrote:
Sep 10 2019 2:17pm
can I just check should the battery icon change when the battery is full or is it just static empty icon at the moment?

I understand if this has not been coded yet just was not sure if its a bug or just not yet implemented.
Battery icon works. Make sure to select correct mount of battery cells on configurations.
Yes selected 13 cells for a 48V battery, it is moving but I feels like its on the low side, for example at 46.5v you would think the battery was empty looking at the symbol, when in reality that's closer to half full. in comparison the KT-LCD3 would show two out of 4 segments or half full. Not a big issue but due to the small font its difficult to read the voltage amount on the move and a quick glance at the battery symbol is more important.
I am using 14S and I have the same issue, at about 50V / about half of the battery, the icon shows battery almost empty.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by geeksville » Sep 14 2019 4:16pm

hex4def6 wrote:
Sep 10 2019 5:18pm
Quick side question: is it possible to use another openocd compatible flashing tool? I have a flyswatter2, ft2232h, and an olimex usb-tiny-h at my disposal.
Probably fine (I've used many different adapters with openocd) - just make sure the voltages are compatible! If you do use such a tool please add instructions on the wiki for that tool.

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by geeksville » Sep 15 2019 5:42pm

ok - new release coming out this week (based on our now merged 850C and SW102 codebases). Anyone have any bugs to report that you haven't mentioned in github? If so, now's a good time ;-)

jimmyfergus   100 mW

100 mW
Posts: 49
Joined: Jul 17 2018 4:19pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by jimmyfergus » Sep 16 2019 8:22am

geeksville wrote:
Sep 15 2019 5:42pm
ok - new release coming out this week (based on our now merged 850C and SW102 codebases). Anyone have any bugs to report that you haven't mentioned in github? If so, now's a good time ;-)
Excellent! Looking forward to it. Will this still be for 0.19, or will it work for 0.20?

When I turn on the SOC feature for capacity, it always showed 0%, so I'm currently just monitoring with battery voltage. Is that a bug, or something I haven't configured properly? Configured the cells count and the a total capacity value.

The current (or at least I think it's current - from a few weeks ago) version doesn't let me set the odometer start value, AFAIK. I'd appreciate being able to do that.

Is there any way to make turning it on easier and quicker? I seem to need a very long press. The turn off long-press timeout seems longer than necessary too.

I much appreciate your work on this! Thank you!

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

Re: Bafang SW102 Bluetooth LCD - release 0.19.14

Post by geeksville » Sep 20 2019 4:26pm

UPDATE: This release might have a bug - don't install it ;-).

It has been a while since our last SW102 release (a few weeks). Mainly because the previous release seemed fairly bug free we could focus instead on unifying the 850C and SW102 codebases. That process is now complete and this new beta is built from that share source tree.

Image

New features:

* Note: this release (and all of the 0.19 display releases) is only for 0.19 motor firmware. Soonish we'll also support the 20 beta motor firmware.
* Press UP+DOWN for >1.5 seconds to go between the main screen, the info screen and the settings screen.
* On the settings screen you can press the POWER button to enter 'customizing mode' - in that mode you can go between fields and change what they are showing. Press the up button to select a new possible data source and the down button to go to the next field. When done customizing press the POWER button again.
* Lots of minor bug fixes
* (And as usual - we might have made new bugs - oops. If that happens _please_ log a bug on github). We read the forums but making a real bug makes it less likely we'll forget to fix what you found.

The initial install (mainly getting access to the programming pins) is a bit of a hassle but we've written [instructions](https://github.com/OpenSource-EBike-fir ... re-install) to make it easier. Every installation after that is very painless via our bluetooth bootloader software-update.

If you are upgrading from a previous release, you can upgrade over bluetooth. The procedure is:

* Install "nRF Toolbox" from your appstore of choice (Google Play or whatever)
* Download our [sw102-otauptdate-xxx.zip](https://github.com/OpenSource-EBike-fir ... D/releases) file onto your phone (do not unzip)
* Press and hold the M key on the SW102, then press and hold the power button. Keep both buttons pressed down for at least eight seconds. You can then release the buttons. You will know you are in the bootloader if the screen stays dark.
* Run the "nRF Toolbox" app and click on "DFU" (for device firmware upgrade)
* Select our zip file. If it also prompts you to ask what sort of "scope" choose "application only"
* Click on "select device"
* Click on "start upload"
* After the upload completes turn your bike completely off
* Then start your new SW102 load as normal (a long press on the power button)

Future releases will include release notes, but for now here's a link to our [TODO list](https://github.com/OpenSource-EBike-fir ... re/TODO.md). If you encounter bugs please open as issue [here](https://github.com/OpenSource-EBike-fir ... LCD/issues). Make sure you mention you were using a SW102 and include as much information as possible.
Last edited by geeksville on Sep 21 2019 7:11pm, edited 1 time in total.

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by geeksville » Sep 20 2019 10:01pm

I forgot to mention - this upgrade will discard your old eeprom settings. Sorry about that. All future versions should preserve settings.

isiorg   10 µW

10 µW
Posts: 5
Joined: May 25 2017 7:31pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by isiorg » Sep 21 2019 12:15pm

Max weel speed can set only to 24 km/h. 2 Times the display is frozen during switch to the menus (no watchdog timer?) only pull the Battery was working (no Key by me :evil: ).

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by geeksville » Sep 21 2019 12:55pm

ooh - interesting. I'll try to repro. Thanks for the report. NOTE to others: for the time being you might want to avoid this release.

ebentrider   1 mW

1 mW
Posts: 12
Joined: Aug 08 2018 10:31am

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by ebentrider » Sep 24 2019 2:14pm

Hi,

Thanks for your work to develop this OSF, very cool!

I am a relative novice at this stuff but managed to follow your instructions to flash the SW102 display and motor controller, with the OSF v11 and installed the temp sensor. It was all working well for a couple of days and I had some fun rides, using the SW102 v19.11 firmware. Yesterday I installed v19.14 to the display over bluetooth, and the main functions seemed to work on my ~1 hr 20 min ride home. I was getting temperature warnings for some of the ride, so not sure if I may have damaged the motor or controller, but it was working when I got home so hopefully still OK. With v19.14 I wasn't able to see the actual temp (just temp warning), so I wanted to go back to v19.11 to see more exactly how hot the motor was, and a few other features seemed more stable with the previous build.

When I tried to update the firmware over bluetooth I got an error and the upload failed. Is this intentional to prevent going backwards with versions, or does it mean there is a bug in this version preventing upload of new firmware over bluetooth? This morning I rode the bike and the motor is having issues, mostly not working but intermittently giving me some power. I don't know if I caused this issue when trying to update the firmware unsuccessfully, or if maybe things got too hot yesterday and fried something in the controller but just didn't manifest until today.

I would like to try flashing the v19.11 back on the display to see if that fixes the issue, but can't seem to get it to work over bluetooth with the same method that worked to get 19.14 on the display. Any thoughts on how to do this easily? I would like to avoid cutting the display open again to get at the SWD pins (that was a pain the first time), but that would be my next approach to start over if there isn't something easier to try.

Thanks for any advice, and thanks for developing this!

isiorg   10 µW

10 µW
Posts: 5
Joined: May 25 2017 7:31pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by isiorg » Sep 25 2019 4:08am

I have yesterday the same problems, but i found water inside the SW102. After open and drying the Display it works normaly. Firmware downgrade is also not possible by me.

ebentrider   1 mW

1 mW
Posts: 12
Joined: Aug 08 2018 10:31am

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by ebentrider » Sep 25 2019 3:42pm

thanks for confirming the firmware downgrade over bluetooth doesn't work. My motor may have other issues as I saw yesterday one of the bolts helping secure it to the frame came off at some point from all of the vibrations on rough roads. I don't think I had them tightened enough. anyway I need to troubleshoot whether my motor troubles are due to a problem with the motor/ controller/ torque sensor, or something got messed up when i tried to change the firmware (the latter seems less likely).

When I have time I will open the display back up and try to flash the earlier firmware using the SWD pins. If that doesn't help then I fear I may have fried something in the controller.

perryscope   100 W

100 W
Posts: 106
Joined: Jan 06 2019 4:29pm
Contact:

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by perryscope » Sep 26 2019 8:45am

ebentrider wrote:
Sep 25 2019 3:42pm
thanks for confirming the firmware downgrade over bluetooth doesn't work. My motor may have other issues as I saw yesterday one of the bolts helping secure it to the frame came off at some point from all of the vibrations on rough roads. I don't think I had them tightened enough. anyway I need to troubleshoot whether my motor troubles are due to a problem with the motor/ controller/ torque sensor, or something got messed up when i tried to change the firmware (the latter seems less likely).

When I have time I will open the display back up and try to flash the earlier firmware using the SWD pins. If that doesn't help then I fear I may have fried something in the controller.
Just to say I have four motors on four different bikes and all have loosened themselves but blue loctite on the lock ring and both M8 bolts makes a huge difference. Also add some old inner-tube under the vertical bracket plate helps protect the frame and reduce rattle.
Empowered people support rider and trustee
www.empoweredpeople.co.uk

ebentrider   1 mW

1 mW
Posts: 12
Joined: Aug 08 2018 10:31am

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by ebentrider » Sep 26 2019 11:16am

Thanks for the tips!

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

new 0.19.15 release!

Post by geeksville » Sep 29 2019 5:33pm

Hi ya'll,

The 0.16.14 release had 'problems' ;-). This one should do better. Note: we now use simultaneous pushes of UP+DOWN to go between screens (and fields on screens can be customized based on your preference) - similar to the other device. Please give feedback if you prefer this or using the M key. I'll probably change back to M in the next release because @casainho and I prefer it that way ;-).

New features:

* Fix wheelsize bug noticed by a kind forum user!
* Add a watchdog timer - if a serious sw fault occurs, the board will reboot. After rebooting it will work again, but you'll see a fault message blinking at the bottom of the display saying "Report bug!" If you ever see that message, please open a bug on github with as much information as you remember about what was happening when it occurred.
* (And as usual - we might have made new bugs - oops. If that happens _please_ log a bug on github). We read the forums but making a real bug makes it less likely we'll forget to fix what you found.

The initial install (mainly getting access to the programming pins) is a bit of a hassle but we've written [instructions](https://github.com/OpenSource-EBike-fir ... re-install) to make it easier. Every installation after that is very painless via our bluetooth bootloader software-update.

If you are upgrading from a previous release, you can upgrade over bluetooth. The procedure is:

* Install "nRF Toolbox" from your appstore of choice (Google Play or whatever)
* Download our [sw102-otauptdate-xxx.zip](https://github.com/OpenSource-EBike-fir ... D/releases) file onto your phone (do not unzip)
* Press and hold the M key on the SW102, then press and hold the power button. Keep both buttons pressed down for at least eight seconds. You can then release the buttons. You will know you are in the bootloader if the screen stays dark.
* Run the "nRF Toolbox" app and click on "DFU" (for device firmware upgrade)
* Select our zip file. If it also prompts you to ask what sort of "scope" choose "application only"
* Click on "select device"
* Click on "start upload"
* After the upload completes turn your bike completely off
* Then start your new SW102 load as normal (a long press on the power button)

Future releases will include release notes, but for now here's a link to our [TODO list](https://github.com/OpenSource-EBike-fir ... re/TODO.md). If you encounter bugs please open as issue [here](https://github.com/OpenSource-EBike-fir ... LCD/issues). Make sure you mention you were using a SW102 and include as much information as possible.

We look forward to your reports of great success (or failure, ahem) in this [thread](viewtopic.php?f=30&t=99698).

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by geeksville » Sep 29 2019 5:37pm

Sorry - I was offline a few days. ;-)

re: motor temp warnings
The reason warnings now occur is that previous releases (both on the SW102 and 850C) didn't have code to display warning messages. Now they do. The warning indicates that your motor temp is above the lower threshold you have set in the settings. Which is fine, but it will be throttling motor power a bit.

re: can't downgrade
It should definitely be possible to downgrade over bluetooth. The application load is 100% independent of our bootloader. Steps to ensure you are in the bootloader:
* Power down your bike
* Wait a few seconds
* Power on your bike
* Press and hold the M button
* Press and hold the power button (do not release the M button) for at least 8 seconds
* You should then see your SW102 listed inside the NRF toolbox as "SW DFU"
ebentrider wrote:
Sep 24 2019 2:14pm
Hi,

Thanks for your work to develop this OSF, very cool!

I am a relative novice at this stuff but managed to follow your instructions to flash the SW102 display and motor controller, with the OSF v11 and installed the temp sensor. It was all working well for a couple of days and I had some fun rides, using the SW102 v19.11 firmware. Yesterday I installed v19.14 to the display over bluetooth, and the main functions seemed to work on my ~1 hr 20 min ride home. I was getting temperature warnings for some of the ride, so not sure if I may have damaged the motor or controller, but it was working when I got home so hopefully still OK. With v19.14 I wasn't able to see the actual temp (just temp warning), so I wanted to go back to v19.11 to see more exactly how hot the motor was, and a few other features seemed more stable with the previous build.

When I tried to update the firmware over bluetooth I got an error and the upload failed. Is this intentional to prevent going backwards with versions, or does it mean there is a bug in this version preventing upload of new firmware over bluetooth? This morning I rode the bike and the motor is having issues, mostly not working but intermittently giving me some power. I don't know if I caused this issue when trying to update the firmware unsuccessfully, or if maybe things got too hot yesterday and fried something in the controller but just didn't manifest until today.

I would like to try flashing the v19.11 back on the display to see if that fixes the issue, but can't seem to get it to work over bluetooth with the same method that worked to get 19.14 on the display. Any thoughts on how to do this easily? I would like to avoid cutting the display open again to get at the SWD pins (that was a pain the first time), but that would be my next approach to start over if there isn't something easier to try.

Thanks for any advice, and thanks for developing this!

isiorg   10 µW

10 µW
Posts: 5
Joined: May 25 2017 7:31pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by isiorg » Sep 29 2019 7:02pm

Please use M Key!!! You use M also for edit Parameters, please use it also for leaving edit mode. Thanks!

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by geeksville » Sep 29 2019 7:29pm

isiorg wrote:
Sep 29 2019 7:02pm
Please use M Key!!! You use M also for edit Parameters, please use it also for leaving edit mode. Thanks!
ok - will do.

geeksville   10 W

10 W
Posts: 82
Joined: Aug 02 2019 6:44pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by geeksville » Sep 29 2019 7:35pm

ebentrider wrote:
Sep 26 2019 11:16am
Thanks for the tips!
ooh - I thought some more about the problem downgrading.

Yep: Our bootloader is set to only allow version numbers to increase, never decrease. We might fix it at some point - there are subtle reasons we might not want to. new github issue with details: https://github.com/OpenSource-EBike-fir ... r/issues/2

But for now you should be good by just upgrading to the 0.19.15 release I just made.

windburner   100 mW

100 mW
Posts: 48
Joined: Sep 24 2019 3:45pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by windburner » Sep 29 2019 7:55pm

geeksville wrote:
Sep 29 2019 7:35pm

Yep: Our bootloader is set to only allow version numbers to increase, never decrease.
I think that reversing a version is very important at the Alpha/Beta stages, as recently seen with the version that was eventually labeled 'bad'. I also vote for retaining/expanding the use of the "M" key!

Thanks for the work to provide this compact display. I didn't move to the OpenSource Firmware until the SW102 display was made available, as I don't have room for the larger displays.
TerraTrike Rover Tandem - TSDZ2 48V 750W - 13AH Batteries - VLCD6-->SW102/v0.6.8 OSF-->VLCD6

windburner   100 mW

100 mW
Posts: 48
Joined: Sep 24 2019 3:45pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by windburner » Sep 29 2019 10:40pm

windburner wrote:
Sep 29 2019 7:55pm

I think that reversing a version is very important ...
Looks like my "reversing a version via bluetooth" comment was very much appropriate, as I'll need to do a bit of soldering to revert to 0.19.11 for tomorrow morning's ride (or revert to the TSDZ2 factory firmware and to the VLCD6 display and wait for the next SW102 update).

The update via bluetooth from .11 to .15 went very easy. However, with 0.19.15, using UP+DOWN to go between screens, the sequence for my unit is, main screen, info screen, settings screen, to OFF!!! Just in case, I waited for some time (up to 180 seconds) to see if it would reboot and return with a fault code, but it remained off. In fact, I got to a black screen in many ways, without touching the power button.

The reason I need to revert is the fact that, no matter what I did, no setting changes were ever saved, thus, it can't be configured for my trike and ride profile, and the default settings will not work.

Also, I experimented with the ability to change the info screen configuration, which is a nice feature, and these too could not be saved.

Will attempt to report an issue, which could be a large report if I tried to report everything encountered.

On the positive side, I do see lots of promise with these changes.
TerraTrike Rover Tandem - TSDZ2 48V 750W - 13AH Batteries - VLCD6-->SW102/v0.6.8 OSF-->VLCD6

hex4def6   100 µW

100 µW
Posts: 8
Joined: Apr 14 2017 12:20pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by hex4def6 » Sep 30 2019 7:27pm

Hey,

Having trouble getting it to connect to my motor, it's just showing the following screen (see attachment).

Any ideas?
Attachments
IMG_20190930_171108.jpg
IMG_20190930_171108.jpg (394.64 KiB) Viewed 2443 times

hex4def6   100 µW

100 µW
Posts: 8
Joined: Apr 14 2017 12:20pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by hex4def6 » Sep 30 2019 8:23pm

head --> desk...

Guess I didn't realize this was for the TZD2 only, not the bafang motors.... Oops.

I take it there's no chance of reverting the FW?

Failing that, it looks like I may have to write my own version for the BBS02....

casainho   10 GW

10 GW
Posts: 4099
Joined: Feb 14 2011 2:43pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by casainho » Sep 30 2019 9:00pm

hex4def6 wrote:
Sep 30 2019 8:23pm
head --> desk...

Guess I didn't realize this was for the TZD2 only, not the bafang motors.... Oops.

I take it there's no chance of reverting the FW?

Failing that, it looks like I may have to write my own version for the BBS02....
You will have to write your own version for Bafang :-)
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

User avatar
doomy   100 µW

100 µW
Posts: 9
Joined: Feb 07 2018 11:39am

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by doomy » Oct 01 2019 1:43am

A version for BBSHD/BBS02 would be great!

BTW, i have the same problems with 0.19.15 (exiting the settings menu shuts down the display, some settings are not stored)

Someting else that comes to my mind, i used this tutorial to open the side of the SW102 instead of removing the buttons.
I glued it together with some silicone and i think it is better protected from moisture that way. There is no link to this method from the "how to flash page" maybe add this too..

https://github.com/OpenSource-EBike-fir ... -SWD-wires

casainho   10 GW

10 GW
Posts: 4099
Joined: Feb 14 2011 2:43pm

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Post by casainho » Oct 01 2019 2:13am

- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

Post Reply