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

So, Which PWM Technique is Best? (Part 4)

https://www.ecnmag.com/blog/2012/04/so-which-pwm-technique-best-part-4


So, which PWM technique is best? (Part 4)


Tue, 04/10/2012 - 3:27pm by Dave Wilson, Motion Products Evangelist, Texas Instruments

So, which PWM technique is best for your motor control application? Up to now we have investigated three different PWM techniques. Some could regenerate energy back into the DC power supply, and some couldn’t. But they all had one characteristic in common: unipolar voltage waveforms. In other words, for any given PWM period, the motor voltage waveform transitions between Vbus and ground or –Vbus and ground. In this blog, we will investigate the claims of the bipolar PWM technique. For every PWM period, the motor voltage waveform transitions between Vbus and –Vbus, creating a motor voltage waveform amplitude that is twice that of unipolar PWMs. To do this, we will wire the H-Bridge up as shown below.
Do you notice anything missing in the above diagram (besides the implied dead-time circuit between the top and bottom transistors)? How about the fact that there is no longer a forward/reverse signal. With bipolar PWMs, forward and reverse information is encoded in the PWM signal itself. Assuming no load, PWM values over 50 percent duty cycle cause forward motion, and values below 50 percent duty cycle result in reverse motion. For you mechanical engineers out there, this is the electrical equivalent to the hydrostatic continuously variable transmission (CVT). With such a system, you don’t have separate forward and reverse gears. You simply move the stick to control your speed and direction at the same time, with the middle position corresponding to zero speed.
images/47-1.pngSo, Which PWM Technique is Best? (part 4)- Image 1

The bipolar PWM technique is inherently a 4-quadrant technique. As long as the average applied motor voltage is of the same polarity as the motor’s back-EMF voltage, and it is greater in amplitude than the back-EMF, then the motor will operate in motoring mode. You can watch a simulation of quadrant 1 operation with bipolar PWMs by clicking here. However, if the average applied motor voltage is of the same polarity as the back-EMF, but its amplitude is less than the back-EMF, then the motor will operate in generating mode. You can watch a simulation of quadrant 4 operation of bipolar PWMs by clicking here.
Another advantage of the bipolar PWM technique is that it only requires one PWM signal from your processor (two if the dead-time is generated within the PWM module itself). Assuming that dead-time is provided externally by the FET gate drivers, this means that on a processor with six independent PWMs can drive up to six DC motors using bipolar PWMs!
But perhaps the biggest advantage of bipolar PWMs is the fact that motor current is always flowing through the single shunt resistor, regardless of which state the PWM signal is in. So now that we have continuous visibility to the motor current, the question becomes, “when should the current waveform be sampled?” While I intend to deal with current sampling in greater detail in a later blog, let me just touch briefly on it here. In most cases, you would like to acquire the average motor current as a function of time. But the problem is that the spot on the current waveform which corresponds to the average current value will occur at different times within the PWM cycle, depending on what the duty cycle is. So, we either have to use a timer to trigger the ADC at different times within the PWM waveform depending on the commanded duty cycle, or…
We could use center-aligned PWMs. In most cases, we choose to use center-aligned PWMs because of the harmonic interaction between two separate PWM signals. But in this case, we only have one PWM signal. So why does it help to use center-aligned PWMs? In this case it is how the center-aligned PWMs are created within the PWM module that provides a unique advantage when applied to bipolar PWMs. Referring to the figure below, center-aligned PWMs can be generated by using a triangular counter waveform, where the counter counts up to a maximum modulus value, and then turns around and counts back down to a minimum modulus value, and so on. As the modulation voltage is changed, the PWM pulse width is also changed in such a way that the carrier peaks and valleys occur right in the center of the low pulse width and the high pulse width respectively. If we ignore any delays due to dead-time, we see that the average value of current also occurs right when the carrier reaches a peak or valley! Pretty neat, huh? On the PWM module used on our C2000 processors, ADC triggers can be generated at the counter peaks and valleys, which can then be used to sample the current at the moment the current waveform equals its average value. In fact, with bipolar PWMs, you get two opportunities to sample the motor current within a PWM cycle, which allows you to run your digital current loop at twice the PWM frequency if desired.
images/47-2.pngSo, Which PWM Technique is Best? (part 4)- Image 2

Another problem that occurs when reconstructing the motor current waveform is that for very narrow pulse widths, the shunt signal only reflects the motor current for a very small period of time, and it may be too short to achieve a reliable reading. However, with bipolar PWMs, if the pulse width for one of the PWM states is too short, you can simply flip to the other PWM state, where the shunt signal will be correspondingly longer! So you are always guaranteed to have at least one interval within each PWM cycle (regardless of the duty-cycle value) where the shunt signal width is wide enough to easily facilitate an accurate reading of the motor current.
The bipolar PWM technique does however suffer from one noteworthy disadvantage: The motor voltage waveform contains more harmonic content than the unipolar PWM technique does. The graph below compares the normalized RMS content of unipolar and bipolar PWM voltage waveforms (minus the DC component), as a function of sweeping the PWM duty cycle from -1 to +1. Not only do these extra harmonics result in higher current ripple, but they also cause additional heating in the motor. That’s why the bipolar PWM technique is usually restricted to motors with high electrical time constants which can better filter out these harmonics. If the motor does not have a high electrical time constant, then the PWM frequency must often be increased to reduce the current ripple. However, this increases the switching losses in the H-Bridge, which places a limit on how high the PWM frequency can be increased.
images/47-3.pngSo, Which PWM Technique is Best? (part 4)- Image 3
However, even this disadvantage can be turned into an advantage over unipolar PWMs in some applications. Occasionally you need to slew the motor current very quickly (such as high frequency microstepping on stepper motors). In fact, some applications transition from unipolar PWMs to bipolar PWMs at specific points on the current waveform where you need to slew the current quickly.
A VisSim simulation which compares unipolar and bipolar PWMs on identical motors running with identical loads can be found here. I encourage you to play with this simulation, and see if you can empirically verify the above graph. In our next blog, we will explore one more unipolar PWM technique that can actually double the PWM frequency seen by the motor, while still switching your transistors at the regular PWM frequency. It also provides a springboard into understanding how standard 3-phase sinusoidal PWMs work. Until then...
Keep those motors spinning! :-)