Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

several patches that mean a dramatic power reduction while in idle/armed + neutral #102

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Commits on Oct 31, 2015

  1. implemented idle sleep

    Measurements [email protected]:
    * sleep = 0
      * 48.3mA no PWM/PWM (no PWM generator)
      * 56.4mA PWM neutral armed (including PWM-generator)
      * 1761 Words
    * sleep = 1
      * 38.8mA no PWM (no PWM generator)
      * 46.7mA PWM neutral armed (including PWM-generator)
      * 1776 Words
    * reduction of 9.5-9.7mA
    * change
      * -9.5mA no PWM (no PWM generator)
      * -9.7mA PWM neutral armed (including PWM-generator)
      * +16 Words
    
    Measurements [email protected]:
    * sleep = 0
      * 44.9mA no PWM/PWM (no PWM generator)
      * 60.6mA PWM neutral armed (including PWM-generator)
      * 2086 Words
    * sleep = 1
      * 37.8mA no PWM (no PWM generator)
      * 54.3mA PWM neutral armed (including PWM-generator)
      * 2101 Words
    * change
      * -7.1mA no PWM (no PWM generator)
      * -6.3mA PWM neutral armed (including PWM-generator)
      * +16 Words
    msperl committed Oct 31, 2015
    Configuration menu
    Copy the full SHA
    6a0482a View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2015

  1. use common macros to set INT0 edge

    reduces code we need to maintain
    msperl committed Nov 2, 2015
    Configuration menu
    Copy the full SHA
    0619f3e View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2015

  1. suport deeper sleep mode using ADC

    Allow the use of USE_SLEEP=2 to mean we run with ADC-sleep when idle
    
    As the timer does not work in adc-sleep, we use the extended
    ADC conversion to simulate the 4096us overflow interrupt of T1.
    
    Measurements [email protected]:
    * SLEEP = 0
      * 48.9mA idle - no PWM
      * 47.3mA armed - with neutral PWM
      * 1773 Words
    * SLEEP = 1
      * 38.8mA idle - no PWM
      * 38.8mA armed - with neutral PWM
      * 1789 Words
    * SLEEP = 2
      * 33.7mA idle - no PWM - requires PWM pulldown!!!
      * 38.8mA armed - with neutral PWM
      * 1839 Words
    
    Measurements [email protected]:
    * SLEEP = 0
      * 45.2mA idle - no PWM
      * 53.5mA armed - with neutral PWM
      * 2094 Words
    * SLEEP = 1
      * 38.4mA idle - no PWM
      * 46.9mA armed - with neutral PWM
      * 2110 Words
    * SLEEP = 2
      * 35.6mA idle - no PWM - requires PWM pulldown!!!
      * 46.9mA armed - with neutral PWM
      * 2170 Words
    msperl committed Nov 3, 2015
    Configuration menu
    Copy the full SHA
    2cb669c View commit details
    Browse the repository at this point in the history
  2. added USE_LED_PWM to reduce power consumption of green led when armed

    When armed and in neutral my afro-esc consumes (with USE_SLEEP=2):
    * USE_LED_PWM = 0 - 47.4mA
    * USE_LED_PWM = 1 - 43.1mA
    * USE_LED_PWM = 2 - 40.9mA (flashes already)
    * USE_LED_PWM = 3 - 39.9mA
    * USE_LED_PWM = 4 - 39.3mA
    * USE_LED_PWM = 5 - 39.1mA
    * USE_LED_PWM = 6 - 38.1mA
    
    so there is some power that can get saved by implementing that
    msperl committed Nov 3, 2015
    Configuration menu
    Copy the full SHA
    98aaf94 View commit details
    Browse the repository at this point in the history
  3. implement low power FET mode while idle/armed but neutral

    This sets up the FET in such a mode that we save on power consumption
    
    Example config for afro_nfet:
    .equ	USE_SLEEP	= 2
    .equ	USE_LED_PWM	= 3
    ;*****************************************
    ; ENABLE_LOW_POWER_FET_MODE during sleep *
    ;*****************************************
    .equ USE_FET_SET_LOW_POWER = 1
    .MACRO FET_SET_LOW_POWER
    	cbi AnFET_port,AnFET
    	cbi BnFET_port,BnFET
    	cbi CnFET_port,CnFET
    	cbi ApFET_port,ApFET
    	cbi BpFET_port,BpFET
    	cbi CpFET_port,CpFET
    .ENDMACRO
    
    .equ USE_FET_RESET_LOW_POWER = 1
    	.MACRO FET_RESET_LOW_POWER
    	cbi AnFET_port,AnFET
    	cbi BnFET_port,BnFET
    	cbi CnFET_port,CnFET
    	sbi ApFET_port,ApFET
    	sbi BpFET_port,BpFET
    	sbi CpFET_port,CpFET
    .ENDMACRO
    
    This results in:
    * stock (1e4c017):
      * 45.2mA idle - no PWM
      * 53.5mA armed - with neutral PWM
      * 2094 Words
    * USE_SLEEP=2 and USE_LED_PWM=3:
      * 35.6mA idle - no PWM
      * 39.8mA armed - with neutral PWM
      * 2177 Words
    * USE_FET_* = 1 + all sleep and led optimizations
      * 19.9mA idle - no PWM
      * 23.5mA armed - with neutral PWM
      * 2198 Words
    msperl committed Nov 3, 2015
    Configuration menu
    Copy the full SHA
    7232f76 View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2015

  1. sample ADC channels on a regular basis and oversample the result

    This implements 256 x ADC oversampling with 2 bit decimation
    to result in a result value range of [0:65472]
    
    There is also some scaling offset calculation that can get applied
    to the gathered values.
    
    when USE_ADC = 1 is set then we look for defined:
    * mux_temperature
    * mux_voltage
    * mux_current
    and calculate the mask of adc channels to use.
    Alternatively USE_ADC_MASK can be set to a bitmask of the ADC channels
    to capture - note that there are no Channels 8 - 13, so if any of these
    bits are set the build will fail .
    
    For example with afro_nfet on can define:
    .equ	USE_ADC = 1
    .equ	mux_voltage_mul	= (5*256*(18000+3300)/3300)
    to get the voltage scaled correctly to: Vbat*256
    
    Note that typically an oversample of a channel takes:
    0.1037s for a motor running at aprox 1400 commutation cycles/s
    0.0282s for an unarmed ESC
    
    note that when armed the sample rate may go as low as 1 second -
    especially when braking or accelerating.
    Also there is no sampling happening while the ESC is "beeping"!
    
    Last thing missing is exporting those numbers via I2C...
    msperl committed Nov 4, 2015
    Configuration menu
    Copy the full SHA
    5cde152 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2015

  1. Configuration menu
    Copy the full SHA
    dad05d4 View commit details
    Browse the repository at this point in the history
  2. afro_nfet enable lowest power mode and adc reading by default

    This already includes definitions for ADC value transformation
    msperl committed Nov 10, 2015
    Configuration menu
    Copy the full SHA
    0361ca7 View commit details
    Browse the repository at this point in the history
  3. added ntc translation table when mux_temperature* are defined

    This will load a generated translation of ADC to a temperature value
    from flash into SRAM for later use by the ADC translation layer
    msperl committed Nov 10, 2015
    Configuration menu
    Copy the full SHA
    bdc7ff5 View commit details
    Browse the repository at this point in the history
  4. fixed spacing issues

    msperl committed Nov 10, 2015
    Configuration menu
    Copy the full SHA
    3eed220 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2015

  1. Configuration menu
    Copy the full SHA
    725cda7 View commit details
    Browse the repository at this point in the history