Easy Embedded Programming: Capacitive Touch Sensor

Veröffentlicht von

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.

Neueste Videos

Leider hat Ihre Filterauswahl keine Ergebnisse zurückgegeben.

Aktuelles über Elektronikkomponenten­

Wir haben unsere Datenschutzbestimmungen aktualisiert. Bitte nehmen Sie sich einen Moment Zeit, diese Änderungen zu überprüfen. Mit einem Klick auf "Ich stimme zu", stimmen Sie den Datenschutz- und Nutzungsbedingungen von Arrow Electronics zu.

Wir verwenden Cookies, um den Anwendernutzen zu vergrößern und unsere Webseite zu optimieren. Mehr über Cookies und wie man sie abschaltet finden Sie hier. Cookies und tracking Technologien können für Marketingzwecke verwendet werden.
Durch Klicken von „RICHTLINIEN AKZEPTIEREN“ stimmen Sie der Verwendung von Cookies auf Ihrem Endgerät und der Verwendung von tracking Technologien zu. Klicken Sie auf „MEHR INFORMATIONEN“ unten für mehr Informationen und Anleitungen wie man Cookies und tracking Technologien abschaltet. Das Akzeptieren von Cookies und tracking Technologien ist zwar freiwillig, das Blockieren kann aber eine korrekte Ausführung unserer Website verhindern, und bestimmte Werbung könnte für Sie weniger relevant sein.
Ihr Datenschutz ist uns wichtig. Lesen Sie mehr über unsere Datenschutzrichtlinien hier.