Showing results for 
Search instead for 
Did you mean: 

ModusToolbox Blog


3D Magnetic Sensor Interface with PSoC 6 (Non-Wireless Demo)


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.


Project Technology Focuses

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

Project Requirements



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.


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.


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.


Pin Details

Infineon 3D Magnetic SensorPSoc 6 WiFi-BT Pioneer Kit

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.


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 ( 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.


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

Top labels