A basic remote switch example using two zigbees and a developer kit

+1

No comments posted yet

Comments

Slide 1

A basic remote switch example using two zigbees and a developer kit Telegesis ETRX357

Slide 2

Key steps Setting up a your first pan using the Telegesis terminal v3.0.1 Introduction to the S registers defining ‘output’ direction (in or out) Setting an output state and the inbuilt LED Using the dev board buttons (IRQ0, IRQ1,etc) Introduction to the inbuilt functions Sticking it together

Slide 3

Setting up a your first pan using the Telegesis terminal v3.0.1 Once you have downloaded the terminal and if need be usb driver this bit is pretty easy. The manual covers this very well. The key steps are.... Use the device manager (control panel) to find the com number. Go to file open layout and choose the r3xx Set the com port, baud rate 19200, no flow, no parity, data bits 8 then connect. The establish pan sets the attached zigbee as the coordinator. The network requires a coordinator to supervise traffic etc. This means it must remain powered up. To attach another zigbee simply power it up and wait a few minutes, it will find the PAN and join. When the Zigbee joins the PAN the terminal will tell you.

Slide 4

Introduction to the S registers The zigbee has an inbuilt operating system which you can control by manipulating the contents of several registers (memory locations). The zigbee also uses these registers to communicate with you by adjusting their contents itself. Each register has a very specific role, we will only look at a few specific ones for this task. 23,24,25,26 – can store functions which execute when the buttons (IRQs) are pressed 3b,3c – can store command lines which can be executed by some functions. 15,16,17,18,19 – control the input output ports, peripheral devices, direction, initial values and current values

Slide 5

Reading and writing the s-registers and specific bits The contents of s-registers can be adjusted using the AT commands. For the example I will look at register 3b which by default contains the text string ‘BUTTON3’. Ats3b? -To read the local 3b register Atrems:<address>,3b? - To read a remote register Ats3b=your text command here - for local writing Atrems:<address>,3b=your text command here – for remote writing Some registers use specific bits to control different things such as s18 where the 7th bit controls the output p7 which is shared with one of the onboard lights. Ats187=1 turns off the onboard red led (and the pin p7 high) this can be combined with atrems for fun.

Slide 6

defining ‘output’ direction (in or out) Registers 15, 16 and 17 need to be set correctly before you can adjust the outputs. 15 – controls configuration for our task we cant adjust the pa7 bit so we ignore this. You will need it for enabling the temp, light sensors, etc. 17- this is one of the registers that contain multiple bits to control different things. To define the pin as an output its bit needs to be set to 1 (0 for input) We are interested in bit7 so ats167=1 sets it as an output. 16- can be used to override the value in 17 if you need to change it regularly (volatile).

Slide 7

Setting an output state and the inbuilt LED S18 and s19 control the output state of the outputs. S19 is non volatile and as such isn’t wiped every time you turn the power off. It is not good to regularly change its contents so instead you change s18 which is volatile ram and overrides the value in s19. As mentioned earlier a suitable command to change this would be... ‘Ats187=1 turns off the onboard red led (and the pin p7 high) this can be combined with atrems for fun.’

Slide 8

Using the dev board buttons (IRQ0, IRQ1,etc) and inbuilt functions. Registers 23,24,25,26 can contain the pre defined functions. These functions will be activated when the corresponding IRQ (button) is pressed. Button 1 activates the function in register 23, button2 register 24, 3-25 and 4-26. These functions are not the at commands they are functions and are represented by a set of 4 hex letters. For this task we want to call a command. We can still do this by using the function 2100 which calls a single command stored in register 3b.

Slide 9

Sticking it together Now you have all the tools you need to control a remote led on a zigbee. Setup your pan Setup the configuration of the input outputs so you can turn on/off the led on the ‘light’ zigbee. Setup the contents of s3b on the ‘switch’ sigbee to include a command that will adjust the remote register on the ‘light’ zigbee to turn on the led (you can set a similar command in s3c to turn it off). Set the irq1 function (button1) register (s23) to call the command in s3b (function 2100) on the ‘switch’ zigbee. For an off switch set button2s register (s24) to call a command stored in s3c (function 2101) . Make sure s3c has a similar command to s3b on the ‘switch’ zigbee.

Tags: zigbee etrx357 light switch example

URL: