{"id":193,"date":"2011-01-08T23:20:45","date_gmt":"2011-01-08T21:20:45","guid":{"rendered":"http:\/\/blog.chschmid.com\/?page_id=193"},"modified":"2013-08-25T13:58:19","modified_gmt":"2013-08-25T11:58:19","slug":"chronos-chschmid-com","status":"publish","type":"page","link":"https:\/\/blog.chschmid.com\/?page_id=193","title":{"rendered":"chronos.chschmid.com"},"content":{"rendered":"<h1 style=\"text-align: center; margin-top: 0px;\">chronos.chschmid.com<\/h1>\n<p>I use my <a href=\"http:\/\/www.ti.com\/chronos\" target=\"_blank\">TI chronos watch<\/a> to control my bedroom light. This site contains information on how the whole thing evolved and how it works. To get a rough idea about the project you might want to watch the short video below.<\/p>\n<p style=\"text-align: center;\"><object width=\"425\" height=\"344\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0\"><param name=\"allowFullScreen\" value=\"true\" \/><param name=\"allowscriptaccess\" value=\"always\" \/><param name=\"src\" value=\"http:\/\/www.youtube.com\/v\/UGeru-bNizE?hl=en&amp;fs=1\" \/><param name=\"allowfullscreen\" value=\"true\" \/><\/object><\/p>\n<h2>Table of Contents<\/h2>\n<p><a href=\"#intro\">1. Introduction<\/a><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#story\">1.1 The Story Behind the Project<\/a><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#hardware\">1.2 The Hardware<\/a><br \/>\n<a href=\"#comm\">2. Reverse Engineering the Communication<\/a><br \/>\n<a href=\"#smartrf\">3. TI SmartRF Studio<\/a><br \/>\n<a href=\"#ccode\">4. Code Composer Studio: C Code<\/a><br \/>\n<a href=\"#feedback\">5. I want to hear from you!<\/a><\/p>\n<h2 id=\"intro\">1. Introduction<\/h2>\n<h3 id=\"story\">1.1 The Story Behind the Project<\/h3>\n<p>I installed a dimmer in my bedroom about a year ago. It comes with a remote control that allows you to switch the light on and off, as well as to dim the light. About two month ago ordered the TI chronos.<\/p>\n<p>Hey wait a minute: They both operate at 868 MHz. So it should be possible to make the TI chronos control the dimmer. Well, the idea was born, now it was time to knuckle down ;)<\/p>\n<h3 id=\"hardware\">1.2 The Hardware<\/h3>\n<p>This project combines<\/p>\n<ul>\n<li>the TI chronos (<a href=\"http:\/\/www.ti.com\/chronos\" target=\"_blank\">http:\/\/www.ti.com\/chronos<\/a>)<\/li>\n<li>and a dimmer from Conrad Electronics \/<a href=\"http:\/\/www.conrad.at\/ce\/de\/product\/620587\/Funk-Lichtschalter-mit-Sender\" target=\"_blank\">http:\/\/www.conrad.at\/ce\/de\/product\/620587\/Funk-Lichtschalter-mit-Sender<\/a>).<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/620087_LB_03_FB.EPS_250.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-229  aligncenter\" title=\"Switch\" alt=\"\" src=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/620087_LB_03_FB.EPS_250.jpg\" width=\"250\" height=\"250\" srcset=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/620087_LB_03_FB.EPS_250.jpg 250w, https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/620087_LB_03_FB.EPS_250-150x150.jpg 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>The TI chronos comes with a very detailed documentation and also Conrad even provides a schematics for the dimmer (Click links below).<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/SLAU292a.pdf\" target=\"_blank\">TI chronos user&#8217;s guide<\/a><\/li>\n<li><a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/620587-an-02-ml-FUNKLICHTSCHALTER_SENDER_de_en_fr_nl.pdf\" target=\"_blank\">Dimmer user&#8217;s guide<\/a><\/li>\n<li><a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/620587-sp-01-en-K_LICHTSCHALTER_MIT_SENDER.pdf\" target=\"_blank\">Dimmer schematics<\/a><\/li>\n<\/ul>\n<p>The dimmer comes with a remote control which allows to switch light on and off. If the button on the remote is held down, instead of pressed just once, the brightness can be adjusted.<\/p>\n<h2 id=\"comm\">2. Reverse Engineering the Communication<\/h2>\n<p>The goal is to emulate the signals sent by the remote control with the TI chronos watch. Therefore the first step is to characterize the RF signal transmitted by the remote control. The problem can be tackle using two approaches. One can either try and understand the schematics provided above or one can perform measurements. The schematic has one flaw, that is it does not describe the RF module, so no information about the modulation scheme, packet format and so on.<\/p>\n<p>Thus I went with the measurements first. A session at the spectrum analyzer and a 10 GS\/s oscilloscope soon showed the commands are sent using OOK (On\/Off shift keying) at a carrier frequency of 868.35 MHz. The signal that goes into the RF module simply turns an SAW oscillator on and off. The chip that is used to generate the transmit data is a HT12E encoder (<a href=\"http:\/\/www.holtek.com\/english\/docum\/consumer\/2_12e.htm\">http:\/\/www.holtek.com\/english\/docum\/consumer\/2_12e.htm<\/a>). As long as the button is pressed the encoder generates a signal that is repeated periodically. The following figures show the signal as measured with an oscilloscope.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/plots.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-230  aligncenter\" title=\"Plots\" alt=\"\" src=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/plots.jpg\" width=\"491\" height=\"525\" srcset=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/plots.jpg 491w, https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/plots-280x300.jpg 280w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/a><\/p>\n<p>It turned out that a minimum of 6 code cycles are required for the dimmer to switch the light on and off. If more code cycles are transmitted the brightness starts to change.<\/p>\n<p>The exact code generated by the encoder is hardwired into the remote control by soldering, as can be seen below (click to enlarge).<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/remote.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-424\" title=\"The Remote\" alt=\"\" src=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/remote.jpg\" width=\"500\" height=\"642\" srcset=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/remote.jpg 500w, https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/remote-233x300.jpg 233w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>The last four bits are always zero but the first eight bits are set by soldering at the encoder&#8217;s pins. The encoder prepends a zero and then generates a stream of three bits for every single input bit (a total of 3+8*3+4*3=39 bits) which are then transmitted by the TX module (see oscilloscope plots above and, which matches the code of the remote in the photo). I now even have two dimmers in my\u00a0apartment, no measurements were required for the second dimmer, as the code can be read from the soldering.<\/p>\n<p><a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/TI-Chronos-+-Conrad-Dimmer.zip\" target=\"_blank\">Click here<\/a> to download a zip file that contains measurement data and MATLAB code to extract the data to be sent by the TI chronos. Simply run &#8220;runDataExtraction.m&#8221;. &#8220;runEncodeData.m&#8221; will produce the hex code for a given solder mask.<\/p>\n<h2 id=\"smartrf\">3. TI SmartRF Studio<\/h2>\n<p>Now it is time to test the code obtained from <a href=\"#comm\">2. Reverse Engineering the Communication<\/a> with the TI chronos to see weather it works or not. I just connected the chronos to the computer via the debug interface and started TI SmartRF Studio (<a href=\"http:\/\/focus.ti.com\/docs\/toolsw\/folders\/print\/smartrftm-studio.html\" target=\"_blank\">http:\/\/focus.ti.com\/docs\/toolsw\/folders\/print\/smartrftm-studio.html<\/a>)<\/p>\n<p>First I used the &#8220;Packet TX&#8221; mode, after adjusting all the required RF settings suddenly, like magic, the light turned on and off. In a next step I tried the &#8220;RF Device Commands&#8221; mode. This is a little bit trickier, you have to set all the strobes yourself. At first it did not work as I never used the FSCAL strob, but then I found the following routine to be working:<\/p>\n<p>1. Initialize register settings: Press &#8220;Pkt TX&#8221; button<br \/>\n2. Set the RF parameters to your requirements, in my case (click to enlarge):<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/rfstudio.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-345\" title=\"SmartRF Studio 7\" alt=\"SmartRF Studio 7\" src=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/rfstudio-297x300.jpg\" width=\"297\" height=\"300\" srcset=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/rfstudio-297x300.jpg 297w, https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/rfstudio.jpg 959w\" sizes=\"auto, (max-width: 297px) 100vw, 297px\" \/><\/a><\/p>\n<p>3. Write TX FIFO (Write data to TX FIFO)<br \/>\n4. SCAL Strobe (Calibrate PLL)<br \/>\n5. STX Strobe (Transmit the command)<\/p>\n<p>Tada, the light goes on or off every time STX strobe is set. After the first run, you can skip 1 and 2, just loop 3-4. Now it was time to export the register settings for the C code to be implemented in <a href=\"#ccode\">4. Code Composer Studio: C Code<\/a>, so I enabled the register view and used the &#8220;Register Export&#8221; feature. Which format works best for you depends on how you write your C program.<\/p>\n<h2 id=\"ccode\">4. Code Composer Studio: C Code<\/h2>\n<p>What can I say, here&#8217;s the complete source code: <a href=\"https:\/\/blog.chschmid.com\/wp-content\/uploads\/2011\/01\/cS_Sports_Watch.zip\" target=\"_blank\">download source code<\/a>.<\/p>\n<p>First of all, what are the changes from a user point of view: Compared to the original software there&#8217;s not much of a change, only two things: The primary first (L1) and second line (L2) modules (the ones that show the time and the date) loose their secondary view mode. So the up and down keys will no longer show the seconds or the year. But come on: Who needs to know what year it is, or the exact second. Instead these buttons will cause the two codes for my two dimmers to be transmitted.<\/p>\n<p>Now to the code point of view: The two new files are cSLight.c and cSLight.c. Actually they implement another L2 mode. But I did not activate it, as modifying the buttons for the two main L1 and L2 modes seemed a better idea. Besides the obvious things needed to implement the L2 mode and to modify the main L2 and L2 modes I changed the Strobe function in rf1a.c. I don&#8217;t know if it is actually needed, but I found more recent CC430 rf1a code on the TI website, which actually seemed more reasonable &#8211; so I replaced the function that comes with the chronos.<\/p>\n<p>Well. That&#8217;s all for now, just one more thing:<\/p>\n<h2 id=\"feedback\">5. I want to hear from you!<\/h2>\n<p>Please let me know what you think about it, just use the comment box below! And check back later for more information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>chronos.chschmid.com I use my TI chronos watch to control my bedroom light. This site contains information on how the whole thing evolved and how it works. To get a rough idea about the project you might want to watch the short video below. Table of Contents 1. Introduction &nbsp;&nbsp;&nbsp;&nbsp;1.1 The Story Behind the Project &nbsp;&nbsp;&nbsp;&nbsp;1.2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-193","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P15PpI-37","_links":{"self":[{"href":"https:\/\/blog.chschmid.com\/index.php?rest_route=\/wp\/v2\/pages\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chschmid.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.chschmid.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chschmid.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chschmid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=193"}],"version-history":[{"count":62,"href":"https:\/\/blog.chschmid.com\/index.php?rest_route=\/wp\/v2\/pages\/193\/revisions"}],"predecessor-version":[{"id":1179,"href":"https:\/\/blog.chschmid.com\/index.php?rest_route=\/wp\/v2\/pages\/193\/revisions\/1179"}],"wp:attachment":[{"href":"https:\/\/blog.chschmid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}