Zigbee Question
Moderator: Benj
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Zigbee Question
Hi guys,
I have an xbee router and coordinator that have both been set up in the X-ctu app, now Is there a way of just connecting to Tx and Rx of a pic and reading what is sent somehow ?, or do I have to use the Zigbee component and set up all the information on that the same as I did in X-ctu ?
cheers
Acestu
EDIT:
This is an arduino sketch that reads the serial info from the zigbee coordinator through the chip Rx and Tx pins so how would you do this in Flowcode ?
float temp;
void setup() {
Serial.begin(9600);
};
void loop() {
if(Serial.available() >=21) {
if (Serial.read() == 0x7e) {
for (int i = 1; i < 19; i++) {
byte discardByte = Serial.read();
}
int analogMSB = Serial.read();
int analogLSB = Serial.read();
int analogReading = analogLSB + (analogMSB * 256);
temp = analogReading / 1023.0 * 1.23;
temp = temp - 0.5;
temp = temp / 0.01;
temp = temp * 9/5 + 32;
Serial.print (temp);
Serial.print (" Degrees F");
}
}
}
I have an xbee router and coordinator that have both been set up in the X-ctu app, now Is there a way of just connecting to Tx and Rx of a pic and reading what is sent somehow ?, or do I have to use the Zigbee component and set up all the information on that the same as I did in X-ctu ?
cheers
Acestu
EDIT:
This is an arduino sketch that reads the serial info from the zigbee coordinator through the chip Rx and Tx pins so how would you do this in Flowcode ?
float temp;
void setup() {
Serial.begin(9600);
};
void loop() {
if(Serial.available() >=21) {
if (Serial.read() == 0x7e) {
for (int i = 1; i < 19; i++) {
byte discardByte = Serial.read();
}
int analogMSB = Serial.read();
int analogLSB = Serial.read();
int analogReading = analogLSB + (analogMSB * 256);
temp = analogReading / 1023.0 * 1.23;
temp = temp - 0.5;
temp = temp / 0.01;
temp = temp * 9/5 + 32;
Serial.print (temp);
Serial.print (" Degrees F");
}
}
}
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Zigbee Question
Hi Stu,
The RS232 component is probably the cleanest way to get at the UART comms and should allow you to talk to the XBEE modules without having to use the full Zigbee component.
The RS232 component is probably the cleanest way to get at the UART comms and should allow you to talk to the XBEE modules without having to use the full Zigbee component.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
As far as I can make out the data frame from the xbee is 23 bytes long, 21 and 22 being the ADC data, in the youtube video the guy uses an arduino sketch to ignore the first 20 bytes and then he puts the next 2 bytes into int variables ie Msb and Lsb, my question is how would this be done in the rs232 component ?.
Thanks
acestu
As far as I can make out the data frame from the xbee is 23 bytes long, 21 and 22 being the ADC data, in the youtube video the guy uses an arduino sketch to ignore the first 20 bytes and then he puts the next 2 bytes into int variables ie Msb and Lsb, my question is how would this be done in the rs232 component ?.
Thanks
acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Zigbee Question
Hi Stu,
Should just be a case of read 23 bytes and only use the data from the bytes you need. You might need a way of finding the start of a data frame which then allows you to be sure your collecting say the 20th value when you've read 19 bytes after the frame start.
Should just be a case of read 23 bytes and only use the data from the bytes you need. You might need a way of finding the start of a data frame which then allows you to be sure your collecting say the 20th value when you've read 19 bytes after the frame start.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
The guy in the Youtube tutorial says that he makes sure that he is reading the frame from the start by adding the line " if (Serial.read() == 0x7e) { " to the sketch which is the first Byte, basically I am trying to emulate the Arduino sketch but I will be using the MSB and LSB variables to output to an LCD and not just look at them in the serial monitor window. So I need to read the frame from 0x7e and then collect bytes 21 and 22, is this possible ?.
Thanks
Acestu
The guy in the Youtube tutorial says that he makes sure that he is reading the frame from the start by adding the line " if (Serial.read() == 0x7e) { " to the sketch which is the first Byte, basically I am trying to emulate the Arduino sketch but I will be using the MSB and LSB variables to output to an LCD and not just look at them in the serial monitor window. So I need to read the frame from 0x7e and then collect bytes 21 and 22, is this possible ?.
Thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Zigbee Question
Hi Stu,
Yep this should be fairly straight forward.
Initialise the RS232 component and then go into a loop while the variable "in" is not equal to 0x7E. Inside the loop add a RS232 read byte component macro which puts the incoming value into the "in" variable.
As soon as you drop out the loop you know you have received the first byte.
Next create a loop that will run 20 times to collect bytes 1-20.
After this you can collect bytes 21 and 22 into new variables and then combine the two bytes into an int using bit shifting.
IntVar = ( MSB_byte << 8 ) | LSB_Byte
The repeat the process to collect new data, if you want me to create a quick demo in Flowcode then let me know.
Yep this should be fairly straight forward.
Initialise the RS232 component and then go into a loop while the variable "in" is not equal to 0x7E. Inside the loop add a RS232 read byte component macro which puts the incoming value into the "in" variable.
As soon as you drop out the loop you know you have received the first byte.
Next create a loop that will run 20 times to collect bytes 1-20.
After this you can collect bytes 21 and 22 into new variables and then combine the two bytes into an int using bit shifting.
IntVar = ( MSB_byte << 8 ) | LSB_Byte
The repeat the process to collect new data, if you want me to create a quick demo in Flowcode then let me know.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
That would be great if you could do a demo chart for me, its all a bit confusing
cheers
acestu
That would be great if you could do a demo chart for me, its all a bit confusing
cheers
acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 1314
- Joined: Sun Jan 15, 2012 3:15 pm
- Has thanked: 474 times
- Been thanked: 458 times
- Contact:
Re: Zigbee Question
Hi Mutley
you also need to bear in mind , that the sketch file relies on library files, so you would need to convert those over as well
Regards
Dazz
you also need to bear in mind , that the sketch file relies on library files, so you would need to convert those over as well
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hey up Dazz,
Yes mate, that's why I said how do you do it in flowcode ?, if Benj does me a demo, I will see how I go on from there.....
cheers
acestu
Yes mate, that's why I said how do you do it in flowcode ?, if Benj does me a demo, I will see how I go on from there.....
cheers
acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 1314
- Joined: Sun Jan 15, 2012 3:15 pm
- Has thanked: 474 times
- Been thanked: 458 times
- Contact:
Re: Zigbee Question
Hi Mutley
can you link to the data etc might make it easier for Benj, play your lot soon
Regards
Dazz
can you link to the data etc might make it easier for Benj, play your lot soon
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Dazz,
Sorry I thought I had, this is it:
https://www.youtube.com/watch?v=rnBx2yqKn_E
and the cheat sheet is here:
http://tunnelsup.com/tup/2012/11/30/x...
cheers
Acestu
Sorry I thought I had, this is it:
https://www.youtube.com/watch?v=rnBx2yqKn_E
and the cheat sheet is here:
http://tunnelsup.com/tup/2012/11/30/x...
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Zigbee Question
Hi Guys,
Right here is a quick example which should hopefully get you started.
Right here is a quick example which should hopefully get you started.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
I tried your chart but I just get a blank screen, I had a mess and got this:
I changed the chart to accommodate my lcd and device then downloaded to chip but the numbers are not making much sense, I also changed the chart so it would show the MSB and LSB values on the lcd.
cheers
Acestu
I tried your chart but I just get a blank screen, I had a mess and got this:
I changed the chart to accommodate my lcd and device then downloaded to chip but the numbers are not making much sense, I also changed the chart so it would show the MSB and LSB values on the lcd.
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Zigbee Question
Hello,
I've had a quick go at modifying your program so the numbers should be correct (not leaving old false values on the display) and so your floating point calculations are done via the float libraries.
Let me know how you get on.
I've had a quick go at modifying your program so the numbers should be correct (not leaving old false values on the display) and so your floating point calculations are done via the float libraries.
Let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
I downloaded the new chart and programmed the chip, as soon as the router started transmitting I got massive varied numbers on the screen, I have added a couple of pics....
thanks
Stuart
I downloaded the new chart and programmed the chip, as soon as the router started transmitting I got massive varied numbers on the screen, I have added a couple of pics....
thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
I am not sure if the numbers on the display are right ,they seem to jump extremely as in the 2 pics above, I am trying to get something similar to this:
Thanks
Stuart
I am not sure if the numbers on the display are right ,they seem to jump extremely as in the 2 pics above, I am trying to get something similar to this:
Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Zigbee Question
Hello,
In the MPC9700 chart topic you posted some demo code and it looks like their loop to throw away bytes only throws away 18 bytes. In my program I was throwing away 20. If you change the parameter to the skipbytes macro to 18 then do the numbers start to make sense?
In the MPC9700 chart topic you posted some demo code and it looks like their loop to throw away bytes only throws away 18 bytes. In my program I was throwing away 20. If you change the parameter to the skipbytes macro to 18 then do the numbers start to make sense?
for (int i = 1; i < 19; i++) {
byte discardByte = Serial.read();
}
int analogMSB = Serial.read();
int analogLSB = Serial.read();
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Zigbee Question
Hi acestu,
I'm sorry that I meddle, maybe you can order what to do:
..
..
how you managed the RF Data from the Zigbee? Which Frame TYPE do you give your Datagram?
Do you send a "REMOTE AT Command Request" 0x17 and check the Digital ID that have the TEMP Sensor connected?
Do you "wait" for a Reply for checksum?
Example: You know, which Datagramm / Frame Type you send and what Message you will get.
You can check firsttime for a "OK reply in the ckecksum".. if ok, you know how long the Message is,
and allways will give you the Temp Value at same IDX in the Datagramm back.
If You send the Remote AT Command Request without a ACK need.. the Offset 4 (Bit 5 = Frame ID ) 0x00 = no response, 0x01 resonse..
then allways not 100 procent all RF Data - because you send the Request.. and Data comes ( with or without again a ACK ? ) ...
it can be a fail in the Datagramm Data..
Have a look in the API Docu your Device
Best wishes
Rudi
I'm sorry that I meddle, maybe you can order what to do:
..
..
how you managed the RF Data from the Zigbee? Which Frame TYPE do you give your Datagram?
Do you send a "REMOTE AT Command Request" 0x17 and check the Digital ID that have the TEMP Sensor connected?
Do you "wait" for a Reply for checksum?
Example: You know, which Datagramm / Frame Type you send and what Message you will get.
You can check firsttime for a "OK reply in the ckecksum".. if ok, you know how long the Message is,
and allways will give you the Temp Value at same IDX in the Datagramm back.
If You send the Remote AT Command Request without a ACK need.. the Offset 4 (Bit 5 = Frame ID ) 0x00 = no response, 0x01 resonse..
then allways not 100 procent all RF Data - because you send the Request.. and Data comes ( with or without again a ACK ? ) ...
it can be a fail in the Datagramm Data..
Have a look in the API Docu your Device
Best wishes
Rudi
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Rudi,
Check out the tutorials on Youtube, I have left you the link on my other post, also here is the xbee cheet sheet link:
http://www.tunnelsup.com/xbee-s2-quick- ... eat-sheet/
cheers
Acestu
Check out the tutorials on Youtube, I have left you the link on my other post, also here is the xbee cheet sheet link:
http://www.tunnelsup.com/xbee-s2-quick- ... eat-sheet/
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
I will re program and see if it is ok.
cheers
Stuart
I will re program and see if it is ok.
cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
It is still coming up with crazy numbers, here are some pics:
cheers
Stuart
It is still coming up with crazy numbers, here are some pics:
cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
Re: Zigbee Question
Hi acestu,acestu wrote:Hi Rudi,
Check out the tutorials on Youtube, I have left you the link on my other post, also here is the xbee cheet sheet link:
http://www.tunnelsup.com/xbee-s2-quick- ... eat-sheet/
cheers
Acestu
thank you acestu, i will have a look later - so perhaps i can help too.
I have start a Thread for making a Icon and others.
http://www.matrixtsl.com/mmforums/viewt ... 54&t=15204
btw, here is my simple Flowchart for the Xbee 868 Pro, perhabs this can help you too.
edit: this is a makro with parameter
->000 StringTyp : ATCommand_Frame0x13[3]
->001 ByteTyp : ATCommand_Frame0x17_PARAMETER
example call:
Frame_ID_0x17_indicates("D1",4)
will send a AT Command for the Digi port pin D1 with Parameter 4 ( set the D1 DIGITAL OUT, LOW )
all other is fix for Frame Type 0x17
I make for all Frame Types a Makro with fix parameter, only DATA Gramm must fill out in the Parameter.
This will be be a ICON for XBEE 868 Pro
.
The Temp Sensor is interessting! i have order too a lot of pieces
Best wishes!
Rudi
Last edited by Rudi on Thu Aug 21, 2014 9:11 pm, edited 1 time in total.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Rudi,
Thanks, I might have a go with 1 of the Pro Zigbee modules when I manage to get this sries 2 going.....
cheers
Acestu
Thanks, I might have a go with 1 of the Pro Zigbee modules when I manage to get this sries 2 going.....
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
Re: Zigbee Question
Hi Acestu,acestu wrote:Hi Rudi,
Thanks, I might have a go with 1 of the Pro Zigbee modules when I manage to get this sries 2 going.....
cheers
Acestu
one tip if you not know this ..
this helps me for understanding the zigbee/xbee DATAGRAM
http://ftp1.digi.com/support/utilities/ ... rames2.htm
the same is in the new X-CTU Config Tool .. V 6.. named "Frame-Generator" too in this
Best wishes
Rudi
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: Zigbee Question
Hi Benj,
If you get chance could you have another quick look at this one please, still getting massive high and low numbers.
cheers
acestu
If you get chance could you have another quick look at this one please, still getting massive high and low numbers.
cheers
acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.