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
- Follow the path Start à Cypress à PSoC Programmer.
- 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.
- Connect CY8CKIT-145 to the USB port.
- Click the program icon. If programming is complete, the “Programming Succeeded” message is displayed as shown in Figure 2.
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.
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.
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.
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
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.
Note: The “+” sign breaks longer commands into multiple lines.
Figure 7 shows the code required to send CapSense sensor data from PSoC 4 device.
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.
8. To log the CapSense sensor data, click Repeat to run BCP. After the intended duration, click Stop to stop data monitoring.
9. Click Chart à Export 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