Index

Motor controllers

  1. BMSBattery S series
    1. BMSBattery S06S
      1. S06ST (torque sensor version)
      2. S06S-BL (Bluetooth version)
      3. PWM signals
        1. very low speed - 6 steps
        2. low speed up to max speed - sineware
      4. Phase B current signal
      5. Throttle
    2. BMSBattery S06SC
    3. BMSBattery S12S
      1. Programming header
      2. PWM signal at max speed - sineware
      3. Phase B and motor total current signals
    4. BMSBattery bottle battery controller
    5. LCD control panel
      1. LCD protocol
    6. Kunteng mobile app
    7. Bluetooh
      1. DIY Bluetooth module
    8. How to open the controller and solder the programming header
    9. Hardware mods
  2. Other controllers
    1. BMSBattery S06P
      1. various info
        1. 01
        2. 02
    2. Kunteng 18 mosfets motor controller
    3. Lishui motor controllers
      1. LSW-675
        1. Datasheets
        2. PWM signals
    4. JinHui motor controllers
  3. GreenEBikeKit

Motors

  1. BMSBattery Q75
  2. BMSBattery Q85
  3. BMSBattery Q100
  4. BMSBattery Q100C
  5. Tongsheng TSDZx mid drive motors

Development tools

  1. Linux
    1. Step-by-step tutorial development tools
      1. Hardware tools to flash and debug the firmware
      2. Tools to build the firmware
        1. stm8-binutils-gdb
      3. Tools to flash the firmware
        1. How to erase and unlock protected read memory
      4. (optional) Tools to debug the firmware
      5. (optional) Tools to debug using serial port
      6. (optional) Tools to see diffs on the source code
  2. Windows
  3. C library
  4. Other tools
    1. Battery voltage boost step-up converter

Motor control

  1. Torque speed
  2. Motor control scheme of S06S controller
  3. BLDC 6 steps
  4. PWM schemes
    1. So, Which PWM Technique is Best? (Part 1)
    2. So, Which PWM Technique is Best? (Part 2)
    3. So, Which PWM Technique is Best? (Part 3)
    4. So, Which PWM Technique is Best? (Part 4)
    5. So, Which PWM Technique is Best? (Part 5)
    6. So, Which PWM Technique is Best? (Part 6)
    7. So, Which PWM Technique is Best? (Part 7)
  5. PWM control and Dead Time Insertion
  6. Low inductance motors
  7. Throttle Control Modes
  8. Phase angle FOC
  9. PWM frequency VS motor eRPM
    1. Max motor speed using FOC
    2. Kelly controllers ultra high speed
  10. Sinusoidal Control of BLDCM with Hall Sensors Based
  11. Self-Learn Hall Sensor Calibration Mode
  12. STM8S105 Alternatives
  13. PID algorithm - negative output values
  14. Regeneration
    1. Regen in SimonK firmware
  15. FOC
    1. Shane Colton documentation and firmware
      1. Firmware
      2. Part 1: Field-Oriented
      3. Part 2: Field-Oriented
      4. Sensorless Pneu Scooter - part 1
      5. Sensorless Pneu Scooter - part 2
      6. Sensorless Pneu Scooter - part 3
      7. Observer
        1. Sensorless - 2011.04.10
        2. Sensorless - 2011.07.05

Datasheets and application notes

  1. STM8S105C6T6
    1. Interrupts
  2. Endless-sphere.com forum messages
    1. 2017.04.25 - Initial forum message
    2. 2017.05.08 - First flash and debug on a dev board
    3. 2017.05.18 - First code flashing and running
    4. 2017.05.20 - more new information
    5. 2017.08.23 - SxxP versus SxxS versus LSW-675
    6. 2017.09.01 - Trying to figure out an algorithm to automatically adjust ui8_position_correction_value
    7. 2017.09.02 - How to do FOC on the BMSBattery S06S/Kunteng STM8 motor controllers
    8. 2017.09.03 - more ideas about zero crossing for FOC
    9. 2017.09.05 - measuring IQ current and manually adjusting position_correction_value
    10. 2017.09.15 - our OpenSource firmware efficiency compared to Lishui 12 FET FOC
    11. 2017.09.19 - measuring motor current
    12. 2017.10.23 - FOC and no FOC comparison
    13. 2018.01.10 - How to measure FOC_READ_ID_CURRENT_ANGLE_ADJUST
    14. 2018.02.20 - Reading motor phase current from the DC link current (shunt)

