04 Aug CAP1188 SPI Arduino Communication
The CAP1188 offers a large variety of button and proximity functionalities. It’s a turnkey capacitive touch controller, which also encompasses 8 LED drivers. These LED drivers provides full-on / off, dimness controls, variable rate blinking, and breathing. Every LED driver is connected with one of the sensor inputs to actuate when it detects a touch. Besides, each LED driver is individually controlled through a host controller. The low-cost and sturdy touch interfaces works on I2C and SPI protocol. We will be leveraging SPI interfacing in this post.
Key Features
• 8 Capacitive Touch Sensor Inputs
• 8 LED Driver Outputs
• Programmable sensitivity
• Automatic recalibration
• Individual thresholds for each button
• Proximity Detection
• Multiple Button Pattern Detection
• Analog Filtering for System Noise Sources
• Press and Hold feature for Volume-like Applications
• Low Power Operation
Hardware connection:
CAP1188 Arduino
GND GND
5V Vin
MISO 11
MOSI 12
SCK 13
CS 10
RESET 9
IRQ 3
A0 GND
Source code
Library Downloading:
From the Arduino library manager download the Arduino library.
Open the Arduino library manager.
Search and install the Adafruit CAP1188 library.
After restarting, load File -> Examples -> Adafruit_CAP1188-> cap1188test sketch
As displayed in the above hardware connection, wire up the connections.
Now upload the sketch, and at 9600 baud, open the serial console. The CAP1188 will be available (good!). You can touch the C1 through C8 pads with your fingers, which will make the sensor go off. Besides, you will see the matching LED lighting up when you touch the pin.
OUTPUT
Explanation:
1) Involve all the files similar to adafruit_cap1188.
2) Establish all the SPI connections with cap1188. Set all the pins as per the code. Use Reset pin for I2C or SPI. Use CS pin for software or hardware SPI. For SPI communication use MOSI, MISO and CLK pins.
3) Start cap1188 SPI function.
4) Begin cap1188 sensor with address when you make use of I2C method. Otherwise, use the code given below.
5) Turn off multi-touch functionality to allow only one button to be pressed at a time. The function cap.writeRegister has several configurations related to multi touch, led and interrupt.
6) Check if a touch is detected in the loop function. Based on the pin, the output will get displayed.
Now, look for interrupt, whenever it detects a touch in the loop due to cap.writeRegister(0x44, 0x41). The routine_Interrupt_CAP1188() interrupt function gets triggered. This increases the value of interrupt, thereby enabling the loop to continue.
If you have any questions related to this topic, do not hesitate to post them on the Comment Box below, and don’t forget to follow us on 👍 Social Networks😉