Skip navigation
Home > All Places > Topics > Cypress Community Blogs > ModusToolbox Blog > Blog > Authors AshokR_56

ModusToolbox Blog

2 Posts authored by: AshokR_56

Overview

 

This project demonstrates using Cypress PSoC 4 AFE Shield with CYW920819EVB-02 Kit, to collect data from different sensors present on the shield board and send it over Bluetooth using a custom GATT service to the peer device.

screen1.jpg

Project Technology Focuses

  • CYW20819 MCU
  • Sensors
  • BLE

Project Requirements

Hardware

Software

 

Project Description

The objective of this project is to read the values from sensors on PSoC 4 AFE shield board and send it to peer BLE GATT Client using GATT notifications.

 

AFE shield board has temperature sensor, humidity sensor, ambient light sensor, CapSense, push buttons, potentiometer and an OLED display. PSoC 4 on AFE Shield processes the data from all the components mentioned above. The values are stored in PSoC 4 registers. Refer the AFE Shield kit guide for more information. CYW20819 reads data from AFE shield through I2C. A custom GATT server is configured on CYW20819 to frame the sensor data as shown below.

 

GATT notification data format

Byte (0 -3)

Byte (4 -7)

Byte (8 -11)

Byte (12 -15)

Byte 16

Byte 17

Byte 18

Byte 19

Temperature

Humidity

Ambient

Pot value

CapSense

Switch

Proximity

RFU

 

Once the peer device subscribes for notifications, the sensor data is sent using GATT notification for every 500 milliseconds. Also, the data is displayed on the OLED and UART terminal console.

 

afe_demo_out2.jpg

 

Running the Demo

Download the project files attached with this post (ccm02_source.zip) and import into Eclipse IDE for ModusToolbox. Refer the user guide for importing existing projects into Eclipse IDE for ModusToolbox Flash the firmware and pair the board with CySmart windows/android/iOS application. Go to GATT DB and enable the notification in the app to see all the sensor values.

 

screen2.jpg

Overview

This project demonstrates how to interface the Infineon 3D Magnetic sensor with Cypress’ PSoC 6 wireless device and showcase an automotive use case example of knob control with TFT display.

blog_pic1.jpg

Project Technology Focuses

  • PSoC 6 MCU
  • 3D Magnetic Sensor
  • emWin Graphics
  • FreeRTOS

 

Project Requirements

Hardware

Software

 

Project Description

The objective of this project is to read the 3D magnetic sensor data and display it on the TFT display. It mimics the use case of knobs for automotive and industrial application. The Infineon sensor TLE493D-A2B6 is a 3-dimensional magnetic sensor with I2C interface. The evaluation kit and Knob can be ordered from Infineon or distributor website.

blog_board_setup.png

Project Setup

To interface with Cypress PSoC 6 WiFi-BT Pioneer Kit, we need to break the sensor part from the Infineon evaluation board. The separated sensor part will have the following pin connections.

blog_board_seprated.png

This separated board is interfaced with the PSoC 6 WiFi-BT Pioneer Kit using fly wires.The sensor board and Knob are separated by 3 to 5 mm air-gap and taped with the board using some double-sided tape.

blog_knob.png

Pin Details

 

Infineon 3D Magnetic SensorPSoc 6 WiFi-BT Pioneer Kit
SCLP6_0
SDAP6_1
VDDP6_2
GNDGND

 

The 3D Magnetic sensor is powered through the PSoC 6 MCU pin P6_2 (3.3v). PWM is used on pin P1_5 to control the brightness of the LED8. The PsoC 6 WiFi-BT Pioneer Kit is powered via Type C USB cable.

 

Display

The CY8CKIT-028-TFT display shield board has a 2.4 inch TFT screen which is mounted on Arduino compatible pin headers of PSoC 6 WiFi-BT Pioneer Kit. The values obtained from the sensor is updated in TFT screen with the help of emWin graphics library.

 

Code Flow

Configure the Sensor

In this project we put the sensor in master controlled / power down mode and INT is disabled. Trigger option is used to start the ADC conversion in the 3D magnetic sensor. Refer the sensor datasheet for more details.

Two key registers must be configured to disable interrupt and enable trigger mode as shown below,

  • CONFIG (0x10)
  • MOD1 (0x11)

PSoC 6 I2C master clock is configured at 400 KHz. The sensor values are read with 20 ms interval. To obtain the angle of rotation refer to the application notes.

 

Running the Demo

To run this demo, Download the project files attached with this post (ccm01_source.zip) and Import into ModusToolbox IDE. Open the CLI terminal and resolve the library dependencies by executing the 'make getlibs' command. Refer the user manual for importing existing projects into ModusToolbox IDE.

Rotating the Knob updates the fill bar and knob graphics in the display. Pushing the knob switches the control between the fill bars and highlights it.

blog_tera_out.png

The sensor values are sent to the UART console. Take a look at the demo in this video here

 

 

Filter Blog

By date:
By tag: