-
Notifications
You must be signed in to change notification settings - Fork 387
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
msperl
wants to merge
11
commits into
sim-:master
Choose a base branch
from
msperl:simk-master-sleep
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
reduces code we need to maintain
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
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
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
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...
This already includes definitions for ADC value transformation
This will load a generated translation of ADC to a temperature value from flash into SRAM for later use by the ADC translation layer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Several patches that mean a big power reduction while the ESC is not running the motor:
Results:
Note that the implementation is using adc, which can also get extended to allow for continuous ADC capturing while the motor is running and does not produce glitches at high RPM!
Also regular ADC reading has been implemented allowing to capture a sequence of ADC values also when the motor is rotating. There is still the need for a consumer - i2c comes to mind...