S i 114 2 I n f r a r e d S l i d e r D e m o K i t S i 11 4 2 I R S LIDER 2 E K D EMO K IT U SER ' S G UIDE 1. Kit Contents The Si1142 Slider Demo Kit contains the following items: Si1142 Slider Demo Board Slider Demo Board Quick Start Guide USB Cable Si1142 2. Introduction The Si1142 Slider Demo Board implements an infrared touchless slider function based around the Si1142 infrared proximity and ambient light sensor. As shown in Figure 1, the main components of the board are the Si1142 sensor (U2), the C8051F800 microcontroller (U1), and two infrared emitters (DS1 and DS2). Hardware is also provided on-board to facilitate code development for the C8051F800 and communications with software support packages over a USB interface. The firmware running on the C8051F800 measures the infrared light energy detected by the Si1142, while each of the two infrared emitters are independently activated. The infrared light from these emitters will be reflected back to the Si1142 by any object that is placed in proximity to the board. The left-right position is then calculated from these two measurements and used to illuminate the appropriate signal LED. If no object is close enough to the board, the measured signal levels will fall below pre-determined thresholds, and no signal LEDs will be illuminated. In addition to indicating the current position, the firmware is also able to detect different gestures from the infrared sensor, as described in Table 2 on page 6. The Si1142's ambient light sensor (ALS) is also monitored by the firmware, which can determine the amount of ambient light present. Si1142-EB SILICON LABS DS1 U2 DS3 DS4 DS7 DS6 DS5 DS14 DS9 DS8 www.silabs.com U1 F800 DS12 DS11 DS13 Note: The touchless infrared position and gesture detection implemented in the example is patent pending. DS10 +5V_IN U3 P1 F326 DS2 Figure 1. Si1142 Slider Demo Board Rev. 0.3 7/13 Copyright (c) 2013 by Silicon Laboratories Si1142 Infrared Slider Demo Kit Si1142 Infrared Slider Demo Kit 3. Running the Pre-Loaded Slider Demo 1. The board receives its power over the USB interface. Connect one end of a USB cable to the USB connector (P1) on the Si1142 Slider Demo Board and the other end to a USB Port on the PC. 2. The red LED DS10 should light on the board, indicating that it is receiving power from the USB. 3. Position a hand about 5 to 10 cm above and perpendicular to the board. The visible blue LEDs will light according to the position of the hand above the board. 4. To initiate a "pause" gesture, hold steady for about 3/4 seconds. The current LED position indicator will blink a few times to indicate that a pause gesture has been detected. 5. To perform a "swipe" gesture, move the hand from left to right (swipe right) or right to left (swipe left) above the entire length of the board. The LEDs will briefly light in a sweeping pattern to indicate that a swipe gesture was detected. On this board, the infrared emitters used are OSRAM part number SFH 4056. These emitters have a power rating of 40 mW and a half-angle of 22 degrees. Other emitters with different characteristics may also be used, depending on the specific application requirements. 4. Software Overview There are several optional software packages available to support the Si1142 Slider Demo Board. The Si114x Performance Analysis Tool can be used for initial evaluation to collect data from the board over the USB interface and display it graphically on screen. For users ready to develop their own software, the Si114x Programmer's Toolkit API enables rapid development of Si114x software in a PC environment using the Si1142 Slider Demo Board. The Si114x Programmer's Toolkit contains example source code that allows developers to get started quickly and then tailor the code to their needs. In addition, the Silicon Labs Integrated Development Environment (IDE) provides a means of developing code for the C8051F800 and uses the USB connection on the board to program the MCU and perform in-system debugging. All of the supporting software can be downloaded from the web at: http://www.silabs.com/products/sensors/pages/optical-sensor-software.aspx. 4.1. Using the Si1142 Slider Demo Board with the Performance Analysis Tool The Si1142 Slider Demo Board is supported by the Si114x Performance Analysis Tool. The Performance Analysis Tool allows users to see real-time infrared proximity and ambient light measurements from the Si1142 in a graphical form. The communications interface to the Si1142 Slider Demo Board is provided over the USB connection. To use the Performance Analysis Tool with the Si1142 Slider Demo Board, perform the following steps: 1. Connect the Si1142 Slider Demo Board to the PC using a USB cable. 2. Launch the Performance Analysis Tool from the Start menu. 3. Select the board from the "Devices" menu (it should show up as "TS" followed by a serial number). 4. Select the channels you wish to display on the picture of the slider board that appears. The individual channels available are described in "4.1.1. Channel Selection" . 5. Click the green "Acquisition" arrow to begin collecting data. Note: The Performance Analysis Tool, the Si114x Programmer's Toolkit, and the IDE cannot connect to the Si1142 Slider Demo Board at the same time. Be certain to disconnect from the board in one software package before trying to connect in the other. Figure 2 shows an example of the Performance Analysis Tool output when connected to the Si1142 Slider Demo Board. To generate the graph, a hand was moved above the slider board. The selected traces shown are the raw data measurements for the amount of Infrared light being reflected onto the part. The pink trace represents the readings using infrared emitter DS1, and the green trace represents the readings using infrared emitter DS2. 2 Rev. 0.3 Si1142 Infrared Slider Demo Kit Figure 2. Performance Analysis Tool Main Window 4.1.1. Channel Selection Selecting which channels to display is done by checking the appropriate boxes on the Board Representation window, shown in Figure 3, and the Generic Data window, shown in Figure 4. There are two different groups of measurements available from the example firmware: raw data channels and generic data channels. 4.1.1.1. Raw Data Channels The raw data measurements can be seen by selecting the channels from the Board Representation window, shown in Figure 3. The two types of raw data measurements are ambient light and infrared proximity. 1. Raw ambient light measurements. The ambient light channels are Channel 0 (red) and Channel 1(blue). Channel 0 displays measurements of the ambient visible light while Channel 1 displays measurements of the ambient infrared light. 2. Raw infrared proximity measurements. The infrared proximity channels are Channel 2 (pink) readings using DS1 and Channel 3 (green) readings using DS9. Each output is proportional to the amount of infrared light being reflected onto the part by an object above the board. These outputs are 16-bit unsigned values. Figure 3. Raw Data Channel Selection Rev. 0.3 3 Si1142 Infrared Slider Demo Kit 4.1.1.2. Generic Data Channels The generic data channels contain any data generated by the host MCU. These 16-bit channels can be anything from simple debug channels to calculated position values. See Table 1 for an explanation of all the channels shown in Figure 4. Figure 4. Generic Data Channel Selection 4 Rev. 0.3 Si1142 Infrared Slider Demo Kit Table 1. Generic Data Channels Name Label Type Description G0 Rad1 Linearized Distance Measurements G1 Rad2 Using characterization of the PS measurements with objects at certain distances, it is possible to estimate the distance of an object based on the PS measurement value. These three channels represent the distance estimations for each LED's measurement. G2 X(mm) Estimated Location Coordinates G3 Y(mm) With the appropriate distance measurements above, an estimation of X and Y position can be made. These estimations are given in units of mm. G4 iLED1 LED Drive Current Levels G5 iLED2 Each LED driver has a specific LED drive current setting for it. These values are given in units of mA. G6 VIS AutoRanging Ambient Outputs G7 IR AutoRanging will automatically change the modes of the photodiodes to avoid saturation. When changing modes, the raw data output changes levels so that all measurements are on the same scale. The output from this channel is the processed value which can be used without knowledge of the photodiode modes. G8 PS1 AutoRanging PS Outputs G9 PS2 These channels are the AutoRanging PS output from the device. Raw data measurements are processed by the AutoRanging firmware to make all the readings across different modes have the same magnitude. Since the device switches modes to compensate for ambient light, the raw data will show jumps when changing modes. These outputs will not display the jumps because the firmware is stitching the raw outputs together. G10 VIS s State of Ambient Visible System G11 IR st State of Ambient IR System G12 PS st State of PS System These channels help indicate what mode the sensor is in during each of their respective measurements. The four possible modes are as follows: Low Light, High Sensitivity, High Signal, and Sunlight. These modes are numbered from zero to three. For more information about each mode, please consult the data sheet. G13 PS1bl PB Baseline Levels G14 PS2bl G15 N/A G16 N/a AutoRanging uses baselining to determine the nodetect threshold for readings. Any readings below the values shown on these channels will be considered no-detect readings. Any values higher than this baseline will be shown in the AutoRanging PS Outputs above. Unused The unused channels are not in use by software, but they are available in firmware to use as needed. Rev. 0.3 5 Si1142 Infrared Slider Demo Kit 4.1.2. Gesture Sensing In addition to infrared and ambient light measurements and distance calculations, the example firmware contains algorithms for gesture recognition. When connected to the board with the Performance Analysis Tool, a group window will appear, as shown in Figure 5. When a gesture is recognized by firmware, the gesture name and parameter information will be added to the top of the 2D Gesture group. Three gestures are supported by the example code. The parameters for each gesture are listed in Table 2. Figure 5. Performance Analysis Tool Group Window Table 2. Recognized Gestures 6 Gesture Name Parameter Parameter Range Description of Action and LED Indication Pause Position 1-8 (LED position) Hold hand steady in a single position above the board for 3/4 second. Current position LED will blink briefly. Swipe Left Speed 1-18 (Slow to Fast) Move hand rapidly from the right side to the left side of the board. LEDs will briefly indicate a leftward sweep pattern. Swipe Right Speed 1-18 (Slow to Fast) Move hand rapidly from the left side to the right side of the board. LEDs will briefly indicate a rightward sweep pattern. Rev. 0.3 Si1142 Infrared Slider Demo Kit 4.2. Si114x Programmer's Toolkit 4.2.1. Software API The Si114x Programmer's Toolkit API enables rapid development of Si114x software in a PC environment using the Si1142 Slider Demo Board. By emulating an I2C interface over USB, the Si114x Programmer's Toolkit API allows source code to be developed on a PC and then migrated quickly and easily to an MCU environment once target hardware is available. Either commercially-available or free PC-based C compilers can be used for software development with the Si114x Programmer's Toolkit API. The Si114x Programmer's Toolkit API also includes the Si114x Waveform Viewer Application. This tool runs in conjunction with user applications to display and debug the measurements taken from the Si1142 Slider Demo Board. Note: The Performance Analysis Tool, Si114x Programmer's Toolkit and IDE cannot connect to the Si1142 Slider Demo Board at the same time. Be certain to disconnect from the board in one software package before trying to connect in the other. 4.2.2. Command Line Utilities For evaluation of the Si1142 Slider Demo Board without the need to develop and compile source code, a flexible set of command line utilities is also provided with the Si114x Programmer's Toolkit. These utilities can be used to configure and read samples from the Si1142 Slider Demo Board. For automated configuration and scripting, the command line utilities can be embedded into .bat files. 4.2.3. Sample Source Code For faster application development, the Si114x Programmer's Toolkit contains example source code for the Si1142 Slider Demo Board and for each of the command line utilities. Developers can get started quickly by using the Si114x example source code and then tailoring it to their needs. 4.2.4. Downloading the Si114xe Programmer's Toolkit The Si114x Programmer's Toolkit and associated documentation is available from the web at the following URL: http://www.silabs.com/products/sensors/pages/optical-sensor-software.aspx. Rev. 0.3 7 Si1142 Infrared Slider Demo Kit 4.3. Silicon Laboratories IDE The Silicon Laboratories IDE integrates a source-code editor, a source-level debugger, and an in-system Flash programmer. This tool can be used to develop and debug code for the C8051F800 MCU, which is included on the Si1142 Slider Demo Board. The use of several third-party compilers and assemblers is supported by the IDE. 4.3.1. IDE System Requirements The Silicon Laboratories IDE requirements are: Pentium-class host PC running Microsoft Windows 2000 or newer One available USB port 4.3.2. Third Party Toolsets The Silicon Laboratories IDE has native support for many 8051 compilers. The full list of natively-supported tools is as follows: Keil IAR Raisonance Tasking SDCC 4.3.3. Downloading the Example Firmware Image Source code that has been developed and compiled for the C8051F800 MCU on the Si1142 Slider Demo Board may be downloaded to the board using the Silicon Laboratories IDE. Follow the instructions below to update or refresh the .HEX image in the Si1142 Slider Demo Board. 1. Connect the Si1142 Slider Demo Board to the PC using a USB cable. 2. Launch the Silicon Labs IDE, and click on Options->Connection Options. 3. Select "USB Debug Adapter", and then select the board from the list (it should show up as "TS" followed by a serial number). 4. Select "C2" as the debug interface, and press "OK". 5. Connect to the board by pressing the "Connect" icon, or using the keyboard shortcut Alt+C. 6. Click on the "Download" icon, or use the keyboard shortcut Alt+D. 7. In the download dialog window, click "Browse". 8. Change to Files of Type "Intel Hex (*.hex)" and then browse to select the file. 9. Click "Open" then "Download". 10. To run the new image, either press "Run" or "Disconnect" in the IDE. Note: The Performance Analysis Tool, Si114x Programmer's Toolkit, and the IDE cannot connect to the Si1142 Slider Demo Board at the same time. Be certain to disconnect from the board in one software package before trying to connect in the other. 8 Rev. 0.3 Si1142 Infrared Slider Demo Kit Figure 6. Si1142 Slider Demo Board Schematic 5. Schematic Rev. 0.3 9 Si1142 Infrared Slider Demo Kit DOCUMENT CHANGE LIST Revision 0.2 to Revision 0.3 Replaced QuickSense Studio references and instructions with Si114x Programmer's Toolkit. 10 Rev. 0.3 Smart. Connected. Energy-Friendly. Products Quality Support and Community www.silabs.com/products www.silabs.com/quality community.silabs.com Disclaimer Silicon Laboratories intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or intending to use the Silicon Laboratories products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Laboratories reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. Silicon Laboratories shall have no liability for the consequences of use of the information supplied herein. This document does not imply or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products are not designed or authorized to be used within any Life Support System without the specific written consent of Silicon Laboratories. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal injury or death. Silicon Laboratories products are not designed or authorized for military applications. Silicon Laboratories products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons. Trademark Information Silicon Laboratories Inc.(R) , Silicon Laboratories(R), Silicon Labs(R), SiLabs(R) and the Silicon Labs logo(R), Bluegiga(R), Bluegiga Logo(R), Clockbuilder(R), CMEMS(R), DSPLL(R), EFM(R), EFM32(R), EFR, Ember(R), Energy Micro, Energy Micro logo and combinations thereof, "the world's most energy friendly microcontrollers", Ember(R), EZLink(R), EZRadio(R), EZRadioPRO(R), Gecko(R), ISOmodem(R), Precision32(R), ProSLIC(R), Simplicity Studio(R), SiPHY(R), Telegesis, the Telegesis Logo(R), USBXpress(R) and others are trademarks or registered trademarks of Silicon Laboratories Inc. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand names mentioned herein are trademarks of their respective holders. Silicon Laboratories Inc. 400 West Cesar Chavez Austin, TX 78701 USA http://www.silabs.com