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

cross mob

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

lock attach
Attachments are accessible only for community members.

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

AshokR
Employee
Employee
5 sign-ins First solution authored First question asked

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 Sensor PSoc 6 WiFi-BT Pioneer Kit
SCL P6_0
SDA P6_1
VDD P6_2
GND GND

 

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

pastedImage_0.png

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

 

 

1263 Views
Authors