The Making of Haraldbaumgartner.comThe Making of Haraldbaumgartner.com Being creative is about building stuff and it's even more challenging and fun when it involves building something for an artist like Harald Baumgartner. Yesterday we finished working on his website www.haraldbaumgartner.com....

Read more

ACT(A) now!ACT(A) now! Everybody is talking about it right now, and I'd like to share a personal story about something that has happened to me recently. But first of all the video: So here's my story: I love doing "DIY"...

Read more

A Truely Magical TimeA Truely Magical Time Every year on Advent Sunday, one of the most magical times in the year gets kick off. And it gets kicked off properly. We have this wonderful market where all the groups from my village, such as the firefighters,...

Read more

ClutterClutter In radar systems the term clutter refers to unwanted components in a radar signal that usually come from unwanted reflections. Say, if you want to track a ship reflections from the sea or from rain are...

Read more

A Sad CertaintyA Sad Certainty So I had this setup where I would get these occasional top-news messages from CNN. Like ten years ago, on the first day of my last year of high school, the phone would not stop ringing until the last byte...

Read more

twitter

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
1.1 The Story Behind the Project
1.2 The Hardware
2. Reverse Engineering the Communication
3. TI SmartRF Studio
4. Code Composer Studio: C Code
5. I want to hear from you!

1. Introduction

1.1 The Story Behind the Project

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.

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 ;)

1.2 The Hardware

This project combines

The TI chronos comes with a very detailed documentation and also Conrad even provides a schematics for the dimmer (Click links below).

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.

2. Reverse Engineering the Communication

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.

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 (http://www.holtek.com/english/docum/consumer/2_12e.htm). 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.

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.

The exact code generated by the encoder is hardwired into the remote control by soldering, as can be seen below (click to enlarge).

The last four bits are always zero but the first eight bits are set by soldering at the encoder’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 apartment, no measurements were required for the second dimmer, as the code can be read from the soldering.

Click here 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 “runDataExtraction.m”. “runEncodeData.m” will produce the hex code for a given solder mask.

3. TI SmartRF Studio

Now it is time to test the code obtained from 2. Reverse Engineering the Communication 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 (http://focus.ti.com/docs/toolsw/folders/print/smartrftm-studio.html)

First I used the “Packet TX” mode, after adjusting all the required RF settings suddenly, like magic, the light turned on and off. In a next step I tried the “RF Device Commands” 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:

1. Initialize register settings: Press “Pkt TX” button
2. Set the RF parameters to your requirements, in my case (click to enlarge):

SmartRF Studio 7

3. Write TX FIFO (Write data to TX FIFO)
4. SCAL Strobe (Calibrate PLL)
5. STX Strobe (Transmit the command)

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 4. Code Composer Studio: C Code, so I enabled the register view and used the “Register Export” feature. Which format works best for you depends on how you write your C program.

4. Code Composer Studio: C Code

What can I say, here’s the complete source code: download source code.

First of all, what are the changes from a user point of view: Compared to the original software there’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.

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’t know if it is actually needed, but I found more recent CC430 rf1a code on the TI website, which actually seemed more reasonable – so I replaced the function that comes with the chronos.

Well. That’s all for now, just one more thing:

5. I want to hear from you!

Please let me know what you think about it, just use the comment box below! And check back later for more information.

Comments (27)

Hello! very interesting your project. I want to do the same project in my house. Can you put the C code from CCS, or send it to me on email. Thanks in advance

Cool! Just what I was looking for! Thank for you description of you work. Are you willing share the source code? Have place an order for a chronos now!

very impressive. I’m trying to make a transmitter key fob talk to my watch and could really use some advice on how to actually get that to work. i’m having real trouble.

Hello,

I really like this idea and wanna implement it myself. Can you please share the source code…

Thanks

Hi,
i think the idea of your project is great. could you please send me the source code per mail. It doesn’t work with your code yet.

Thanks

very interesting your project. I want to do the same project in my house. Can you put the C code from CCS, or send it to me on email. Thanks in advance

sorry, another question
this project works only with dimmer from conrad or may be of another mark?

Thats an excellent job well done.I am trying the same thing with my chronos watch but even though i do have my x10 receiver code i cant set up the right registers about the sync bit.Can you please Upload an image about the RF settings?Thank you very much.

Sorry for the delay, a SmartRF Studio 7 screenshot is posted above now. The exact hex register settings can be found in “cSLight.c”, which is part of the source code

Awesome..

Can you email me a pic of the RF parameters..

Sorry for the delay, a SmartRF Studio 7 screenshot is posted above now. The exact hex register settings can be found in “cSLight.c”, which is part of the source code.

this is great project.
Thanks for sharing.
I’m about to receive my chronos and to start programming as well … so all examples are welcome. Your’s is very interresting ! (and’s got a good approach).
Rgds !

Thank you! What did you do with your chronos? Would love to hear about your project!

Can this work with 2 chronos watches paring with each other?

You can of course have two chronos watches or more that act as remote controls. It’s like with TV remote controls, however if both try to send a command things will get messy. Is that what you mean by paring with each other?

is it possible to make the two watches communicate with each other?

Sure! It is totally possible that two watches communicate with each other! You can either do it the hard way (= your own protocol) or you can do it using Ti’s protocol, or some zigbee stack, or …

Good morning :D
Dear Mr. Schmid,
in Part 2 you wrote: …I now even have two dimmers in my apartment, no measurements were required for the second dimmer, as the code can be read from the soldering.

Now my question:
Is it a hex-value, a bit-value or a decimal value which is on the soldering?

for example your bitcode in sample 1. Is there a decimal Code like 80953053769 on the soldering-board or a hex Code like 12D92D9249 ?

Greetings Mr. Fischbeck

I have added additional information on how to extract the code from the remote PCB soldering. Hope you enjoy playing around with your chronos!

Greetings Christian

Thank you very much :) If I had read the documentation for the HT12E better, than I had seen this info earlier :)

