Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4

HeGi_2497906
Level 5
100 replies posted 50 replies posted 25 replies posted
Level 5

We are implementing the module on a battery operated sensor, and in the DS it references the low voltage detect, but I cannot seem to locate any further details in the DS other than these entries:

page2

Programmable low voltage detect (LVD) from 1.8 V to 3.6 V

page 26 table 46 LVD monitor DC specifications

Is there really a voltage monitor block I can turn on, check the comparison and then turn off?

0 Likes
1 Solution
HeGi_2497906
Level 5
100 replies posted 50 replies posted 25 replies posted
Level 5

Ganseh, thank you for you support,

We are running directly off the battery, this function works great, I am not sure why this is not a Widget, LVD, I actually can step through a series of sets and determine the actual battery voltage.

/*******************************************************************************

* Function Name: LowBattery_ISR()

********************************************************************************

* Summary:

*  ISR for Low voltage detect interrupt

*  Sets low battery flag in the status register

* Parameters:

*  None

*

* Return:

*  None

*

*******************************************************************************/

void LowBattery_ISR(void)

{

    isr_LowBattery_Disable();

    isr_LowBattery_ClearPending();

    CySysLvdClearInterrupt();

    Readings[Battery]++;

    DBG_PRINTF("Low battery detected: %d \r\n", Readings[Battery]);

    return;

}

/*******************************************************************************

* Function Name: BatteryTest()

********************************************************************************

* Summary:

*   Checks the battery level, when below 2.2 we indicate to replace the battery

*   when below 1.9 we stop red flag battery replacement

*  Sets low battery value in the status register

* 0 = GOOD, 1 = 2.2V or less, 2 = 1.9V or less

* Parameters:

*  None

*

* Return:

*  None

*

*******************************************************************************/

void BatteryTest(void)

{

    DBG_PRINTF("Starting battery test \r\n");

    Readings[Battery] = 0;

    CySysLvdEnable(CY_LVD_THRESHOLD_2_20_V);

    isr_LowBattery_StartEx(LowBattery_ISR);

    if(Readings[Battery] != FALSE)

    {

        CySysLvdEnable(CY_LVD_THRESHOLD_1_90_V);

        isr_LowBattery_Enable();

    }

    isr_LowBattery_Stop();

    CySysLvdDisable();

    DBG_PRINTF("Battery Level is: %d \r\n", Readings[Battery]);

    return;

}   

View solution in original post

0 Likes
6 Replies
VenkataD_41
Moderator
Moderator 750 replies posted 500 replies posted 250 solutions authored
Moderator

Hi,

The Low Voltage Detect block in PSoC 4 BLE will detect the voltage on the VDDD pin and trigger the interrupt when the voltage falls below the configured voltage. So it is not possible to use this block for voltage monitoring of your application.

For implementing the voltage monitoring, we recommend you to use SAR-ADC block in PSoC 4 BLE. You can use a resistor divider if the voltage to be measured falls out of the VDDD of PSoC.

Thanks

Ganesh

0 Likes
HeGi_2497906
Level 5
100 replies posted 50 replies posted 25 replies posted
Level 5

Ganseh, thank you for you support,

We are running directly off the battery, this function works great, I am not sure why this is not a Widget, LVD, I actually can step through a series of sets and determine the actual battery voltage.

/*******************************************************************************

* Function Name: LowBattery_ISR()

********************************************************************************

* Summary:

*  ISR for Low voltage detect interrupt

*  Sets low battery flag in the status register

* Parameters:

*  None

*

* Return:

*  None

*

*******************************************************************************/

void LowBattery_ISR(void)

{

    isr_LowBattery_Disable();

    isr_LowBattery_ClearPending();

    CySysLvdClearInterrupt();

    Readings[Battery]++;

    DBG_PRINTF("Low battery detected: %d \r\n", Readings[Battery]);

    return;

}

/*******************************************************************************

* Function Name: BatteryTest()

********************************************************************************

* Summary:

*   Checks the battery level, when below 2.2 we indicate to replace the battery

*   when below 1.9 we stop red flag battery replacement

*  Sets low battery value in the status register

* 0 = GOOD, 1 = 2.2V or less, 2 = 1.9V or less

* Parameters:

*  None

*

* Return:

*  None

*

*******************************************************************************/

void BatteryTest(void)

{

    DBG_PRINTF("Starting battery test \r\n");

    Readings[Battery] = 0;

    CySysLvdEnable(CY_LVD_THRESHOLD_2_20_V);

    isr_LowBattery_StartEx(LowBattery_ISR);

    if(Readings[Battery] != FALSE)

    {

        CySysLvdEnable(CY_LVD_THRESHOLD_1_90_V);

        isr_LowBattery_Enable();

    }

    isr_LowBattery_Stop();

    CySysLvdDisable();

    DBG_PRINTF("Battery Level is: %d \r\n", Readings[Battery]);

    return;

}   

0 Likes
Vasanth
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hi,

In PSoC Creator in code examples go to Battery_Level example. This uses the internal ADC and capacitor to measure the battery voltage. This can be used in your application.

Best Regards,
Vasanth

0 Likes
HeGi_2497906
Level 5
100 replies posted 50 replies posted 25 replies posted
Level 5

Vasanth, not sure why you keep returning to the example ADC project, this is not a better solution when you are running directly from a battery, no external components, you can determine batteryV within 0.1V, no brainer, why is this not a widget in topsync?

0 Likes
Vasanth
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hi Herb,

Apologies if I was not clear with the requirement. There is no component for LVD, but there are APIs you can make use of. Kindly check the PSoC 4 System Reference Guide. CySysLvdEnable(uint32 threshold) and other LVD API s can be used to meet your requirement.

Best Regards,
Vasanth

0 Likes
HeGi_2497906
Level 5
100 replies posted 50 replies posted 25 replies posted
Level 5

Thanks, why don't you create a widget for this, so easy to do?

0 Likes