CY8CKIT-046 PSoC® 4 L-Series Pioneer Kit Guide, Doc. #: 002-03344 Rev. *D
34
Code Examples
3. Insert the proximity sensor wire to the proximity sensor header as shown in
. You
should bend the wire to form a loop, as shown in
to get better proximity range. Press
the reset switch (SW1) when the wire is in place.
Figure 4-12. Hand Close to the Proximity Sensor
4. Bring the hand close to the proximity sensor, as shown in
. You will see the blue LED
turning ON.
5. As you move your hand closer to the proximity sensor, the brightness of the LED increases. As
you move your hand away from the sensor, the brightness of the LED decreases.
You will get a proximity range of approximately 5 cm with the wire supplied with this kit. You can
achieve a higher proximity range by using a larger wire loop. Also, make sure there are no metal
objects near the loop. To test the example and get a maximum proximity range, it is recommended to
place the board at the edge of a table and connect wires such that the wire protrudes out from the
table. This way, the proximity loop will be free of any interference or performance loss from nearby
metals. This is done only for proximity detection using wires, because the proximity sensor is not
shielded by any shield or ground signal. In general, proximity detection using PCB trace loops does
not require this practice as they are properly shielded.
Power consumed by PSoC 4200L for this example can be measured using an ammeter, as
described in
4.4
Proximity Gestures
4.4.1
Project Description
This code example demonstrates the proximity gesture detection capability of the PSoC 4200L
device using CapSense. The PSoC 4 L-Series Pioneer Kit has two headers, which are used to con-
nect proximity wires. These wires are used as proximity sensors to detect an approaching hand.
The firmware gangs both proximity sensors and scans them as a single proximity sensor every
200 ms by default. If the ganged proximity sensor detects the presence of an approaching hand,
then PSoC 4200L checks the magnitude of the signal produced by the proximity sensor. If the prox-
imity signal is less than the threshold value, the RGB LED on the kit is maintained at a minimum
brightness. If the proximity signal is greater than the threshold value, the brightness of the RGB LED
is varied according to the magnitude of the proximity signal. The CapSense scanning interval is
changed to 30 ms when proximity is detected. The example has a proximity range of approximately
5 cm.
When proximity is detected, the firmware checks for hand gestures. Two types of gestures are rec-
ognized by the firmware – Wave UP gesture and Wave DOWN gesture.
show the Wave UP and Wave DOWN gestures, respectively. The color of the RGB LED changes