This blog posting is an introduction to Capacitive Touch provided for the LPC845 MCU device. We are going to take advantages of the features that the LPC845 Breakout Board to show how to interface with the onboard Cap touch button using SDK drivers.
The Capacitive Touch module measures the change in capacitance of an electrode plate when an earth-ground connected object (for example, the finger or stylus) is brought within close proximity. Simply stated, the module delivers a small charge to an X capacitor (a mutual capacitance touch sensor), then transfers that charge to a larger Y capacitor (the measurement capacitor), and counts the number of iterations necessary for the voltage across the Y capacitor to cross a predetermined threshold.
Figure 1. Mutual Capacitive Touch
A pulse is applied between the transmitting and receiving electrode to generate an electromagnetic field. When a finger comes into close proximity, part of the electromagnetic field moves to the finger where the decrease in electromagnetic field strength is detected by the electrodes. The capacitance is detected and captured and recognized as a finger presence.
The Capacitive Touch module uses one standard GPIO pin for YL and up to nine standard GPIOs for X0 through XMAX.
YH, YL, and X functions are typically enabled on their pins using the switch matrix or IOCON, depending on the product family. Additionally, the set of X pins that the application will use must be enabled or identified to the module by writing ‘1’s to their bit positions in the XPINSEL field of the control register.
Programming of all these registers is performed only during initialization.
Table 1. Capacitive Touch Registers.
The LPC845 Breakout Board include an on-board Cap Touch button that enables easy evaluation of the capacitive touch features of the LPC84x family of devices.
The connections for the capacitive touch button are shown in Table 2 below. If the Cap Touch button is not being used, the ports connected to it can be used for other purposes (such as GPIO), but note that PIO0_30 and PIO0_31 are effectively shorted together through resistor R19. If this zero ohm resistor may be removed if the Cap Touch button is not required.
Table 2. Capacitive touch button signals
The NXP example package includes projects to use the principal's peripherals that the board includes: ADC, I2C, PWM, USART, Captouch, and SPI. We are going to use the Captouch example include here, this after an initial calibration, once the cap touch button is touched, the RGB's Red led will turn on.
Once downloaded, we import the library project into the workspace using the ''Import project(s) from file system... from the Quickstart panel in MCUXpresso IDE:
Figure 2. Import Projects.
Then browse the examples packages archive file:
Figure 3. Select Example Package.
Press next, and see that are a selection of projects to import, in this case, only keep select the LPC845_BoB_CAPTouch how it looks in the picture below:
Figure 4. Select CapTouch Project
Now with the project in the workspace, we are going to build and run the example, you are going to see instructions in the IDE console for the calibration. Put your finger in the captouch button and press enter to start the calibration, once finished, you are going to see a message, and with that the demo is ready, you are going to see the RGB red led on when the when the cap touch button is touched and off then it´s not.
Hi,
I'm wanting to get this board and use it alongside my LPCXpresso845MAX board, but an uncertain how to use the SDK. I saw the link above for the SDK_2.5.0_LPC845, but also saw on the LPC845-BRK Getting Started page (LPC845 Breakout Board for LPC84x family MCUs | NXP Screen show below.) that the SDK needs "just a few modifications." What exactly are those modifications?
Thanks,
Andre.
Hi Andre Lipinski,
You can use the SDK for the LPC845 MCU for this board without any changes, I refer to create a new project just to be sure to not select the MAX board when you created and select the corresponding MCU package of the Breakout board.
What means this part, is that you could port the SDK examples of the LPCxpresso845 MAX board to use it in the Breakout board, only with a few modifications, Those are very simple, you only have to switch the MCU package and route the correct pins, those are very simple with the config tools, you can refer to section 4 of the getting started to see a little more of this.
The example package that mentions in this post NXP example packages has a series of examples ready to use in the Breakout board without any modifications, you can also take a look of this, may be useful.
I hope that this help to answer your question, and if you have another not hesitate to ask.
Best regards,
Miguel Mendoza
Ah ha!
Thanks, Miguel. That straightens things up quite a lot.
Hi ! I just tried to run the CapTouch project and an error message poped out.
Followed by:
Any idea what could it be?
i appreciate your support, thank you!