CapSense Sensor Monitoring and Logging through UART and Bridge Control Panel - KBA228593

Version 6

    Version: **


    Translation - Japanese: UART と Bridge Control Panel を使用した CapSense センサのモニタリングとロギング方法 - KBA228593- Community Translated (JA)

    How can I monitor the CapSense® sensor data over UART and log data?

    The attached project implements CapSense button using the CY8CKIT-145 kit.

    The following method of monitoring CapSense data is helpful when I2C Port is already utilized for other purposes or CapSense parameters such as Raw count, and Difference count must be logged indefinitely.

    Programming PSoC 4® Device

    1. Follow the path Start à Cypress à PSoC Programmer.
    2. Click the File Load icon and load the CapSense_UART_sensor_monitor.hex file from the attached project folder “CapSense_UART_sensor_monitor”. Select the PSoC Programmer settings as shown in Figure 1.  

      Figure 1. PSoC Programmer Settings

    3. Connect CY8CKIT-145 to the USB port.
    4. Click the program icon. If programming is complete, the “Programming Succeeded” message is displayed as shown in Figure 2.

      Figure 2. Programming PSoC 4 

    Viewing CapSense Sensor Data and Logging Bridge Control Panel (BCP)

    1.    Follow the path Start à Cypress à Bridge Control Panel.

    2.    In the Bridge Control Panel dialog, go to Chart à Variable Settings as shown in Figure 3.

    Figure 3. Accessing Variable Settings


    3.    In the Variable settings dialog, enter the variable names and data type as shown in Figure 4. Click OK to return to the Bridge Control Panel dialog. 

    Figure 4. Entering Variable Names and Data Types

    Note: You can also import these variables from the variable_settings.ini file. Click Load… and select variable_settings.ini.

    4.    In the Bridge Control Panel dialog, select the COM port of the PSoC 4 device from the list of Connected I2C/SPI/RX8 Ports. In this example, the COM port is COM30. This port might vary. If the connection is successful, “Connected” is displayed in green as shown in Figure 5.

    Figure 5. Selecting COM Port


    5.    In the Editor tab, enter the command to receive sensor data from PSoC 4 as shown in Figure 6.

    Note: Instead of manually entering the comments, you can import the the UART_command.iic file available with this knowledge base article. This file contains the commands to receive sensor data. Click File à Open File (Ctrl+O) to import the file. 

    6.    To execute the command once, click Send button. To execute the command iteratively, click Repeat highlighted in blue in
    Figure 5.

    BCP starts receiving data stream from PSoC 4. BCP command @1rawcount0 captures high byte while @0rawcount0 captures low byte of RawCount. Similarly, other variables are separated from the data stream of PSoC 4 device.

    Figure 6. Reading Data from PSoC 4 Device

    Note: The “+” sign breaks longer commands into multiple lines.

    Figure 7 shows the code required to send CapSense sensor data from PSoC 4 device. 

    Figure 7. PSoC 4 Functions to Send CapSense Data



    7.    To visualize data received from PSoC 4 device, go to the Chart tab and select the plot rawcount0 listed in the top right corner. You can also select other variables such as diffcount0as shown in Figure 8 and Figure 10.


                     Figure 8. Raw Count Plot on BCP                                                           Figure 9. Difference Count Plot on BCP

    8.    To log the CapSense sensor data, click Repeat to run BCP. After the intended duration, click Stop to stop data monitoring.

    Figure 10. Starting and Stopping Data Monitoring



    9.    Click Chart à Export Collected Data.

    Figure 11. Exporting Collected Data



    10. From the Export Collected Data dialog, you can save the data as a picture or in text, XML, HTML, or Excel format.

    Figure 12. Saving Exported Data