Cy8CKIT

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

cross mob
MiCi_4483361
Level 2
Level 2
First like given

Hi dear community members

Using the ProC CYBL10563-56LQXI as the 'tile'. If the ProC moves by any motion I have to create an alarm. Or I should be able to track this.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hello MiCi_4483361 ,

Please refer to the attached modified project, in which when the device gets connected RED led will turn ON. After the connection established, when a read request is send from the central device, RSSI value will be send to the central device. And, the LED's will turn into a different color for a different RSSI value.

Please let me know if this helps.

Thanks,

P Yugandhar.

View solution in original post

16 Replies
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello MiCi_4483361 ,

Could you please refer to the "BLE_FindMe" Code example project in the PSoC Creator for your application ? In this example project, the Find Me Profile instantiates the Immediate Alert Service which can be used to control the Alert Level of an indicator (e.g. buzzer, LED, etc.).

Thanks,

P Yugandhar.

0 Likes

Hi Yugandhar

The main purpose of this project is , making an android app with Appinventor. And making a connection with the PsoC BLE.

Tile mate example. When the device starts moving I have to get a notification on my own app. And I have to be able to turn on a LED on the board.

Moment the PsoC starts moving further then ( for instance -40RSSI ) , I have to get a notification on the Android App that I made myself , so I can't use the PsoC BLE app on the play store.

I already made the PsoC BLE find me , but how do I configure this on my own Android App? And how do I get the Rssi on the app?

Thank you so much for helping me out during this process.

Sincerly

Mika

0 Likes

Hello MiCi_4483361 ,

1. Please refer to the below link for the source code for the CySmart Android and iOS apps where you can download and modify the source code available on this page to build your own apps that work with Cypress Bluetooth Low Energy devices.

Link: https://www.cypress.com/documentation/software-and-drivers/cysmart-mobile-app

2. When the peripheral is connected to your Android App, read the RSSI value using the CyBle_GetRssi() function and send it to your central Android App. This function reads the recorded Received Signal Strength Indicator (RSSI) value for the last successfully received packet from the BLE radio sub-system.

Please let me know if you have any questions.

Thanks,

P Yugandhar.

0 Likes

Hi Yugandhar

I downloaded CySmart_Android_Source_Code , but what is the function of this? The app that I created was via MIT app inventor.

Why do I have to download the source code? I know that the CyBle_GetRssi() function has to be implemented in the main.c file but how?

When connected the PsoC has to blink a LED and when disconnected it has to turn to a constant RED LED.

Thank you in advance

0 Likes

I have been looking at the source code , but there is one problem.

I do not have any skills in programming with JAVA , appinventor was really easy to use because it is not code based.

The UART in the 100_days_100_projects does not contain a RSSI.

Short version : made an app via MIT APP INVENTOR , put the APK on my android device. Put the FindMe on the PsoC BLE and connected it. I have a connection via the app that I made. Only thing left is to get an RSSI value on my application and have to send an message to the android device via the switches on the PsoC baseboard.

0 Likes
lock attach
Attachments are accessible only for community members.

Hello MiCi_4483361 ,

At the peripheral, you can read the current RSSI value( using the CyBle_GetRssi() function) and send it to your central Android App. For this, you have to create a custom profile in the BLE Component with Read property. For more information on creating a BLE custom profile, please refer to the AN91162 Application note.
Please refer to the below attached project where I added the custom profile in the BLE component, when a read request is send from the central device I'm reading the RSSI value of the device and sending to the central device.
Please let me know if you have any questions.

Thanks,
P Yugandhar.

Hi

Thank you for the project , could you explain the code?

and when I connect the led it doesn't turn on.

And the LED's have to turn into a different color for a different RSSI. When connected to a central device like my android smartphone.

How do I make this happen?

thank you

Mika

0 Likes
lock attach
Attachments are accessible only for community members.

Hello MiCi_4483361 ,

Please refer to the attached modified project, in which when the device gets connected RED led will turn ON. After the connection established, when a read request is send from the central device, RSSI value will be send to the central device. And, the LED's will turn into a different color for a different RSSI value.

Please let me know if this helps.

Thanks,

P Yugandhar.

Hi

Is there a way to send out a read request via the central device?

I thought the LED's would turn automatically into a different color when you walk away for instance. I'm connected to the device it turns on a RED led. But if I start walking it doesn't change.

And is there a way to press the switch on the PsoC and receive a notification on the central device?

Thank you so much for helping me out again.

Mika

0 Likes
lock attach
Attachments are accessible only for community members.

Hello,

At the central device, when you send the read request from the CySmart App then only the RSSI value will be shown as shown in attached image.

Thanks,

P Yugandhar.

Hi ,

The LED's are holding their values , if I get further away from the PsoC It doesn't change

Color stays the same.

Can I change the values for the Blue led for e.x 50rssi-60rssi?

Thank you in advance

regards

Mika

0 Likes

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

   /*Initially LEDs are OFF*/

  

    RED_Write(1);

    GREEN_Write(1);

    BLUE_Write(1);

   

    CyBle_Start(stackeventhandler);

    UART_Start();

    printf("\r\n BLE start");

  

    for(;;)

    {

        /* Place your application code here. */  --

        CyBle_ProcessEvents();

       

    }

}

Why are  you reffering to my application code?

What does this mean?

0 Likes

Hello Mika,

Apologize for the delay. In the project, please call the 'CyBle_GetRssi()' immediately in CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ event as shown in below code.
********************
  case CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ:

        rdresponse = *( CYBLE_GATTS_CHAR_VAL_READ_REQ_T  * ) eventParam;
       
        rssi=CyBle_GetRssi();
********************
Please let me know if you are able to turn ON the different LEDs for different RSSI values.

Q: Can I change the values for the Blue led for e.x 50rssi-60rssi?
Ans: Could you please elaborate more on this? Would you like to turn ON blue LED only when the RSSI value is from -50dBm to -60dBm range ?

Q: Why are  you referring to my application code?
Ans: In your project, if you have any other code(i.e., if you are handling any other components) then you can place it in infinite loop.

Please let me know if you have any questions. I'm glad to help.

Note: The function CyBle_GetRssi will return the RSSI value of the responding devices range in -85 <= N <= 5 dBm, but for PSoC BLE 4.1 devices there is a limitation that the RSSI value returned saturates at -79dBm. Anything beyond will be reported as -79dBm only.

Thanks,
P Yugandhar.

0 Likes

Hi , It doesn't turn blue

You know why?

0 Likes

Yes , I like to give it a different color then as you say.

Turning ON the led BLUE when I have a longer disstance , green for a short one

0 Likes

Hello,

At my end, I'm able to turn ON the Blue LED. Could you please check whether the LED pins are properly assigned or not in 'Pins' configuration in PSoC Creator ?

In the previous project(RSSI.zip), I'm checking the present RSSI with the previous RSSI value, based on this I'm turning ON the different LEDs. If you want to turn ON particular LED based on longer and shorter distance then please check for this condition and update the LEDs accordingly as shown in below code.

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

if(rssi>-50)

    {

    /*  Trun ON blue LED */

        RED_Write(1);

        GREEN_Write(1);

        BLUE_Write(0);

    }

    else if(rssi<-50)

    {

   /*  Trun ON green LED */

        RED_Write(1);

        GREEN_Write(0);

        BLUE_Write(1);

    }

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

Please let me know if you have any questions.

Thanks,

P Yugandhar.

0 Likes