Torque sensors

  1. BMSBattery torque sensor

Various

  1. STM8S003 board
  2. 2017.12.01 - Regen ebrake like coast brakes
  3. BEMF

Clipping

  1. 2017.05.22 - Hackaday Links: May 21, 2017

Smart BMS with bluetooth

Throttle Control Modes


Forum message discussing Throttle Control Modes: https://endless-sphere.com/forums/viewtopic.php?f=30&t=78882

---
by Altair » Tue Mar 15, 2016 10:37 am
In this post, I want to have a look at the existing throttle modes and maybe examine the need for a different one.

RPM mode:
Everyone is familiar with the Speed mode where the position of the throttle controls directly the RPM of the motor. This is done internally by Pulse Width Modulating the signal going to the motor, effectively varying the voltage applied to the phases of the motor. The motor tries to follow the speed commanded by the throttle, within its torque limits, of course.
With this mode, the throttle feels more like a switch than a throttle because tries hard to match each new position of the throttle, resulting in constant small accelerations & decelerations.

TORQUE mode:
The common Torque mode that everyone prefers works by controlling the current going to the motor, rather than the voltage. It controls in fact the strength of the motor.
The throttle commands a certain torque, and then the resulting RPM is dependent of the load that the motor has to work against. If there is a very small load as when you're on flat ground with a tail wind, the bike will gain speed more and more even if the throttle is almost closed. This is sometimes not fun because you have to close completely the throttle from time to time to try to maintain a constant speed.
In the torque mode with the throttle just cracked open, the motor will end up reaching its maximum RPM if there is no load on the rear wheel.

POWER mode:
With all our (internal-combustion-engined) cars and motorcycles, it is very easy to maintain a chosen speed, easier that with our electronic controllers, and the reason is that in addition to being primarily torque-based, the throttle also controls the RPM of the engine when there is little load on the wheels. Like for example, with the transmission in neutral, the engine doesn't keep increasing its RPM until it reaches the max.
So the automotive throttle seems to be mostly a torque control, but at lower position, it integrates a form of RPM control. It facilitates the control of vehicle speed. This type of control feels the most natural to me, anyway.

Would it be worthwhile to try to integrate this form of control in our controllers?
It probably already exists, maybe in the Kelly controllers. From the comments I've read, the throttle mode used is not of the torque mode ("not a true torque mode but it feels good") but there is no details given in their specs.

---

by Alan B » Wed Mar 16, 2016 8:41 am
The standard Throttle to PWM mode that most controllers use is open-loop. Nice and simple. With a clamp to limit battery current and a calculated estimate of phase current. I call this PWM Throttle to differentiate it from a true Speed Mode.

Speed Mode is a bit different, as it is closed loop, like throttle adjusted cruise control. It is similar to PWM throttle, but even more annoying. Not sure who would want that mode. The Cycle Analyst has it, though I've not tested it.

The CA mode I've used is Battery Current mode. This is an improvement over PWM throttle, but at low speeds only a part of the throttle range is useful since current multiplication causes the motor current to hit the limit at a low throttle setting like 20%. Still it gives better control than the traditional PWM Throttle.

Power Control feedback throttle in the CA is almost the same as Battery Current, except they feed back on voltage times current. So it compensates for sagging pack voltage, as was mentioned above. Not a very different user experience unless your pack sags significantly.

Most of the sinewave controllers have torque throttle, which is easier for them since they need to measure motor current as part of the sinewave control algorithm. Sevcon, Sabvoton and the BAC series that Ebikes.ca is experimenting with are examples of these.

