Yes sir! It works now!
I've to buy the controller now How long does it take the controller to arrive from bmsbattery.com?

Good you could build the firmware -- and I just tested and added battery voltage max protection while regen.

For me that I am in Portugal, after the ship, takes about 2 weeks for the package arrive in UK and after another 1 week from UK to Portugal. You may ask why they send first to UK, that way It will not stop in Portugal customs for more 2 or 3 weeks and I don't pay taxes.

I can ask them to ship very fast like by DHL, it may just take 1 week but I will have to pay a lot on customs as also extra fees for DHL work on customs, etc....

What I do is asking for the cheaper even if slower shipment, buy extra hardware, like some units of controllers, LCDs, etc so I can play with them and repair if something burn during the development

stancecoke, I added to the master the battery max voltage protection while regen and it works as expected. Now we can use again a lab power supply for development but it will simple not brake. (I don't remember if you added already this feature to your fork).

Can you please share with us some information, so we can understand better your needs:
1. can you please tell us why are you interested to use the firmware?
2. what bicycle type do you have, what is the kind of usage?
3. which motor, battery pack voltage?
4. do you use throttle, PAS, torque sensor, regen brakes?

If you can give more details of what you are looking for, we can think of it and maybe try to develop for a generic motor controller as also keep developing for EBike application. It is much simple to develop if we know the real needs of the application.

My Q11 is now working very well - I had corrected a bug on the motor code.
Then I moved to S12S controller and my EBike 48V - with this, the Q11 motor runs at 42 km/h. Then I configured regen current to 25A and recorded the following video -- regen very strong and fast!! -- not mechanical braking were used:

I did some ride tests and is really great and strong the ebrake (although I used for riding, 15A for regen). I was using the torque sensor and configured regen current = 0 so I can coast my legs/pedals when I want a rest but as soon I use brakes, regen current is configure to 15A and I get the strong ebrake/regen. When I release brakes, I get regen current again = 0 and I can pedal and stop pedaling and rest my legs when I want.

Next, I want to use my torque sensor + PAS that I added:

and I will use both signals to detect when I stop rotating the pedals and move them backwards, and count how many PAS signal changes/steps I moved and apply a regen current that will scale with the number of backwards PAS steps. The torque sensor have 12 magnets equally spaced that give 24 PAS signal changes/steps per crank revolution and this should be a nice resolution to be able to ebrake nicely and smooth

For got to say that I found I were using one LCD5 from were I was not receiving any data and I went o look and found it has a different CRC ^ ? than the other LCD5 and I was able to get it working, right now the current code is:

I just implemented and did some rides with the regen ebrake like coast brakes

How does it wok?
- ebike rider can pedal forward as usual or stop pedaling for rest
- when ebike rider want to ebrake for reducing speed (without using mechanical brakes), needs to rotate backwards the pedals
- one full rotation of the pedals equals to 24 points and I implemented in a way that 5 point of backwards rotation gives the full ebrake power, while 1 point gives 1/5 of the full ebrake power and so on

The implementation needs in fact 6 points, and the first one is a neutral point that is needed to detect pedal rotating backward. This point also works well as a hysteresis.

I did some rides and on the video, I did ebrake so strong that I almost did fall...

I think that its not a good way of applying regen for most users. Try variable regen with something like this http://s.aliexpress.com/FnQJ7f6F if the controller cant see analog voltage input, then this module will convert output voltage of brake lever (hall thumb throttle as brake) to pwm.

I think that its not a good way of applying regen for most users. Try variable regen with something like this http://s.aliexpress.com/FnQJ7f6F if the controller cant see analog voltage input, then this module will convert output voltage of brake lever (hall thumb throttle as brake) to pwm.

What about the torque controll throttle? Is it implemented?

Yes, maybe not for everyone. For ones like me, that live on flat lands and have some background on fixed bikes, this is nice. Or maybe the ones that are used to coast brakes.

The controller have at least 2 analog inputs: throttle and torque sensor.

I've been following this project for a dew days now and I must say that I'm impressed. You guys are doing a great job!

The idea of doing regen when pedaling backwards is great. Add a bit of a delay until the regen sets in you you have a great solution that doesn't need additional hardware.

I have a question of my own. I am planning on running a S12SN (possibly even the 72V variant) with this firmware. Since it was only tested on the S6 and S12S, I am wondering if it can work. I can tweak and play around some (Linux dev environment is available), but I am no match for your programming skills. So do you think it might be possible and worth a try?

I've been following this project for a dew days now and I must say that I'm impressed. You guys are doing a great job!

The idea of doing regen when pedaling backwards is great. Add a bit of a delay until the regen sets in you you have a great solution that doesn't need additional hardware.

I have a question of my own. I am planning on running a S12SN (possibly even the 72V variant) with this firmware. Since it was only tested on the S6 and S12S, I am wondering if it can work. I can tweak and play around some (Linux dev environment is available), but I am no match for your programming skills. So do you think it might be possible and worth a try?

Thanks for the feedback.

On the current implementation, there is a distance (1/24 steps) after the direction inversion (and this can be increased) that is a null. The result is very good, at least for me

So, I own a S12S (S12P moded to S12S) and I it works very well with current firmware. The 72V version I don't know which changes are between the 48V and 72V versions, but I would say only the voltage resistor that reads the battery voltage (not counting with changes on capacitors, etc to handle the higher voltage). That difference I think you will be able to find using a multimeter.

I think someone will want to use the most powerful version of this controllers, and would be great to get knowledge on how to use them. I think Kunteng sells even an higher current version than BMSBattery sells. But go with BMSBattery if you can, because no BMSBattery versions may have some significant changes in hardware, mainly on the available cables/inputs to the microcontroller.

I also have been watching this thread with great interest and would like to add my congratulations to you guys on your efforts so far. Will definitely be trying your firmware sometime in the future, I'm no coder but can usually follow instructions to get these things loaded up and working.

Just a small question for casainho regarding the S12P to S12S mod you describe in the link. When this mod is done is the controller still run sensorless or do you add the three hall wires and run it sensored? I ask this as I have a S09P sensorless controller (ordered in error) that I would like to mod to S09S sinewave/sensored operation - is that possible? - unfortunately I have found that my Q128H does not run well in sensorless mode.