OSEC Open Source E-Bike Controller in a Windows toolchain for a STM8
Clone or download
Pull request Compare This branch is 320 commits ahead, 236 commits behind OpenSource-EBike-firmware:master.
Permalink
Failed to load latest commit information.
.settings Disabled option "Build before run" Aug 30, 2017
StdPeriphLib Lowered the PWM frequency to 8kHz. The current control should be done… Jun 8, 2017
documentation motor hall phase comparison sheet Oct 14, 2018
experimental settings just some experimental settings Nov 1, 2018
nbproject just some experimental settings Nov 1, 2018
proven settings better settings selector Oct 29, 2018
test new flags / eeprom reset option Sep 18, 2018
tools updated link buttons Oct 29, 2018
.cproject tutorial added, several bugs fixed Aug 22, 2017
.gitignore java tool reloads last config, list only contains filename Sep 4, 2018
.project tutorial added, several bugs fixed Aug 22, 2017
ACAcommons.c refactoring and ne experimental settings (pwm/motor constant, dc off) Oct 20, 2018
ACAcommons.h refactoring and ne experimental settings (pwm/motor constant, dc off) Oct 20, 2018
ACAcontrollerState.c redefined motor & correction angle Oct 24, 2018
ACAcontrollerState.h controllstate now 16 bit, had to change packet codes, needs recent ap… Oct 21, 2018
ACAeeprom.c new flags / eeprom reset option Sep 18, 2018
ACAeeprom.h refactoring and ne experimental settings (pwm/motor constant, dc off) Oct 20, 2018
ACAsetPoint.c controllstate now 16 bit, had to change packet codes, needs recent ap… Oct 21, 2018
ACAsetPoint.h beta do not use this commit Sep 27, 2018
BOdisplay.c bugfix & trying to make build process actually work Oct 21, 2018
BOdisplay.h controllstate now 16 bit, had to change packet codes, needs recent ap… Oct 21, 2018
Flash_Debug-STM8.launch For testing sending data over UART, to read realtime angle and send c… Aug 9, 2017
Makefile_linux added regen assist level Sep 15, 2018
Makefile_windows @ in makefile != @ in batch file! Oct 21, 2018
OSEC Parameter Configurator.jar updated link buttons Oct 29, 2018
OSEC State Translator.jar Added Tool for State translation Oct 23, 2018
OpenOCD-v0.10.launch WIP May 19, 2017
PAS.c refactoring part 2 Sep 8, 2018
PAS.h first draft, not tested in hardware yet Aug 18, 2017
README.md Update README.md Oct 14, 2018
SPEED.c refactoring part 2 Sep 8, 2018
SPEED.h first draft, not tested in hardware yet Aug 18, 2017
Start_Compiling.bat .. Oct 21, 2018
Tutorial for setting up the toolchain in windows environment.pdf Cheat for unlimit speed added Oct 28, 2017
WriteOptionBytes.bat merged bt log branch and slightly improved java tool Aug 27, 2018
adc.c new settings, new current cal Sep 16, 2018
adc.h new settings, new current cal Sep 16, 2018
brake.c Bugfix for option display "none" Dec 18, 2017
brake.h WIP for structure code in several source files. Now the brake.c works Jul 29, 2017
config.h just some experimental settings Nov 1, 2018
cruise_control.c For testing sending data over UART, to read realtime angle and send c… Aug 9, 2017
cruise_control.h WIP for structure code in several source files. Now the brake.c works Jul 29, 2017
display.c reworked config sync request, new app version needed Oct 15, 2018
display.h new uart for all displays except KINGMETER_901U which was already bro… Sep 27, 2018
display_kingmeter.c cal_a changed 1->10! Oct 7, 2018
display_kingmeter.h new uart for all displays except KINGMETER_901U which was already bro… Sep 27, 2018
factory_defaults.bin WIP May 19, 2017
gpio.c first draft, not tested in hardware yet Aug 18, 2017
gpio.h removed old motor ifndefs Oct 17, 2018
interrupts.h UART management by interrupt, further bugfixes Oct 8, 2017
libiconv2.dll first draft, not tested in hardware yet Aug 18, 2017
libintl3.dll first draft, not tested in hardware yet Aug 18, 2017
main.c controllstate now 16 bit, had to change packet codes, needs recent ap… Oct 21, 2018
main.h removed old motor ifndefs Oct 17, 2018
make.exe first draft, not tested in hardware yet Aug 18, 2017
motor.c redefined motor & correction angle Oct 24, 2018
motor.h variable renaming Oct 11, 2018
optionbytes.hex Java Tool updated Aug 25, 2017
pwm.c redefined motor & correction angle Oct 24, 2018
pwm.h Updated to best settings known actually Sep 17, 2017
timers.c UART management by interrupt, further bugfixes Oct 8, 2017
timers.h UART management by interrupt, further bugfixes Oct 8, 2017
uart.c new uart for all displays except KINGMETER_901U which was already bro… Sep 27, 2018
uart.h async uart Sep 26, 2018

README.md

Important

Caution! this is not a professional project. Anything you do with this firmware is at your own risk. In any case, use a quick fuse in the power supply to minimize the risk of destroying the controller, battery or motor!

Please make sure you read and understood the project documentation here: https://opensourceebikefirmware.bitbucket.io/

Preface

Many thanks to the team of the Forumscontroller, Main functions are from there!

After the main developer casainho decided to stop his activies in this project, the fork of stancecoke will be maintained as the main path. Of course the origin projcect of casainho can still be found: origin fork, not longer maintained.

About the project

This firmware replaces the closed source one on Kunteng sine wave controllers. It enables you to change basically anything about the way the controller reacts to inputs (throttle, PAS, torque sensor, brake, displays) and handles different modes/states concerning power output. A graphical tool is available, which allows the use of the firmware even for less experienced Windows users without programming knowledge. With the BluOsec android app you can control the assist level and set many paramters at runtime. BluOSEC App is now here.

But if you want something added / changed that isn't already implemented / beta / buggy, you have to get involved yourself. This is a hobbyists project and there is no one else to blame than yourself if something isn't working as desired ;-)

What works:

Sine wave control with simplified FOC
motor stopp while braking
Emergency stop if current consumption is too high (not tested)
Driving modes:

  • Throttle
  • Throttle + PAS
  • torque sensor
  • torque simulation
  • Recuperation via analog "thumb brake" signal or by digitally by brake switch
  • Kingmeter J-LCD and Forerider App
  • Kunteng LCD3 / LCD5
  • Reverse step detection PAS
  • Start-up support in torque sensor mode
  • Pushing aid

What doesn't work:

  • Block commutation during start-up

For further reading

The documentation on the project can be found here

The corresponding thread in the german Pedelecforum can be found here

Want to help?

There is always things to improve, don't hesitate to get involved if you have improvements in mind.