greetings Fischbeck

Hey Awesome work!!
so far the best chronos reverse engineering stuff.

i really dont like the idea of having an intermediate “PC” in projects, ur idea of watch talking to devices directly is what i was looking for. infact before buying the watch i assumed this could be done very easily.

i bought a 433 MHz as in India i get a lot of RF transmitters and recievers using that RF range. but i am lost as its not so easy for me to understand the Rf communication ez430 is using, just wish if experts like you can write some library for easily sending RF commands using ez430 {prefrebly 433Mhz} :)

btw thanks again cool idea :)

Also can you please suggest what changes should i make in RF parameters for my watch 433 Mhz
{to replicate a 433MHz RF transmitter with HT12E encoder}

Enlarge the TI SmartRF Studio screen shot above, make sure all settings in the “RF parameter” area are the same as in the screen shot (apart from the base frequency, which is somewhere around 433 MHz for you, depending on the RF module)

That should give you the correct seetings for the emulating an HT12E encoder with a 433 MHz ASK/OOK RF module.

Thanks for your comment.
I think that “writing some library for easy RF” is neither a good idea nor necessary. To be frank, with the integrated MSP430 + transceiver + the TI’s RF studio + the source code it is as easy as it gets

The thing is the transceiver is so highly configurable that you can do almost everything that is using 868 or 433 MHz in your case. Because of the many parameters that you can choose the library approach, you would need a really really large library to cover all possible cases of use (ASK, PSK, packet mode, zigbee, …)

Using TI’s SmartRF Studio for testing and for generating the register settings + using the C libraries that come with the watch works fine.

Thank you for replying.. after researching on various datasheets / RF studio realized that really what you have provided should actually suffice all the needs. :)

btw there is another discovery i have made to add more trouble to my chronos research life.. i had actually replaced all HT12E encoders i used few years ago for “complete home automation project via bluetooth / sms” with HT640 as it has 8 bit data unlike ht12e which has only 4 bit data.

so it all starts again… wish i had an oscilloscope.. by looking at the ht12E and ht640 datasheets i have figured out what data i should send, but modulation frequency is the tricky part, as there is no formula provided for “fosc” based on resistor used and i dont have an oscilloscope :)

so either i ll have to replicate standard values of resistor / VDD as mentioned in HT640 datasheet or i need to switch back to low data bits HT12E currently sticking on to HT640 lets see..

just in case if u manage to have a look at HT640 datasheet and have spare time to discuss please drop a mail :)

btw based on ht12E datasheet findings:
i think the pcb soldered values you provided are inverted or am i missing something here..

SYN == first bit always 1 for sync purpose
ADD == Adddress bits 12 for HT12E
DAT == Data bits 4 for HT12E
001 001 011 011 001 001 011 011 001 001 001 001 001 (from oscilloscope data)
SYN ADD ADD ADD ADD ADD ADD ADD ADD DAT DAT DAT DAT (HT12E datasheet)
1 1 0 0 1 1 0 0 1 1 1 1 1 actual values (HT12E datasheet)
0 0 1 1 0 0 1 1 0 0 0 0 0 Christian

firstly sorry to flood your blog with my comments :) ur the only person who can save me :)
hey based on the graph in datasheet of the decoder HT648L i figured out Fosc == 200kHz for resistor i had used earlier 150kOhm, also there is a frequency division happening internally Fosc / 33 and 1 address/data bit uses 3 cycles of Fosc / 33
now i have data but i really donot know how to proceed further… as it looks quite different from HT12E.. :( so i think now i have to determine how can i replicate the modulation frequency using acuurate number of bits /cycles to represent data :)

hello again… okay i think i am too close to what i want just that… i am missing just one key… i just wanted to know how you arrived[calculated] the Data Rate 1.599312 kBaud and what was the Resistor (Rosc) used in the HT12E / Decoder.

Post a comment