Home

Thermostat with Touch and Wireless Connectivity

image

Contents

1. Schedule Menu Press Schedule y Set Monday Press Schedule Set Sun Press Schedule Press Run Schedule Set Tuesday Quit In this menu press UP and DOWN will change the schedule temperature To change the period start time press Time and UP or DOWN button together The setting of previous day can be copied to the following day by press Copy in the beginning of the next day Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide Atmel APPLICATION NOTE 22 42201A SAM 01 2014 8 4 6 Battery Change When battery level is low the Change icon will flash and indicating the battery should be changed When battery is removed SAMA4L device enters WAIT mode In this mode the Thermostat consumes very little power and the device is powered by a backup capacitor After new batteries are installed the Thermostat restarts working automatically The time the day working status and user settings are not changed in this case so there is no need to re configure the Thermostat after changing battery 8 5 Wireless Setting Switch Simulated by SAM4L EK The following setting data are transmitted from Thermostat to wireless setting switch simulated by SAM4L EK e Set temperature e Room temperature e System mode e Fan mode The above information is transmitted periodically to wireless setting switch if
2. 852 2245 6100 Fax 49 89 3194621 Fax 81 3 6417 0370 Fax 852 2722 1369 2014 Atmel Corporation All rights reserved Rev 42201A SAM 01 2014 Atmel Atmel logo and combinations thereof AVR Enabling Unlimited Possibilities picoPower QTouch SAM BA and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries Windows is a registered trademark of Microsoft Corporation in U S and or other countries ARM and Cortex are registered trademarks of ARM Ltd Other terms and product names may be trademarks of others Disclaimer The information in this document is provided in connection with Atmel products No license express or implied by estoppel or otherwise to any intellectual property right is granted by this document or in connection with the sale of Atmel products EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTY OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE OR NON INFRINGEMENT IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT INDIRECT CONSEQUENTIAL PUNITIVE SPECIAL OR INCIDENTAL DAMAGES INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS AND PROFITS BUSINESS INTERRUPTION OR LOSS OF INFORMATION ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT EVEN IF ATME
3. Time Set hour lt lt Press Time Press Run Set minute Press Time Press Time Set day y Quit Press Run The time and day can be changed by pressing UP and DOWN button If no touch operation for 5s it quits to operation mode automatically Programming Menu Long press on MENU button for 5s in operation mode will open the programming menu Figure 8 4 shows the menu list Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide APPLICATION NOTE 21 A t mel 42201A SAM 01 2014 Figure 8 4 Programming Menu List Programming Menu Set Celsius Fahrenheit Press Menu y Set 12h 24h Press Menu y Change filter on off Press Menu Press Menu if change filter is on Press Menu if change filter is off Set change filter time Press Menu y gt Set PO P2 Press Run Quit The programming value can be changed by pressing UP and DOWN button If no touch operation for 5s it quits to operation mode automatically 8 4 5 Schedule Menu When Thermostat is in P2 mode and system is in heating or cooling enter config menu see Section 8 4 3 by pressing MENU button and then pressing Schedule will open the schedule menu Figure 8 5 Schedule Menu List
4. character mapping which makes the code simpler and thus reduce CPU working time and save power There are also other features facilitate low power design like automated characters string scrolling display automated segments display and autonomous animation etc For details refer to the device datasheet Sensor Reading Task In this reference design the following sensors and voltage are detected e Temperature sensor e Humidity sensor e Battery voltage e Ambient light sensor Among them Temperature sensor uses 0 625 Vec as reference while the others use the internal 1 0V as reference And the humidity sensor requires some seconds to be stable before reading the data Temperature sensor humidity sensor and battery voltage are read in sensor reading task prvsystemSwitchTask periodically The ambient light sensor is read in prvActiveModeTask to control the LCD backlight at runtime Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide APPLICATION NOTE 11 A t mel 42201A SAM 01 2014 Figure 4 5 Sensor Reading Task Flow prvSystemSwitchTask vTaskDelay HUM SEN SOR DELAY v v Stop ADC Stop ADC Close sensors Change to Reference Change to Reference vTaskDelay Internal 1 0V 0 625 VCC mainSW_DELAY Start ADC Start ADC Open sensor Read pe ang Read
5. sleep mode if it is not busy e NWK WakeupReq and PHY SetRxState true These two functions are called to wake up the stack e NWK Busy It s the API to check if stack is busy It is required that the stack is not busy before entering sleep mode 52 QTouch Library API Introduction QTouch Library provides the mostly used APIs in touch c There is no need to implement separate API in normal case The main APIs for QTouch buttons are as below couch Sensors Init Initialize QTouch Library and configures the sensors The CATB peripheral interrupt for QTouch button needs to be set in this function CATB is used in normal mode after this initialization function touch Sensors measure It is the API used to measure QTouch sensor and is required to be called as soon as possible e touch sensors deinit De initialize the QTouch Library It s used before the Thermostat enters sleep state Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 13 A t el 42201A SAM 01 2014 e touch sensors update time This function is required to be called periodically to update timing for QTouch Library In non RTOS system it is placed in ISR In Thermostat it is called in prvQtouchTimerTask periodically The interval is defined by the macro TOUCH MEASUREMENT PERIOD MS in touch c For more details about QTouch Library APIs refer to touch_api_sam4l h 5 3 Sensor Reading API Intr
6. Atmel APPLICATION NOTE Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide Atmel 32 bit Microcontroller Introduction This application note mainly describes the firmware architecture and the application programming interfaces API of Thermostat with Touch and Wireless Connectivity reference design hereafter the Thermostat Features e Atmel ATSAM4LC4C Microcontroller e Atmel AT86RF233 2 4GHz radio transceiver e Atmel Lightweight Mesh proprietary software stack e Atmel QTouch Capacitive Touch Support e Atmel picoPower Technology e Tickless FreeRTOS Figure 1 Thermostat with Touch and Wireless Connectivity Chapter 8 Getting Started Guide gives details about the setup and operation of the Thermostat firmware The Thermostat is based on Atmel ATSAM4LC4C microcontroller and Atmel AT86RF233 2 4GHz radio transceiver For Thermostat hardware design details refer to Atmel AT03197 42201A SAM 01 2014 For this reference design the hardware design files schematic BOM and PCB Gerber and software source code can be downloaded from Atmel website The provided hardware documentation can be used with no limitations to manufacture the reference hardware solution for the design Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 2 A t el 42201A SAM 01 2014 Table of Contents lb ENN 4 2 Development Tools rra
7. L HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice Atmel does not make any commitment to update the information contained herein Unless specifically provided otherwise Atmel products are not suitable for and shall not be used in automotive applications Atmel products are not intended authorized or warranted for use as components in applications intended to support or sustain life
8. MENU button Table 8 1 Thermostat Default Heating and Poong Pre program Schedule WELCH eye Leave For Work Return Home Go To Bed var pE E a ae y Period 4 Heating program 6 00 AM 8 00 AM 9 00 PM 10 00 PM 62F Cooling program 6 00AM 75F 8 00 AM 83F 5 00PM 75F 10 00 PM 78F Change System Fan Mode and Set Temperature In both PO and P2 operation mode the system mode can be changed by pressing SYSTEM button once as below Off gt Auto gt Heat gt Cool gt Off The fan mode can be changed by pressing FAN button once as below Auto gt On gt Auto The set temperature can be change by pressing the UP and DOWN buttons The set temperature range is 16 C 30 C In P2 mode when heating or cooling schedule is running the temperature can t be changed by UP and DOWN If change set temperature is required in this case press HOLD button and UP or DOWN button together to change the set temperature manually This will the bypass the programmed schedule and HOLD is displayed on LCD It allows you to adjust the temperature manually as needed Whatever temperature you set in HOLD will be maintained until you press Run Schedule to cancel HOLD and resume the programmed schedule Config Menu The config menu is entered by press MENU button once in operation mode Figure 8 3 shows the menu list Figure 8 3 Config Menu List Config Menu Press
9. NTC sensor humidity sensor Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 12 A t el 42201A SAM 01 2014 5 Main API Introduction The main APIs used in Thermostat will be introduced by four parts Lightweight Mesh Software Stack API QTouch Library API LCD API and Sensor reading API Note The APIs described here are focusing on application layer For complete API descriptions refer to the links mentioned in Chapter 2 for their documents 5 1 Lightweight Mesh Software Stack API As the Lightweight Mesh stack structure is not changed in FreeRTOS task similar APIs in non RTOS system are used in Thermostat The main APIs are as below e SYS Init Initialize Lightweight Mesh HAL PHY NWK layer and system timer It is called from prvSetupHardware e SYS TaskHandler It s the core API of Lightweight Mesh The PHY NWK and system timer task handlers are called in this API e NWK DataReq It s the API used to send data through Lightweight Mesh appDataConf The call back function is registered when sending data with NWK DataRea It is called when data sending is completed by Lightweight Mesh low level layer and a status code is returned To achieve low power in Lightweight Mesh the following APIs are used for sleep and wakeup e NWK SleepReq and PHY SetRxState false These two functions are called to make the stack enter
10. ature or time in different menu pages The MENU button has long press function to invoke the programming menu One buzzer beep indicates long press is recognized 8 4 Operation Manual 8 4 1 Default Setting and Display After power on the LCD backlight will be on and buzzer will beep once for 0 5 second If no touch button operation for 5s LCD backlight will be off The Thermostat default setting and display are as below 1 System setting Auto Fan setting Auto Set temperature 25 C Time 12 00 Day Tue Room temperature humidity and battery are displayed according to the actual sensor data Except after the first time power on the light sensor will used to control LCD backlight 6 If wireless connection is established the radio icon on LCD will be on ae oN By default Thermostat temperature is displayed in Celsius degree Thermostat time is displayed in 24h mode No filter change time is set The Thermostat has two operation modes PO and P2 The default operation mode is PO Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 20 A t el 42201A SAM 01 2014 8 4 2 8 4 3 8 4 4 In PO no pre programmed schedule is running The settings are done manually In P2 the pre programmed day x 4period schedule is running By default the following energy saving pre program schedule in P2 is used The P2 schedule period and time can be changed by press Schedule
11. e For the structure of Lightweight Mesh refer to Atmel AVR2130 Lightweight Mesh Developer Guide The Thermostat directory structure is shown below Figure 7 1 The Thermostat Directory Structure EI E src lg ASF Ee R common Ha boards H ag services He utils Wi cu Tr cu Ou cL ry components drivers EN ig E E hirdparty fag CMSIS ja HE I T il fm i E gtouch config gg hal 3 phy Q service SyS es E license txt ReleaseNotes txt E asf h eit le main c main_low_power c 2 H a The directory details are described below e ASF e common e boards This directory contains the various board definitions shared between multiple architectures As the Thermostat is not a standard Atmel Kit it is defined as USER_BOARD e services ASF common services e utils ASF common utilities Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 16 A t el 42201A SAM 01 2014 e sam e boards It s the board definition for sam devices And the Thermostat board details are defined user_board h and conf_board h e components Components supported by SAM Here the Thermostat LCD component is added in c42364a c and c42364 h Note that a custom made LCD glass DB16044 is used on Thermostat instead of C42364 It is enabled by define USE DB16044 e drivers ASF SAM drivers It contains the low lev
12. e A 2 QTouch Library Options Option Value scription DEF_TOUCH_QTOUCH 1 Enable QTouch normal acquisition DEF TOUCH AUTONOMOUS QTOUCH 0 Disable QTouch auto acquisition J SP PC10 SP PC11 QT SENSOR PINS SELECTED SP PC07 SP PC08 QTouch sensor pin selection SP PC12 SP PC13 QT NUM SENSOR PINS SELECTED 6 The number of sensor pins QT DISCHARGE PIN SELECTED DIS PC14 QTouch discharge pin selection QT NUM SENSORS 6 The number of sensors QT NUM ROTORS SLIDERS 0 The number of wheel and slider The other options are unchanged Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide APPLICATION NOTE 24 A t mel 42201A SAM 01 2014 Appendix B Revision History Doc Rev Date Comments 42201A 01 2014 Initial document release Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 25 A t el 42201A SAM 01 2014 Altmel Enabling Unlimited Possibilities Atmel Corporation Atmel Asia Limited Atmel Munich GmbH Atmel Japan G K 1600 Technology Drive Unit 01 5 amp 16 19F Business Campus 16F Shin Osaki Kangyo Building San Jose CA 95110 BEA Tower Millennium City 5 Parkring 4 1 6 4 Osaki Shinagawa ku USA 418 Kwun Tong Road D 85748 Garching b Munich Tokyo 141 0032 Tel 1 408 441 0311 Kwun Tong Kowloon GERMANY JAPAN Fax 1 408 487 2600 HONG KONG Tel 49 89 31970 0 Tel 81 3 6417 0300 www atmel com Tel
13. eeeeeeeeaes 15 7 Software Package Content cccccccecccseecceeeeeeeeeeeeseeeeueeseeeeeeeeaes 16 8 Getting Started Guide 2 00 0 cece cccccseeeceeeceeeceeeeceseeseeeseeeeegeeseeeeees 19 8 1 Programming the Thermostat ssscscisiaviedsicatvssisinabeceisansdsiataehecuscetesdiacsnecreeeneieis 19 8 2 Thermostat LCD COMME sce cssccd seraictsrgeneeesdetadeeda cadets cabsiltaacapeenn ene ihadadicaais ents 20 2s Mn NPEs 20 8 4 Operation MEN 20 8 4 1 Default Setting and Display rrrrnrnnnnrnrnnnrnrnnnnrnrnnnrrnrnnrrnnnnerennnnnnen 20 8 4 2 Change System Fan Mode and Set Temperature c 008 21 015 Gong MONU een ee ee ee eee eee eee 21 8 4 4 Programming Menu 2 cts cenraty cxnisict ninini inienn nE Nan n a iai 21 015 Schedule MONU sssssmsrsiiscvisnii icii enina inienn E E saarni nnsa i na 22 84 6 Battery Change ee 23 8 5 Wireless Setting Switch Simulated by SAM4L EK rrrrnrrrnnnnrrnnnnnrrnrnnerennnnnnnn 23 Appendix A Additional Information ccccccceecceeeseeeeseeeeeeeneeeeeees 24 A 1 Lightweight Mesh Configuration cccccccssececceseeeceeesecceeesesseuseessseessaaees 24 A 2 QTouch Library Gonigurahon usoupsmsenvmesreieotmber mj 24 Appendix B Revision History ccccccceeceeccecceeteeeseeceeeceeseeseeeeeeeees 25 Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 3 A t el 42201A SAM 01 2014 1 Overview T
14. el drivers of sam peripherals e utils ASF SAM utilities e thirdparty e CMSIS ARM Cortex Microcontroller Software Interface Standard folder e freertos Freertos folder e qtouch QTouch Library folder e config e application h Thermostat macro and prototype definitions e conf_board h The ASF config file of board The Thermostat board settings are placed in this file e conf_clock h The ASF config file of clock The Thermostat clock settings can be configured here e conf_adcife h e conf_ast h e conf c42364a h e conf Icdca h e conf_sleepmgr h e conf spi master h e conf uart serial h These are the config files of ASF driver service used int Thermostat e config h The config file of Lightweight Mesh Software Stack The device type and working channel are defined in this file e FreeRTOSConfig h The config file of FreeRTOS e QTouch The QTouch application layer files and QTouch config files Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 17 A t el 42201A SAM 01 2014 e stack e hal e atsam4lc4c Hardware abstraction layer of Lightweight Mesh Software Stack reuses the low level drivers from ASF e nwk Network layer of Lightweight Mesh Software Stack e phy e at86rf231 The radio PHY chip supported by the Thermostat Atmel AT86RF233 is used in Thermostat and shares the same API as Atmel AT86RF231 e services The Lightweight Mesh applicatio
15. fic occupying bandwidth e Two distinct types of nodes e Routing network address lt 0x8000 e Non routing network address gt 0x8000 e Once powered on the node is ready to send and receive data no special joining procedure is required e No child parent relationship between the nodes e Small footprint less than 8KB of Flash and 4KB of RAM for a typical application Currently the public release version of Lightweight Mesh software stack works with Atmel AVR based MCUs but given its extreme portability and low resource requirements it can be run on almost any Atmel MCU In the Thermostat Lightweight Mesh software stack runs on ATSAM4LC4C MCU The version is v1 0 1 3 4 Atmel QTouch Library Atmel QTouch Library makes it simple for developers to embed capacitive touch button slider and wheel functionality into general purpose Atmel ARM and AVR microcontroller applications It is a royalty free library providing several library files for each device and supporting different numbers of touch channel Refer to the link below to know more about Atmel QTouch Library http www atmel com products touchsolutions touchsoftware default aspx For SAMAL it includes hardware integrated capacitive touch module CATB based on QTouch technology It s even better and easier to implement touch functionality with ultra low power consumption For more information about this module refer to SAM4L datasheet Atmel AT03198 Thermostat with Touch and Wire
16. h simulated by SAM4L EK to Thermostat wirelessly an AT86RF231 radio card from RZ600 kit should be installed on SAM4L EK Refer to Atmel AVR32850 ATSAM4L EK User Guide for the setup and programming of SAM4L EK Refer to AVR600 RZ600 HW Manual for the details of AT86RF231 radio card The setup of SAM4L EK and AT86RF231 radio card is shown in Figure 8 6 Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide APPLICATION NOTE 19 A t mel 42201A SAM 01 2014 8 2 Thermostat LCD content The Thermostat displays the following contents on LCD This LCD component is added in c42364a c and c42364 h It is enabled by define USE DB16044 in application h For full segment and COM definition of LCD refer to Thermostat Hardware User Guide Figure 8 2 Thermostat LCD Room Day of Week Time Temperature Humidity na s FE danne ID a Tempature Battery min v a Up Down Indicator T Wireless Ga Temperature Hold Button Indicator Setting SYSTEM Temperature Indicator SYSTEM FAN F N MENU SCHEDULE RUN Button Indicator Button Button 8 3 QTouch Buttons There are six QTouch buttons used for user operation A valid touch and release will be indicted by short beep The SYSTEM FAN and MENU button function may change in different menu pages The current function is displayed above the button on the LCD screen The UP and DOWN buttons are used to change the numbers on screen It can be temper
17. he Thermostat with Touch and Wireless Connectivity is designed either as a replacement of the existing wired Thermostat or to be implemented in a new generation of HVAC system controlled wirelessly Thanks to Lightweight Mesh software stack several Thermostats can be used in the same wireless network and the Thermostats are portable A typical application scenario is shown in Figure 1 1 In this Lightweight Mesh network the Thermostat works as end device and the wireless receiver works as coordinator In this reference design a SAM4L EK is used to simulate the wireless receiver wireless setting switch Check the getting started guide at the end of this document for setup information Figure 1 1 Typical Thermostat Application Scenario HVAC equipment wireless receiver The Thermostat uses SAM4L MCU which offers a highly integrated device with rich embedded peripherals to simplify product design as well as BOM cost Besides the basic temperature control function the Thermostat has the following features Atmel Custom made segment LCD with backlight Ambient light sensor Humidity display Time display Day of week display 7 day x 4 period programming 2 4GHz wireless control QTouch Buttons x 6 Ultra low power Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide APPLICATION NOTE 4 42201A SAM 01 2014 2 Development Tools To download or debug the preprogrammed firmware the fol
18. less Connectivity Software User s Guide M APPLICATION NOTE 7 A t el 42201A SAM 01 2014 4 Inside the Thermostat Application In this chapter the overall Thermostat application layer structure will be introduced first And then the application tasks below will be introduced one by one e Lightweight Mesh task e QTouch task e LCD task e Sensor reading task Because both Lightweight Mesh software stack and QTouch Library are not designed for FreeRTOS on purpose their main APIs are required to run as soon as possible In Thermostat Lightweight Mesh software stack and QTouch Library have separate polling tasks 4 1 Thermostat Application Layer Structure The Thermostat has two working states active state and sleep state To save power the firmware is designed to stay in sleep state as much as possible The active state is usually triggered by finger touch on the 6 touch buttons If the finger is remaining on the button the Thermostat will continuously check the button status When a touch button is released a valid touch is detected According to the button detected the Thermostat will update the display and send data wirelessly To detect finger touch Qtouch task will wake up MCU and run at short interval To update sensor data sensor reading task will wake up MCU at long interval If no touch on the button is detected the Thermostat will go to sleep state immediately In sleep state MCU works in power save modes The firmwa
19. lowing development toolchains are needed e Atmel Studio 6 Version 6 1 2674 or above e Atmel ARM GNU Toolchain Version 4 7 3 158 GCC 4 7 3 or above e Atmel Software Framework Version 3 9 1 or above e Atmel SAM BA 2 12 for Windows with Patch 4 or above e Programming and debugging tool Atmel SAM ICE e SAM ICE Adaptor a minimized 1 27mm pitch 10 pin header adaptor for Atmel SAM ICE For more details refer to Atmel AVR2033 SAM ICE Adapter Hardware User Manual Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide Atmel APPLICATION NOTE 5 42201A SAM 01 2014 3 Firmware Architecture The Thermostat application firmware is running on FreeRTOS in tickless tick suppression mode The low level drivers and services are from Atmel Software Framework ASF The following function blocks are implemented in different tasks e Wireless communication based on Atmel Lightweight Mesh Software Stack e QTouch Capacitive Touch 6 x button detection supported by Atmel QTouch Library e LCD and backlight control e Sensor reading e Temperature sensor e Humidity sensor e Battery voltage e Ambient light sensor The firmware architecture of Thermostat is shown in Figure 3 1 Figure 3 1 Thermostat Firmware Architecture Qtouch LCD Display RF Stack _BSW task Ko JE Sensor task 3 2 Tickless FreeRTOS FreeRTOS is one of market leading real time operating system or RTOS from Real Ti
20. me Engineers Ltd It is used in every imaginable market sector from toys to aircraft navigation And it supports tickless mode from V7 4 0 It s the FreeRTOS version used in this reference design For more about low power support in FreeRTOS and Tickless Demo on SAMAL refer to the following links http www freertos org low power tickless rtos html http www freertos org Atmel SAM4L EK Low Power Tick less RTOS Demo html The same as official FreeRTOS release in this reference design the FreeRTOS tick is modified to run with SAM4L Asynchronous Timer AST in counter mode The tick is generated by AST ALARM interrupt which enables MCU wakeup from power save mode Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide Atmel APPLICATION NOTE 6 42201A SAM 01 2014 3 3 Atmel Lightweight Mesh Software Stack Atmel Lightweight Mesh is the easy to use proprietary low power wireless mesh network protocol from Atmel It is designed to work with all Atmel IEEE 802 15 4 transceivers and SoCs To find more detailed information about the Lightweight Mesh refer to http www atmel com tools lightweight mesh aspx Atmel Lightweight Mesh software stack features e Simplicity of configuration and use e Up to 65535 nodes in one network theoretical limit e Up to 65535 separate PANs on one channel e Up to 15 independent application endpoints e No dedicated node is required to start a network e No periodic service traf
21. n services OTA service is provided but it is not used in the Thermostat It can be removed from the project folder with no harm It is kept there for not breaking Lightweight Mesh Software Stack original structure e sys The Lightweight Mesh system services Note The macro defines in source file are used for Thermostat function selection and debug purpose To run the Thermostat with default features do not modify the default macro defines unless you know what they will change clearly Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide Atmel APPLICATION NOTE 18 42201A SAM 01 2014 8 1 Getting Started Guide This chapter gives a step by step guide to set up the Thermostat and run the preprogrammed firmware The Thermostat is designed to have long battery life with two AA batteries A SAM4L EK is used to simulate wireless setting switch The Thermostat system state and sensor data are displayed on SAM4L EK LCD and the error code from wireless setting switch can be fed back and displayed on Thermostat LCD Programming the Thermostat Along with this document two hex files are provided One is for the Thermostat Thermostat_SAM4L hex and the other is for wireless setting switch SAM4L EK operating with Thermostat SAM4L_ setting switch hex To program the Thermostat hex file SAM ICE adaptor mentioned in Chapter 0 is needed The steps are as below Connect SAM ICE to the SAM ICE adapter Con
22. nect SAM ICE adapter to the Thermostat programming header J1 Power the Thermostat by two AA batteries or via the USB cable Open Atmel Studio and select menu Tools gt Device Programming Choose SAM ICE for Tool ATSAM4LC4C for Device and JTAG for Interface and then click Apply button Click the Device signature Read button to check if the connection is correct Select the Memories tab and then select the pre built image from in Flash section Click Program If the pre built image is downloaded to the board message Verifying Flash OK appears aS a a a eS rn Figure 8 1 Programming the Thermostat SAM ICE 000028011295 Device Programming x Tool Device Interface Device signature Target Voltage SAM ICE v ATSAMSLC4C v Tac v Apply OxABOAO9E1 Read IIN Read Interface settings Device Tool information Erase Chip z _Erasenow Device information Flash 256KB Memories C Thermostat_SAM4L hex v Fuses V Erase Flash before programming i IV verify Flash after programming Program veiy __Read Security User Page 512bytes ba var V Erase User Page before programming i IV Verify User Page after programming Progam __verfy Read LOE Erasing device OK Programming Flash OK Verifying Flash OK gt Verifying Flash OK Close The hex file for wireless setting switch is running on SAM4L EK To connect wireless setting switc
23. no touch operation When Thermostat setting is changed by touch operation the setting data is transmitted to wireless setting switch immediately Press button PBO on SAM4L EK will flag the error icon The error icon will be shown on Thermostat after next data transmission with wireless setting switch Figure 8 6 Wireless Setting Switch Setup with SAM4L EK and RZ600 r ane p SAMAL EK F xa Boe AT86RF231 radio card Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide Atmel APPLICATION NOTE 23 42201A SAM 01 2014 Appendix A Additional Information A 1 A 2 Lightweight Mesh Configuration Table A 1 lists the Lightweight Mesh Software Stack configuration used in this reference design and this configuration can be modified in src config config h Table A 1 Lightweight Mesh Options Option value Description APP_ADDR 08001 End Device Node network address It should be gt 0x8000 for the Thermostat APP_CHANNEL 0x10 Radio transceiver channel Valid range for 2 4GHz radios is 11 26 0x0b Ox1a APP PAN ID 0x1234 Network identifier APP ENDPOINT 1 Application main data communication endpoint _NWK_BUFFERS_AMOUNT 3 Number of buffers reserved for stack operation QTouch Library Configuration Table A 2 lists the QTouch Library configuration in this reference design and these configurations can be modified in src qtouch touch_config_sam4l h Tabl
24. oduction All the sensor values are interpreted as voltage so the SAM4L ADC module is used to read these sensors in a single task prvSystemSwitchTask The main APIs for sensor reading are as below e adc disable 7 Disable ADC ADC should be disabled before change reference e init adcife Initialize ADC with ADC reference as parameter e start adc Start ADC reading on a selected ADC channel e adc get last conv value E Return ADC result of previous ADC reading e adc clear status E Clear ADC status flag manually The humidity temperature and ambient light sensors are designed to be turned on and off by firmware This design minimizes the power consumption of sensors Here are the functions to set sensor on and off e humiditySensoron Turn on the humidity sensor The humidity sensor only works at 3V so a boost IC is enabled to provide the voltage in this function e humiditySensorofet Turn off the humidity sensor e lightSensorOn and lightSensorOff Turn on off ambient light sensor e ntcSensorOn and ntcSensoroff Turn on off temperature sensor Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 14 A t el 42201A SAM 01 2014 6 Low Power Design Consideration Embedding Atmel picoPower technology the SAMA4L family is ideal for power sensitive designs In this reference design several low power features of SAM4L MCU are used e Low
25. power mode with full RAM retention The Thermostat is designed to work in low power WAIT mode as long as possible without any compromise on function and performance The MCU power consumption in WAIT mode is about 3 5uA e Power Scaling In active mode the MCU is running in Power Scaling 1 SAM4L could reach 95uA MHz in PS1 e Fast wake up When switching between low power mode and active mode the RCFAST provides lt 1 5us wakeup time e Efficient regulator mode By selecting proper regulator mode we can get optimized power efficiency on SAMAL For battery powered Thermostat switching mode BUCK is used and it provides long life time and good performance e Low power peripheral The CATB and LCDCA modules are used in Thermostat CATB is used for touch buttons and LCDCA is used for Thermostat display Both of the peripherals are designed to reduce power consumption by removing CPU load That means the peripheral handles more work without CPU involved Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 15 A t el 42201A SAM 01 2014 7 Software Package Content The application firmware is based on ASF QTouch Library and FreeRTOS have already been integrated into ASF The directory structure of the software package integrates ASF structure and Lightweight Mesh Software Stack structure For details of the structure of ASF refer to Atmel AVR4029 Atmel Software Framework User Guid
26. re block diagram of working state and sleep state are given in Figure 4 1 Figure 4 1 Application Block Diagram Active state LCD Display task Send sensor value Touch detected Update set value RF Stack task Refresh sensor value Qtouch BSW task Wake up at short interval Wake up at long interval Tickless Idle task Sleep state Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 8 A t el 42201A SAM 01 2014 42 Application Layer Task Priorities For the main application tasks their priorities are listed below from high to low e QTouch sensor timer task tskIDLE PRIORITY 3 e Lightweight Mesh data request task tskIDLE PRIORITY 3 e LCD control task tskIDLE PRIORITY 3 e QTouch task tskIDLE PRIORITY 2 e Sensor reading task tskIDLE PRIORITY I e Lightweight Mesh polling task tskIDLE PRIORITY 1 4 3 Lightweight Mesh Task The Lightweight Mesh software stack itself is designed to run state machines continuously The main API SYS TaskHandler is called as soon as possible in prvLwMesh PollingTask If there is no data to send the Lightweight Mesh stack is put into sleep state A separate task prvLwMeshTask is implemented to send data through Lightweight Mesh It sends data read from the queue xLwMeshDataQueue And Lightweight Mesh has to wake up from sleep state before sending data again Figure 4 2 Lightweight Mesh Task Flow prvL
27. rnnnrnanrnnrnannnnrnannnnrnnnnannnernannnnenunnnennernnnnnenusener 5 3 Firmware Architecture cccccccecceeesecceeeeeeseeeeeeseeseeeseeseeaeeseeeeeeneesaes 6 AEE 5 GE EN 6 3 3 Atmel Lightweight Mesh Software Stack rrrrrrnrrrnrnnrrrrnnnrrrrnnnrenrnnrrnrrnsrennnnnne T Atmel OTTO LIDrary sarriiosiiriairinin niai ria kiniad iS 7 4 Inside the Thermostat Application rranrrnnrrnnennrrnnrrnnrrnnrrnernnnrnnnnnnnnn 8 4 1 Thermostat Application Layer Structure rrrnrrrrarrrrarnrrnnnrnranrnrannnrnnnennnnrennnnen 8 4 2 Application Layer Task Priorities cccccccssccceeecseeeceeeceececeeeceueeeueeseeesaesenes 9 4 3 Lightweight Mesh Task srccssecsseseccericaaierindarvenseateencisaaaveiatesadentndesverdbeeseensasassderons 9 44 Qrlouch TASK 2 te ceewecccacnthecccncreoumecadonsteenueeetantdeasboxenecenecbtadhannssustertlendhavaaueendons 10 To CEDIA EEE EE EE eee eee eee ee 11 4 6 Sensor Reading TAS save nen 11 5 Main API Introduction onannnrnnnrvnnrrnnrnnnrnnnrnnrrnernnennnennnennnennnnennnnnnnnn 13 5 1 Lightweight Mesh Software Stack API rrrrrnnnrnnnnnnrnnrnnnnvnrnnnrnnnnnnrnnnnnnrnrnnnenn 13 5 2 QTouch Library API Introduction sxccnrscscecesceuicedinacwstcecinwsipdctiuntteestubedannuielaeidades 13 5 3 Sensor Reading API Introduction ccccssceccsseeecceseeeceeeeeecseesecseneeesseneeenes 14 6 Low Power Design Consideration cccccccececeeeeeeeeeeeeeenees
28. uch for a while the QTouch buttons are disabled and Thermostat enters sleep state For QTouch button another task prvQtouchTimerTask is required to run periodically to update the QTouch sensor status Figure 4 3 QTouch Button Task Flow prvActiveModeTask Qtouch Task pvatouchTimerTas co touch sensors measure mainQT_TIMER_DELAY ouch measure done Y touch sensors update time vTaskDelay y Get Qtouch button status No touch detected Y y Suspend Qtouch Timer Task y N vTaskDelay mainQT DETECT DELAY Resume Qtouch Timer Task Task end Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide APPLICATION NOTE 10 A t mel 42201A SAM 01 2014 4 5 4 6 LCD Task The LCD display is updated in prvLCDTask It will refresh the LCD content whenever there is data in xDisplayDataQueue The queue is written in QTouch task and sensor reading task For the LCD segment definition and menu list refer to Chapter 8 Getting Started Guide Figure 4 4 Sensor Reading Task Flow prvLCD Task LwMesh data request xQueueReceive LCD queue Update LCD N Need send data via RF Y y xQueueSend RF queue SAM4L LCD Controller LCDCA is featured with hardware blinking and ASCII
29. wMeshPolling Task prvLwMeshTask p xQueueReceive RF queue SYS TaskHandler Y Prepare to non sleep y v y Wake up stack N Sending data N NWK DataReq G N y Suspend Y LwMesh Polling Task p Task end e Atmel AT03198 Thermostat with Touch and Wireless Connectivity Software User s Guide M APPLICATION NOTE 9 A t el 42201A SAM 01 2014 4 4 In this Lightweight Mesh network Thermostat works as end device and wireless setting switch works as coordinator Thermostat sends data to wireless setting switch and the data of wireless setting switch can be sent back to Thermostat too As in non RTOS Lightweight Mesh application the same API NNK DataReq and appDataConf are used to for data sending in Thermostat To know the details of Lightweight Mesh architecture and application development process refer to Atmel AVR2130 Lightweight Mesh Developer Guide QTouch Task In this reference design six QTouch buttons are used for user input Similar to Lightweight Mesh the QTouch Library main API touch sensors measure Is Called as soon as possible in prvActiveModeTask When touch qt time measurement done touch is flagged call getButtonState to get QTouch button status The macro GET QT SENSOR STATE in this function contains the QTouch sensor status from QTouch Library QTouch buttons are enabled in Thermostat working state only If no to

Download Pdf Manuals

image

Related Search

Related Contents

CHAUFFE-SAUNA ÉLECTRIQUE : Manuel d`utilisation Vienna STS  Sony SRS-X2  HI98106 Inlab - Inlab instruments  Upstar P26EWT 23.6" Full HD Black LED TV  Samsung SC8020 คู่มือการใช้งาน  IS23x-DS Digital Stepper Motor - User Manual    Le travail corporel PEERBOOM, un chemin vers l`unité de l`être  Bissell 3910 Vacuum Cleaner User Manual  

Copyright © All rights reserved.
Failed to retrieve file