Saturday, June 20, 2026

STM32 Development Log 5: Current consumption

When running the  Switches_LED_Demo program,]

Current consumption increase by 100mA when SW3 is pressed. 

  1. When only heart beat LED is running, 0.179 Ampere @12V
  2. SW1:With LD5 on 0.187 Ampere = 8 mA increase over case 1
  3. SW2:With LD4 on 0.195 Ampere = 8 mA increase over case 2
  4. SW3:With LD3 on 0.305 Ampere =  110 mA increase over case 3 Why? SW3 switches PI14 and PI15. PI14 is LD3. PI15 is J3 connector, pin 38, switching relay  1. However this cannot add 100mA to the current consumption. 
 

After disable PI15 relay output in software, the current consumption is correct:

  • When only green heart beat LED is running, 0.175 Ampere @12V
  • SW1:With LD5 red on 0.184 Ampere = 9 mA increase over case 1
  • SW2:With LD4 red on 0.192 Ampere = 8 mA increase over case 2
  • SW3:With LD3 red on 0.193 Ampere = 1 mA increase over case 3 
  • SW4:With LD2 green on 0.195 Ampere = 2 mA increase over case 4
  • SW5:With LD1 green on 0.197 Ampere = 2 mA increase over case 5
  • SW6:With SW_LED green on 0.198 Ampere = 2 mA increase over case 6, in the control module.
  • if(button3 == 1)

    {

    if(button3_state == 0)

    {

    HAL_GPIO_WritePin(GPIOI, GPIO_PIN_14, GPIO_PIN_SET);

    button3_state = 1;

    // PI 15 is relay 1

    // This code is for testing only

    // HAL_GPIO_WritePin(GPIOI, GPIO_PIN_15, GPIO_PIN_SET);

    }

    else

    {

    HAL_GPIO_WritePin(GPIOI, GPIO_PIN_14, GPIO_PIN_RESET);

    button3_state = 0;

    // PI 15 is relay 1

    // This code is for testing only

    // HAL_GPIO_WritePin(GPIOI, GPIO_PIN_15, GPIO_PIN_RESET);


    }

    button3 = 0 ;


    }


     

    Comments

    1. LD2 , triggered by SW4, PA0 , needs long press for the LED to switch states, it is not interrupt driven, it is polled.
    2.  LD1, triggered by SW5, increases current consumption by only 3mA
    3. SW_LD10, triggered by SW6,  increases current consumption by only 4mA, SW_LD10 is physically located on the compute module, not on the base board.

    No comments:

    Post a Comment