Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

You are right, the exclamation mark. I remembered only the circle. Has someone the measures in cm of the lcd to have an idea of the dimensions?
About the level in the display, instead the number a bar of little squares, what do you think? There is more space with a histogram
 
Hello everyone,

I pushed some code to the 12.3.0 branch:

I finally implemented the eeprom storage emulation. This is based on the nrf5x Flash Storage library.
This was a bitch because it depends not only on SoftDevice but also needs some special initialization there. I missed that and all writes didn't work. That is the reason why eeprom_init() has to be called after ble_init().
Also, writing to flash memory do not work in debug sessions and this gave me some headache too :(

Some words about flash memory writes:
Flash Storage has no wear leveling. All variables always go to the same flash location. The documentation states that 20.000 write/erase cycles are guaranteed. If you calc with this and write f.i. some variables like TTM or SOC every minute, there is a chance of failure after ~300 hours of operation. I think the documentation is very conservative but write failures may be an issue.
There is also the Flash Data Storage library which has wear leveling. But due to much greater memory overhead we have to split the data going to flash into pure configuration (one data block written at a stretch) and just some data written more often (like TTM / SOC / ...).

Best regards
Niklas
 
Nick said:
Hello everyone,

I pushed some code to the 12.3.0 branch:

I finally implemented the eeprom storage emulation. This is based on the nrf5x Flash Storage library.
This was a bitch because it depends not only on SoftDevice but also needs some special initialization there. I missed that and all writes didn't work. That is the reason why eeprom_init() has to be called after ble_init().
Also, writing to flash memory do not work in debug sessions and this gave me some headache too :(

Some words about flash memory writes:
Flash Storage has no wear leveling. All variables always go to the same flash location. The documentation states that 20.000 write/erase cycles are guaranteed. If you calc with this and write f.i. some variables like TTM or SOC every minute, there is a chance of failure after ~300 hours of operation. I think the documentation is very conservative but write failures may be an issue.
There is also the Flash Data Storage library which has wear leveling. But due to much greater memory overhead we have to split the data going to flash into pure configuration (one data block written at a stretch) and just some data written more often (like TTM / SOC / ...).

Best regards
Niklas
Great!!!!!!

On LCD3 and 850C I write only after quiting configurations menu and when power off the LCD. I think this should be pretty safe for that max number of write cycles.

How is flash memory size going? How much percentage of the memory for user app is available now?
 
Flash usage is no concern right now. We have 127 kb for application data (rest used by bootloader and SoftDevice). Eeprom emulation reserves 1 kb flash.
The basic implementation (some fonts/GFX already included) compiles around 20 kb of flash. So with some reserve we have another 80-100k for our application.
 
EggRider also writes ttm, traveled distance and all this kind of values only when you power down display after ride. If don't remember doing that (like power down battery first) i loose all previous trip data's etc.
 
Nick said:
Flash usage is no concern right now. We have 127 kb for application data (rest used by bootloader and SoftDevice). Eeprom emulation reserves 1 kb flash.
The basic implementation (some fonts/GFX already included) compiles around 20 kb of flash. So with some reserve we have another 80-100k for our application.
Thanks!! I was afraid we would have very small flash available.
 
More ideas to improve our ebikes with TSDZ2 and SW102:

casainho said:
jbalat said:
For off road mountain biking it is so good I never have to change modes. It will help me when I go up steep hills and back off when I am just cruising. It seems to work out how much assist to give by what speed and how much pressure you exert but it is quick to give you full power when you need it so you dont get stuck half way up a hill.
So you mention steep hills. Before, someone did mention using an accelerometer and inclinometer to detect the start of hills and so increase automatically the motor power assistance.

All data variables like wheel speed, motor current, etc are sent to LCD. The SW102 Bluetooth LCD can also receive information from a mobile phone and I hope from other devices, like a standalone Arduino with an accelerometer and inclinometer. SW102 would then be able to change motor power assistance when detecting start of hills and also use acceleration value for maybe as input to that algorithm to improve it.

To add input to TSDZ2 of accelerometer and inclinometer without having to solder wires to the motor controller board, I think SW102 LCD will be the easiest path to do it for the final user.
 
I did agree with Nick for me to implement the configurations menu. This is the next logic step because we need to keep stored the options variables and let user change them. Finally, main menu should be implemented and then we need to make a first stable version, even of that does not implement yet all options like LCD3 has.

The configurations menu, I will try to port/adapt the one from 850C that works well.
 
Getting really curious about the SW102... First time I am reading around in this thread. Have actually a lot of questions but will not bother any developer. Just keep up the good work. I really hope there will be enough space to implement everything, including future development. Would be great!
 
buba said:
Getting really curious about the SW102... First time I am reading around in this thread. Have actually a lot of questions but will not bother any developer. Just keep up the good work. I really hope there will be enough space to implement everything, including future development. Would be great!
I was also afraid but Nick told this recently:

Nick said:
Flash usage is no concern right now. We have 127 kb for application data (rest used by bootloader and SoftDevice). Eeprom emulation reserves 1 kb flash.
The basic implementation (some fonts/GFX already included) compiles around 20 kb of flash. So with some reserve we have another 80-100k for our application.
 
Hi guys,
This thread has been silent lately,
just curious if there is any progres?

Just received my display from pswpower and
I knew it was small, but didn't know it was So tiny! :thumb:
Will have a nice stealthy look!
 
Tsdz2Canyon said:
Hi guys,
This thread has been silent lately,
just curious if there is any progres?

Just received my display from pswpower and
I knew it was small, but didn't know it was So tiny! :thumb:
Will have a nice stealthy look!
I did plan to work on this but meanwhile I decided to focus on 850C display and I was able to realease the very first version.

When I gave time I want to port the configurations menu from the 850C to this one.

I think there is an user developing right now the main screen based in the latest design file.
 
casainho said:
I did plan to work on this but meanwhile I decided to focus on 850C display and I was able to realease the very first version.

When I gave time I want to port the configurations menu from the 850C to this one.

I think there is an user developing right now the main screen based in the latest design file.

Nice to hear it`s not forgotten :thumb:

I was thinking about going the 850c way, but thought sw102 is better in size.

For now I will stay with the vlcd5 and marcoq sw and wait for this one.

Thank You for the great work!
 
I will find some time again from August on. I am also interested to bring this project foward!

Cheers
Niklas
 
Nick said:
I will find some time again from August on. I am also interested to bring this project foward!
Great!! I was not very happy with 850C LCD at daylight but I found it was an issue mine so my focus is now on 850C (again).

I hope you can reuse my ideas on 850C.
I just used structs for the first time to save data in eeprom but I guess the Nordic library for file system you are using is very complete anyway.

On 850C, that scheme to have layers of data that are accessed on UART interrupt, 100ms interrupt and LCD main loop, is working very well!

The graph is very nice, I am curious to try a graph on SW102 (sure it is not a priority).
 
shaddi said:
Is there still no way of flashing the device without opening it?

Alas - I think you'll have to crack it open once (I'm assuming the stock bootloader only loads images signed by the mfg? true casainho?). But after that point, future updates of this firmware should be installable via bluetooth.

The good news is that an alpha release is getting close!
 
Does it seem like you'll always have to physically open it for the first flash?

I've cracked the LCD on my KT-LCD3, and I'm trying to decide whether to buy another, or an SW102 (a form-factor I would prefer), or both. From the noises here, something that works isn't far off (it'll take a couple of weeks at least before I get anything)? I don't care about fancy features, but I will want to be able to change settings.

How weather resistant can the SW102 be after you crack it open?
 
I've been working on the sw102 stuff with Casainho and Nick/Lowperformer and I think it will be ready for alpha users soon (within two weeks? Maybe one?). I have one running my my desk now and I'm switching my bike from a LCD3 to SW102 tomorrow.
 
Sounds promising - I'll order one for sure, and may just limp along with my cracked LCD3 until it's usable. I can see the battery voltage and assist level, so the bike is usable.
 
First thx @ all devs for the amazing work.
At the moment i use the standard vcd5 display (with marcoq's fork). But from time to time i have unexpected behavior, so that i like to see more information on the display (eg the temperature). And i like to change the configuartion on the fly and not only with my laptop.

So since months i think about which display i like to buy. Because the lcd3 and 850c is for me a little bit to big, i tend to the sw102.
Now my question: can i use with the sw102 a (magnetic) brake sensor?
 
bingo5 said:
First thx @ all devs for the amazing work.
At the moment i use the standard vcd5 display (with marcoq's fork). But from time to time i have unexpected behavior, so that i like to see more information on the display (eg the temperature). And i like to change the configuartion on the fly and not only with my laptop.

So since months i think about which display i like to buy. Because the lcd3 and 850c is for me a little bit to big, i tend to the sw102.
Now my question: can i use with the sw102 a (magnetic) brake sensor?
Sure, the brake sensors are a totally different thing from the display.
 
Oh okay thx, but then how is the brake sensor connected? Because the vlcd5 has extra ports for the brake sensor.
 
bingo5 said:
Oh okay thx, but then how is the brake sensor connected? Because the vlcd5 has extra ports for the brake sensor.
SW102 or 850C displays are connected just like the KT-LCD3, so see on the wiki how the brake sensors are connected.
 
Back
Top