SHT31 Smart Gadget User Guide Reference Design and Development Kit for Applications with SHT3x Sensors SHT31 humidity and temperature sensor LCD display for humidity, temperature and dew point in C and F Bluetooth Low Energy (BLE) connectivity to iOS and Android smartphones iOS and Android apps available Data logging capabilities Complete hardware, firmware and software design resources available Introduction The SHT31 Smart Gadget is a reference design circuit board which demonstrates the outstanding performance and ease of use of Sensirion's humidity and temperature sensors. It not only shows humidity and temperature values on the display, but it can also communicate wirelessly with a Bluetooth Smart capable device like a smartphone. For developers, full design resources of the SHT31 Smart Gadget are available on GitHub. Development Kit Contents (c) Copyright Sensirion AG, Switzerland Smart Gadget main PCB equipped with SHT31 sensor, LCD display, push button and BLE module, including battery, supports and quick-start guide Apps for iOS and Android devices for download in respective app stores Complete design resources available on GitHub: - Hardware design (PCB layout, BOM) - Firmware code - Bluetooth profile definition - Source code for iOS and Android apps 1/11 Contents of the User Guide 1 2 Quick Start Guide Standard Operation 2.1 Assembly Instructions 2.2 Operation in Standalone Mode 2.3 Operation in Bluetooth Mode 2.4 Connecting to a Bluetooth Device 2.5 Using the Smart Gadget as a Data Logger 2.6 System Requirements 2.7 Important Security Advices 3 Extended Information for Developers 3.1 Hardware 3.1.1 Block Diagram 3.1.2 Bill of Materials 3.1.3 PCB Layout 3.2 Firmware for BLE Module 3.2.1 Debugging 3.2.2 BLE Profile Description 3.3 Firmware for LCD Driver 3.4 Software 3.4.1 iOS SmartGadget App 3.4.2 Android SmartGadget App Revision History 2 3 3 3 3 3 3 3 4 5 5 5 5 6 6 6 8 10 10 10 10 11 1 Quick Start Guide 1. Getting Started Remove battery foil Break apart supports and slide main board into slots 2. Standalone Operation RH&T values are shown on the LCD display Switch between RH and dew point by pressing the button 3. Enable Bluetooth Press switch button for >1 sec. Smart Gadget ready to pair with a Bluetooth device 4. Operation with Smart Gadget App Download iOS or Android Smart Gadget app from your app store Start the app and connect Smart Gadget with your smartphone through the app Further information: www.sensirion.com/gadget (c) Copyright Sensirion AG, Switzerland 2/11 2 Standard Operation 2.1 Assembly Instructions Take the two supports and break them apart. Slide the circuit board into the slots in the supports, with one support on each side of the LC display. Remove battery insulation foil. Optionally, the temperature can be displayed in F by pressing the switch button while inserting the battery. 2.2 Operation in Standalone Mode This is the default operating mode. The measured values are shown on the LC display. The upper line optionally shows relative humidity or dew point temperature while the lower line shows temperature. To switch between relative humidity and dew point display, briefly press the switch button. For displaying temperature values in F, press the switch button while inserting the battery. 2.3 Operation in Bluetooth Mode To enable (and disable) Bluetooth Smart mode, press the switch button for more than 1 second. When enabled, the Bluetooth symbol in the display starts blinking. The device ID is shown on the display for a short time and the SHT31 Smart Gadget is visible for master devices ("advertising mode"). In this time period, a master device running a compatible app or software can establish a connection to the SHT31 Smart Gadget. An effective connection to a master device is indicated by a constantly displayed Bluetooth symbol. If the connection to a master device is lost, the Bluetooth symbol will start blinking. Once the SmartGadget is within reach again the connection is established automatically. The battery life is improved when the Bluetooth mode is disabled. 2.4 Connecting to a Bluetooth Device To connect the Smart Gadget to a smartphone, the Smart Gadget app has to be installed on the smartphone and Bluetooth has to be enabled on the smartphone. To connect to a Smart Gadget, the corresponding Smart Gadget has to be selected in the "Settings" tab in the app. Smartphone apps can be downloaded from the corresponding app stores: iOS (Apple iTunes Store): https://itunes.apple.com/US/app/id787249829?mt=8 Android (Google Play Store): https://play.google.com/store/apps/details?id=com.sensirion.smartgadget&hl=de Please note that in order to work with the Smart Gadget, a smartphone or tablet needs to be Bluetooth 4.0 compatible. 2.5 Using the Smart Gadget as a Data Logger The Smart Gadget stores the measurement values in the built-in memory. The measurement interval can be defined through the app ("Settings"). The Smart Gadget will log measurement values even if the Bluetooth connection is terminated. The stored values can be downloaded and displayed on the smartphone via the app. 2.6 System Requirements In order for a mobile device to work with the Smart Gadget it needs to be Bluetooth 4.0 (also known as Bluetooth Low Energy, BLE or Bluetooth Smart). This is the case for the majority of Android devices starting from approximately generation 2013 and newer, Apple iPhones generation 4S and newer, and Apple iPad generation 3 and newer. (c) Copyright Sensirion AG, Switzerland 3/11 The Smart Gadget apps run with Android 4.3 or later and iOS 8 or later, respectively. 2.7 Important Security Advices Keep out of reach of children and pets (contains swallowable parts) If any part is swallowed, contact a physician immediately Battery type: CR2032 Dispose of the battery properly (special waste) Smart Gadget operating temperature range: -10 to 60 C The Smart Gadget is intended for indoor use The Smart Gadget is sensitive to electrostatic discharge (ESD) - please take precautions (c) Copyright Sensirion AG, Switzerland 4/11 3 Extended Information for Developers The SHT31 Smart Gadget is designed to be a reference design and development kit that helps developers to kick-start their own projects with an SHT3x sensor, Bluetooth module and corresponding apps. The design resources are published on Sensirion's GitHub page https://github.com/Sensirion. They include: Hardware design data (PCB layout, schematics, BOM): https://github.com/Sensirion/SmartGadget-Hardware Firmware for BLE module and LCD driver, Bluetooth profile definition: https://github.com/Sensirion/SmartGadget-Firmware Software code for iOS app: https://github.com/Sensirion/SmartGadget-iOS Software code for Android app: https://github.com/Sensirion/SmartGadget-Android 3.1 Hardware 3.1.1 Block Diagram SHT31 I2C Button IO Bluetooth Low Energy Module debug interface Debug Interface ST1 SPI debug interface LCD Driver Debug Interface ST2 LCD Display 3.1.2 Bill of Materials Component Type Qty. Designator Footprint Manufacturer RH&T SHT31 Sensor BLE Module BVMCN5103 1 Sen1 SHT3x Sensirion AG Manufacturer Part Number SHT31 1 IC2 Braveridge BVMCN5103-BK LCD driver MC9S08L L8CGT LCD 1 IC1 LCD1 Freescale Semiconductor AV Display MC9S08LL8CGT 1 BVMCN5103_Sma ll QFN50P700X70048W2L_custom LCD_1209061_A1 3.3V 1 BAT1 Switch 1 SW1 BAT-HLD-001THM EVQ-Q2P02W Linx BAT-HLD-001-THM Technologies Inc. Panasonic EVQ-Q2P02W Electronic Components LCD Display Battery Switch (c) Copyright Sensirion AG, Switzerland 1209061_A1 5/11 Component Type Qty. Designator Footprint Manufacturer Crystal 1 Q1 2SMD-ABS07 Abracon LLC Manufacturer Part Number ABS07-32.768KHZ-T 9 C1, C2, C3, C4, C5, C6, C7, C8, C23 C10, C11, C12, C13 R4, R6 C_0402 n/a n/a C_0805 n/a n/a R_0402 n/a n/a Capacitors ABS0732.768KHZT 100n, 10V/X7R Capacitors 22u, 6V3/X5R 4 Resistors 10k, 1% 3.1.3 2 PCB Layout PCB layout data including schematic, Gerber files, assembly files and bill of materials is available on GitHub: https://github.com/Sensirion/SmartGadget-Hardware 3.2 Firmware for BLE Module The firmware for the BLE module can be found on GitHub: https://github.com/Sensirion/SmartGadget-Firmware/tree/master/BLE_Module_nRF51822 3.2.1 3.2.1.1 - Debugging Required Tools IDE: Keil uVision 4 or 5 Debugger for Cortex M0 Devices (j-Link, j-Link Lite, ULINK2, ...) 3.2.1.2 Preparation Connect your debugger to the Smart Gadget debug interface ST1. (c) Copyright Sensirion AG, Switzerland 6/11 The RX/TX Pins are not used by the Debugger but can be optionally used by your own application as a serial debug interface for printf messages. Connect the signals according to your debugger pin-out. Standard pinouts for ARM Debuggers are: The 3V Pin of ST1 goes to VCC on the Debugger. 3.2.1.3 Steps to Flash/Debug BLE Module Firmware 1. Download or clone the Smart Gadget Firmware from https://github.com/Sensirion/SmartGadget-Firmware. The folder contains the firmware for the nRF51822 Bluetooth Low Energy Chip (Folder BLE_Module_nRF51822) which runs the application and the firmware for the LCD Driver (Folder LCD_Driver_MC9S08LL8). The scope lies on the nRF51822 thus the application and not on the LCD driver that basically just drives the LCD Pins. 2. Open the project file SmartHumigadget.uvproj located in the BLE_Module_nRF51822 Folder The project is made for the Keil uVision 4 but can also be opened/converted with Keil uVision 5. If the programming algorithm under target options->Utilities->Settings is missing, download and install the Nordic SDK and follow the instructions here: https://devzone.nordicsemi.com/question/2243/how-to-add-flashprogramming-algorithm/ (c) Copyright Sensirion AG, Switzerland 7/11 3. Compile the project The free 32kB licence of Keil uVision is sufficient for compilation, the project currently uses around 30kB. 4. Download to target and optionally start debugging 3.2.2 BLE Profile Description There are five services available: The Device Information Service contains information about the device, manufacturer, versions etc. The Battery Service contains a Battery Level Characteristic (Level in %). The Logger Service can optionally be used to retrieve historical sensor data. And finally there are two services, one for the humidity and one for the temperature, where the measured sensor data can be read or retrieved with notifications represented as Float32T. (c) Copyright Sensirion AG, Switzerland 8/11 There is no official profile defined by Bluetooth SIG for Temperature/Humidity sensors and the profile described here is proprietary. Besides transmitting the live values, the device always logs the sensor values and if needed, historical data can be retrieved over Bluetooth Low Energy. Device Behavior: BLE Advertising: If the button is pressed long enough (>1s) the BLE Advertising is turned on. After disconnection, the device enters again the advertising mode. The advertise packages are sent every two seconds. To turn off BLE Advertising, the button has to be pressed again for more than 1s. Connection parameters: After a connection is established, the device remains for a minute within the initial connection speed (depending on the used device). If the logger download is not started at this point, the device requests a slower connection interval (1 second) to save energy. If logged data is requested, the device requests a faster connection interval again. Logger: The logger is always running. The physical values are logged separately, whereas the available memory is shared among them. If you change the logging interval, the memory gets cleared. To retrieve the data, follow this procedure: o Subscribe for notification of the Value-Characteristics of the desired services (e.g. Humidityand/or Temperature-Characteristics) o Write your (host) current timestamp (64bit, milliseconds) into the SyncTimeMs characteristic. o Write or leave zero the OldestTimestampMs Characteristics. If left zero, all logged data is retrieved. If set to a time between now (=SyncTimeMs) and zero, all available data between these points in time is retrieved. o The host can retrieve the NewestTimestampMs, which contains the timestamp of the latest logged value calculated back from the SyncTimeMs timestamp. This characteristic gets updated only after the SyncTimeMs was written. The host can modify this value as well to retrieve only a certain block of data in the past. After modification the value is adjusted to the timestamp of the previous available measurement. o Write a non-zero value to StartLoggerDownload. The subscribed Value-Characteristics start notifying the logged values in the following notification format: i. first four bytes: sequence number starting from 0 and increasing ii. next n*four bytes: logged float32 values where n can be between one and four Every service's LoggedValues Characteristic has its own increasing sequence number. They can be distinguished by their unique handle number and the corresponding UUID. Following is a simplified visualization of the device's profile: (c) Copyright Sensirion AG, Switzerland 9/11 https://github.com/Sensirion/SmartGadget-Firmware/blob/master/Simple_BLE_Profile_Description.pdf 3.3 Firmware for LCD Driver The firmware for the LCD driver can be found on GitHub: https://github.com/Sensirion/SmartGadget-Firmware/tree/master/LCD_Driver_MC9S08LL8 3.4 Software 3.4.1 iOS SmartGadget App The software code for the Smart Gadget iOS app can be found on GitHub: https://github.com/Sensirion/SmartGadget-iOS 3.4.2 Android SmartGadget App The software code for the Smart Gadget Android app can be found on GitHub: https://github.com/Sensirion/SmartGadget-Android (c) Copyright Sensirion AG, Switzerland 10/11 Revision History Date Revision Changes 27.11.2015 1 First initial release Copyright(c) 2015 by Sensirion CMOSens(R) is a trademark of Sensirion All rights reserved Headquarters and Subsidiaries Sensirion AG Laubisruetistr. 50 CH-8712 Staefa ZH Switzerland Sensirion Inc., USA Phone: +1 805 409 4900 info_us@sensirion.com www.sensirion.com Sensirion Korea Co. Ltd. Phone: +82 31 345 0031 3 info@sensirion.co.kr www.sensirion.co.kr Phone: +41 44 306 40 00 Fax: +41 44 306 40 30 info@sensirion.com www.sensirion.com Sensirion Japan Co. Ltd. Phone: +81 3 3444 4940 info@sensirion.co.jp www.sensirion.co.jp Sensirion China Co. Ltd. Phone: +86 755 8252 1501 info@sensirion.com.cn www.sensirion.com.cn Sensirion AG (Germany) Phone: +41 44 927 11 66 info@sensirion.com www.sensirion.com To find your local representative, please visit www.sensirion.com/contact (c) Copyright Sensirion AG, Switzerland 11/11