{"id":459,"date":"2013-06-03T23:32:43","date_gmt":"2013-06-03T22:32:43","guid":{"rendered":"http:\/\/users.ecs.soton.ac.uk\/sxn\/blog\/?page_id=459"},"modified":"2018-10-10T15:13:42","modified_gmt":"2018-10-10T14:13:42","slug":"zigbee","status":"publish","type":"page","link":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/resources\/zigbee\/","title":{"rendered":"Zigbee"},"content":{"rendered":"<h3>Hardwares required<\/h3>\n<ol>\n<li><a href=\"http:\/\/www.technobotsonline.com\/xbee-explorer-usb.html\">USB-to-ZigBee device<\/a><\/li>\n<li><a href=\"http:\/\/www.technobotsonline.com\/xbee-2mw-chip-antenna-series-2-zb.html\">ZigBee Antenna module<\/a><\/li>\n<li><a href=\"http:\/\/www.2k1.co.uk\/products\/productdesc.php?pid=210f760a89db30aa72ca258a3483cc7f\">ZigBee Sensor <\/a><\/li>\n<li><a href=\"https:\/\/play.google.com\/store\/devices\/details?id=nexus_7_32gb\">Google Nexus tablet with Android 4.1<\/a><\/li>\n<\/ol>\n<h3>XBee sensor configuration<\/h3>\n<p>The XBee sensor cannot be configured directly. Instead, it needs to be set up over-the-air via Zigbee (using API frame instead of traditional AT commands &#8211; more detail next).<br \/>\nFirst, the XBee ZB chip needs to be configured as a &#8220;Coordinator&#8221;. It can be done using Digi&#8217;s X-CTU tool:<br \/>\nhttp:\/\/www.digi.com\/support\/productdetail?pid=3352&#038;osvid=57&#038;type=utilities<br \/>\nI installed X-CTU to a Windows XP laptop for this setup. On X-CTU &#8211; select &#8220;ZIGBEE COORDINATOR API&#8221; under &#8220;Modem Configuration&#8221;.<br \/>\nNext, we downloaded the 2CA7 patch for the XBee sensor from the Digi support forum thread. Get it <a href=\"https:\/\/secure.ecs.soton.ac.uk\/notes\/sxn\/msc\/xbee\/82003195_A.zip\">here<\/a>.<br \/>\n(Note: It appears that Digi has not updated their tool to include the latest firmwares for the XBee sensors, and so without this patch, the XBee sensor&#8217;s configuration will not be recognized by X-CTU)<br \/>\nExtract the files from the patch, go under folder &#8220;xbee_zb&#8221;, open &#8220;XB24-ZB_2CA7.mxi&#8221;, and add the following line under &#8220;[Sleep Modes]&#8221; section:<br \/>\n[IR][0][Periodic sampling][E;0x1-0xFFFE ;x 1 ms][0: disable periodic sampling. Otherwise, x 1ms.]<br \/>\nOn X-CTU &#8211; go to &#8220;Download new versions&#8221; under &#8220;Modem Configuration&#8221;, update source via &#8220;File&#8221; and select the 2CA7 patch. Then, go to &#8220;Remote Configuration&#8221;, discover the XBee sensor under the Coordinator &#8211; the XBee sensor should have\/assign the function set &#8220;END DEVICE &#8211; LTH&#8221;. By default, the XBee sensor runs in passive mode &#8211; returns data only if polled.<br \/>\nFrom trials-and-errors, we found the following settings to allow it to transmit data periodically:<br \/>\n&#8211; &#8220;Sleep modes&#8221;<br \/>\n&#8212; SP = 100<br \/>\n&#8212; SN = 10<br \/>\n&#8212; PO = 10<br \/>\n&#8212; IR = 1000<br \/>\nThe following settings enable to sensors within the XBee sensor unit:<br \/>\n&#8211; &#8220;I\/O settings&#8221;<br \/>\n&#8212; D1 = 2<br \/>\n&#8212; D2 = 2<br \/>\n&#8212; D3 = 2<br \/>\n&#8212; P1 = 3<br \/>\nOnce this is set up, the XBee sensor should be transmitting around every 10 seconds.<\/p>\n<h3>Android Device<\/h3>\n<p>On the receiving side, the Android device should be on 4.0.x or later. The XBee ZB with the USB adaptor should be recognized automatically without rooting. You can the &#8220;<strong>Slick USB 2 Serial Terminal<\/strong>&#8221; free App to test the connectivity.<\/p>\n<h3>Frame Format<\/h3>\n<p>The data is transmitted in hex, an example of the data received:<br \/>\n7E 00 18 92 00 13 A2 00 40 79 2D FB 68 68 41 01 08 80 0E 08 00 00 B8 02 74 03 54 A2<br \/>\nThe API documentation:<br \/>\nhttp:\/\/ftp1.digi.com\/support\/documentation\/90000976_M.pdf<br \/>\nQuick breakdown through trials and errors:<br \/>\n7E = Marker of beginning of API frame<br \/>\n00 18 = Size of content in this frame<br \/>\n92 = API frame code &#8211; &#8220;Data sample received&#8221; &#8211; see documentation<br \/>\n00 13 A2 00 40 79 2D FB = Originating device (XBee sensor) long address<br \/>\n68 68 = Originating device short address<br \/>\n41 = Receive option<br \/>\n01 = Number of sample<br \/>\n08 80 0E 08 00 = Related to the digital and analog I\/Os<br \/>\n00 B8 = Light data (analog line ADC1)<br \/>\n02 74 = Temperature data (ADC2)<br \/>\n03 54 = Humidity data (ADC3)<br \/>\nA2 = Checksum<\/p>\n<h3>Calculation of temperature and humidity data<\/h3>\n<p>http:\/\/forums.digi.com\/support\/forum\/viewthread_thread,10179#31172<br \/>\n(The formulas are unconfirmed and need to be verified. We also read a forum note stating that the temperature sensor was updated, so this formula may or may not be accurate)<br \/>\nTemperature:<br \/>\nTemp_C = (mVanalog &#8211; 500.0) \/ 10.0<br \/>\nmVanalog = (ADC2\/1023.0) * 1200<br \/>\ne.g. ADC2 = 02 74 =\u00a0 628 ; mVanalog = 736.7 ; Temp_C = 23.7<br \/>\nHumidity:<br \/>\nhum = (((mVanalog * 108.2 \/ 33.2) \/ 5000 &#8211; 0.16) \/ 0.0062)<br \/>\nmVanalog = (ADC3\/1023.0) * 1200<br \/>\ne.g. ADC3 = 03 54 = 852 ; mVanalog = 999.4 ; Hum = 79.3<br \/>\nLight:<br \/>\nlux = (ADC1) \/1023.0) * 1200<br \/>\ne.g.: ADC1 = 00 B8 = 184 ; Lux = 216 (0 to 1100)<\/p>\n<h3>Webpage Display<\/h3>\n<p><a href=\"http:\/\/svm-sxn-wsn-sxn.ecs.soton.ac.uk\/server\/display.html\" target=\"_blank\">http:\/\/svm-sxn-wsn-sxn.ecs.soton.ac.uk\/server\/display.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hardwares required USB-to-ZigBee device ZigBee Antenna module ZigBee Sensor Google Nexus tablet with Android 4.1 XBee sensor configuration The XBee sensor cannot be configured directly. Instead, it needs to be set up over-the-air via Zigbee (using API frame instead of traditional AT commands &#8211; more detail next). First, the XBee ZB chip needs to be [&hellip;]<\/p>\n","protected":false},"author":3109,"featured_media":0,"parent":52,"menu_order":5,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-459","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/pages\/459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/users\/3109"}],"replies":[{"embeddable":true,"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/comments?post=459"}],"version-history":[{"count":1,"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/pages\/459\/revisions"}],"predecessor-version":[{"id":1068,"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/pages\/459\/revisions\/1068"}],"up":[{"embeddable":true,"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/pages\/52"}],"wp:attachment":[{"href":"https:\/\/generic.wordpress.soton.ac.uk\/sxn\/wp-json\/wp\/v2\/media?parent=459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}