Some high end controllers have "torque plus speed" control. This would probably be close to an ICE throttle. I think Sevcon has this, but the programming is reportedly complicated. I haven't tried programming a Sevcon myself.

It is better to put these algorithms inside the controller, but the commodity controllers don't seem to be moving in that direction, so making an external adapter to achieve this is common, hence the CAv3 or Throttle Tamer, among others.

I have ridden the Zero motorcycles most of which which have a Sevcon based torque throttle, and I have a Sabvoton controller on the Borg which has a torque throttle in the controller, plus the various CA setups that I have used, plus the Bafang BBSHD has a torque throttle simulation in the controller that works fairly well. While I do see the "unloaded accelerate to max speed" when testing with the wheel off the ground characteristic of the torque throttles, in real conditions this is rarely noticed. Riding on ice or doing large jumps would be cases where it might be noticed. Possibly in extremely slippery mud. But generally it does not happen when there is any loading on the motor, and the control experience is greatly enhanced over the default PWM throttle control.

I've been looking at the motor control equations and it appears that a torque control adapter for PWM throttle controllers is possible without a motor current sensor. To do so requires incorporating the control parameters for the motor into the algorithm. I plan to test this out soon with a prototype for my AWD Novara Mountain Bike setup. If it works out perhaps we'll have something of general interest to report.

I've always been interested in the "torque plus speed" throttle mode, so will probably try that as well. It should take a very few lines of code to add that to a torque throttle.

---

by Alan B » Thu Mar 17, 2016 12:01 am
Hi Folks.

Thanks for the comments. Trying to explain it clarifies it, a good exercise to work through.

There is no perfect throttle curve. That's the wrong way to think about the system. It is a moving target.

RPM is needed to adjust the mapping dynamically. Think of it this way. There are two components of voltage in the motor. One is back EMF and the other is driving heat and making torque. Back EMF is related to RPM. So if you know the RPM you can calculate the back EMF component of the effective motor voltage.

Let's take the case of a stalled motor. Not turning. This makes zero back EMF. So we can ignore that for a minute and explore the torque production mechanism. Then we'll add the motion part back and deal with that.

If you know the resistance of the motor (and wires, etc), you can calculate the voltage required for any motor current (we ignore inductance here). Let's pick 100 milli ohms of resistance to make it easy. If we put 1V on this motor we'll get 10 amps. If we put 10 volts on this motor we'll get 100 amps (which we'll assume is our max motor phase current). So we have a nice torque throttle from 0 to 10 volts.

If the battery is say 50 volts, and we have a standard PWM controller we'll only get useful torque control from zero to 20 percent of throttle which makes the 10 volts (at zero speed). Then the controller should not allow the PWM to go above 10V since it is (we hope) correctly estimating or measuring motor current and 100 amps is our limit.

So we have a nice torque throttle at zero RPM, at least from 0 to 20% of throttle, and a mapping could be made to spread that out over the whole throttle, but of course the torque makes things move, and that mapping would not allow us to get to full speed. But, as long as we know the back EMF for the present RPM we can just add that to the voltage we need for the torque we want and make the PWM for that (which is the voltage we send to the controller's PWM throttle input). So the 10 volts of torque control range just moves up the voltage scale as the speed goes up. If the back EMF at some speed is 15 volts, we want to output PWM for 15 to 25 volts to the motor (at that speed) for the full throttle torque control range. If this is constantly updated as the speed changes it will simulate a torque throttle.

There are complications like resistance changing as the motor heats, and knowing the back EMF versus speed accurately enough and so on, but you get the idea. How well this works will have to be tested to see if these other details are significant enough to matter much, or if we can put them into the manager's equations and have it make those adjustments too.

Does this make sense? I know it is a bit confusing.

---

images/58-1.pngby Alan B » Thu Mar 17, 2016 12:34 am
Torque plus Speed is a bit different - it is a torque throttle that has a speed limit. So a 50% throttle setting would produce 50% torque but only up to 50% speed. So it is a way of controlling speed when the torque loading gets very low. Kind of like and ICE throttle.