You are here

BLE_Battery_Level" example not woking | Cypress Semiconductor

BLE_Battery_Level" example not woking

Summary: 26 Replies, Latest post by bobgoar on 16 Oct 2016 05:30 AM PDT
Verified Answers: 2
Last post
Log in to post new comments.
chaplin.u_1533771's picture
User
106 posts

I need code to check battery. I opened "BLE_Battery_Level" example and run it. When I connected input to real pair of 1.5V batteries (2.56V)  it measure 0 voltage. Are this example is working ?

Where I can get real working example for check battery ?

 

user_242978793's picture
User
1042 posts

The example should work but you have to remove ADC input  the from Vref to another GPIO pin then apply your batteries to it. I would add a resistor divider to insure you don't exceed the input max of 3.3 Volts.  Also this is a simulate battery reading example and at Main.c  at line 300 the simulated battery part of the code is called and the actual reading code is not called. I am sending you a 6 channel voltmeter program to see how to make a voltmeter. This code is made for a PSoC 4 CY8CKIT-049-42XX so you would need to modify it for the PSOC Ble.  But the ADC  code should work for you.

chaplin.u_1533771's picture
User
106 posts

As I said before "I connected input to real pair of 1.5V batteries" to analog input and voltage was 2.56V ( no need insure resistor).

And you can see in main.c real MeasureBattery called too :

        if(CyBle_GetState() == CYBLE_STATE_CONNECTED)
        {
            /*******************************************************************
            *  Periodically simulate Battery level charging.
            *******************************************************************/        
            SimulateBattery();
            CyBle_ProcessEvents();

            MeasureBattery(); 

 

In this project exist 2 BAS. One for real measure ( if I connect to VREF it always 100 % ) and simulated (always less 20 %).

I used real and it`s not worked. Example you provided very complicated and based on specific hardware so I can`t even run it.

And I think that need correct Cypress example because other customers need it too.

 

user_242978793's picture
User
1042 posts

I gave you that code to show you how to interface to the ADC. What pin did you connect your batteries to? The way this is designed it reads Vref. Please post your code.

chaplin.u_1533771's picture
User
106 posts

Code exist in c:\Program Files (x86)\Cypress\PSoC Creator\3.3\PSoC Creator\examples\sampleprojects\BLE_Battery_Level\

I connected battery  to P3[0] as in example instead of Vref. If you have Pioner kit you can check it yourself.

 

user_242978793's picture
User
1042 posts

Also what kind of batteries are you using?

user_242978793's picture
User
1042 posts

You have to jumper pins on the Pioneer board to make this work check this in the instructions. 

chaplin.u_1533771's picture
User
106 posts

I used Ni-MH . What a limits to battery exist ? Can you check how it work for you ?

chaplin.u_1533771's picture
User
106 posts

OMG, I told that I made it. I jumper P3(0) to Vref and it display 100 % . Right now everything is OK.

After that I removed Vref and connected P3(0) to real battery and it`s not worked. 

user_242978793's picture
User
1042 posts

The 1.2 volt batteries? Two in series correct?

chaplin.u_1533771's picture
User
106 posts

Yes, Please take Kit and do it too.

Log in to post new comments.