Easy Embedded Programming: Capacitive Touch Sensor

게시자

JJ decided to take the easy embedded programming video series further and dive into new combinations; this time he changes the speed of a motor with a capacitive touch sensor.

Hello Everybody, my name is Jean Jacques Meneu and I am an application engineer at Arrow Electronics.

In the first five lessons, we learnt how to spin a motor when an object approaches a proximity sensor. once this is done, it is easy to move forward and learn new combinations. For instance, today, we change the spin of the motor based on the position of our finger on the touch sensor designed on the evalboard provided by Cypress.

We copy the schematic of lesson 5, and we add a component CapSense CSD. We name it CapSense, use the auto tuning method. On the evalboard, it is a linear slider with 5 sensors elements that is designed so we need to enter this configuration. The minimum value of 0 and the maximum value will be 100. When no finger is touching the sensing the element, the return value is 0xFFFF.

As usual, to get all the information about the component, we read the datasheet. In the API section, we find the CapSense_GetCenteroidPos function that gives the position of the finger on the slider. In this paragraph, we can read the function returns 0xFFFF is no sensor is active.

Then the pin out must be configured: the sensing elements are on port 2 from pin1 through pin5 and a last pin called Cmod is on port 4 pin 0. It is time to build the project in order to generate the APIs.

The code is fairly simple. The three CapSense functions are to start the CapSense widget, initialize the sensing elements and enable the scan. We continue to use the interrupt designed in lesson 5 and that triggers an interrupt every 250 ms. The touch sensor has the priority on the proximity sensor. So, we read the value of the touch sensor, if different of 0xFFFF, we modify the speed of the motor by changing the PWM value that drive the motor. If equal to 0xFFFF, we program the speed of the motor based on the proximity sensor value.

최신 동영상

죄송합니다. 선택한 필터와 일치하는 결과가 없습니다.

개인정보 보호정책이 업데이트되었습니다. 잠시 시간을 내어 변경사항을 검토하시기 바랍니다. 동의를 클릭하면 Arrow Electronics 개인정보 보호정책 및 이용 조건에 동의하는 것입니다.

당사의 웹사이트에서는 사용자의 경험 향상과 사이트 개선을 위해 사용자의 기기에 쿠키를 저장합니다. 당사에서 사용하는 쿠키 및 쿠키 비활성화 방법에 대해 자세히 알아보십시오. 쿠키와 추적 기술은 마케팅 목적으로 사용될 수 있습니다. '동의'를 클릭하면 기기에 쿠키를 배치하고 추적 기술을 사용하는 데 동의하는 것입니다. 쿠키 및 추적 기술을 해제하는 방법에 대한 자세한 내용과 지침을 알아보려면 아래의 '자세히 알아보기'를 클릭하십시오. 쿠키 및 추적 기술 수락은 사용자의 자발적 선택이지만, 웹사이트가 제대로 작동하지 않을 수 있으며 사용자와 관련이 적은 광고가 표시될 수 있습니다. Arrow는 사용자의 개인정보를 존중합니다. 여기에서 당사의 개인정보 보호정책을 읽을 수 있습니다.