CY8CKIT-014 PSoC 5 FirstTouch Starter Kit Guide, Spec. # 001-57708 Rev. **
21
Example Projects
4.2.1
How the Bubble Level Emulator Project Works
A bubble level displays the amount the level deviates from horizontal using a bubble of air in a glass
via level. In this project, a level is emulated by the accelerometer on the board.
In the case of the bubble level detection, LEDs display the tilt of the board along its length
(corresponding to the X axis of the accelerometer).
The accelerometer is always under the influence of gravity. When the board is placed flat on the
ground, the static acceleration due to gravity along the X axis of the accelerometer is zero. In this
position of the board, the two LEDs in the center of the LED display are turned on. As the board is
tilted in one direction, the force of gravity along that axis increases. This increases the static
acceleration detected by the accelerometer. The X axis voltage output of the accelerometer is fed
into an ADC in the PSoC. The ADC converts this voltage into digital count, which is the measure of
the static acceleration detected by the accelerometer. PSoC determines the tilt of the board and
lights up LEDs indicating the tilt. If the board is further tilted in one direction, the LED accordingly
keeps moving to the extreme of the LED display.
Figure 4-11. Bubble Level Emulator Project Flowchart
Boot
Start
Get ADC count(V) for
Accelerometer X axis
voltage
Calculate the LED
offset for current value
of V
Update LED display
Summary of Contents for PSoC 5 FIRSTTOUCH CY8CKIT-014
Page 4: ...4 CY8CKIT 014 PSoC 5 FirstTouch Starter Kit Guide Spec 001 57708 Rev Contents...
Page 8: ...8 CY8CKIT 014 PSoC 5 FirstTouch Starter Kit Guide Spec 001 57708 Rev Getting Started...
Page 32: ...32 CY8CKIT 014 PSoC 5 FirstTouch Starter Kit Guide Spec 001 57708 Rev Example Projects...
Page 44: ...44 CY8CKIT 014 PSoC 5 FirstTouch Starter Kit Guide Spec 001 57708 Rev Technical Reference...