Post a new topicPost a reply Page 1 of 2   [ 14 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: Need suggestion "the communication between PC and waspmote"
PostPosted: Tue Jan 17, 2012 3:56 pm 

Joined: Mon Nov 21, 2011 3:24 pm
Posts: 16
Dear All,

I am a fresher about wapmote. In the past several months, I was worked for building the communication between waspmote and PC.

my problems are:

1、waspmote to waspmote(PC part)
Now the sending part was done, but the receiving can't work, I uploaded the integrated code "WaspXBee802_2_sending_receivingB"+"WaspXBee802_1_creatingNetwork" in the waspmote at PC part:

Code:
uint8_t  PANID[2]={0x12,0x34};
char*  KEY="WaspmoteKey";

packetXBee* paq_sent;
 long previous=0;
 char*  data="Test message!";
 uint8_t destination[8];
 uint8_t i=0;
 
void setup()
{
  // Inits the XBee 802.15.4 library
  xbee802.init(XBEE_802_15_4,FREQ2_4G,NORMAL);
 
  // Powers XBee
  xbee802.ON();
  createnetwork();
}

void loop()
{
  // Waiting message
  previous=millis();
  while( (millis()-previous) < 20000 )
  {
    if( XBee.available() )
    {
      xbee802.treatData();
      if( !xbee802.error_RX )
      {
         // Sending answer back
         while(xbee802.pos>0)
         {
           if( (xbee802.packet_finished[xbee802.pos-1]->naO[0]==0x56) && (xbee802.packet_finished[xbee802.pos-1]->naO[1]==0x78) )
           {
             paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
             paq_sent->mode=UNICAST;
             paq_sent->MY_known=0;
             paq_sent->packetID=0x52;
             paq_sent->opt=0;
             xbee802.hops=0;
             xbee802.setOriginParams(paq_sent, "ACK", NI_TYPE);
             while(i<4)
             {
               destination[i]=xbee802.packet_finished[xbee802.pos-1]->macSH[i];
               i++;
             }
             while(i<8)
             {
               destination[i]=xbee802.packet_finished[xbee802.pos-1]->macSL[i-4];
               i++;
             }
             xbee802.setDestinationParams(paq_sent, destination, data, MAC_TYPE, DATA_ABSOLUTE);
             xbee802.sendXBee(paq_sent);
             if( !xbee802.error_TX )
             {
               XBee.println("ok");
             }
             free(paq_sent);
             paq_sent=NULL;
           }
           free(xbee802.packet_finished[xbee802.pos-1]);   
           xbee802.packet_finished[xbee802.pos-1]=NULL;
           xbee802.pos--;
        }
      }
    }
  }

  delay(5000);
}

// Chosing a channel : channel 0x0D
  void createnetwork()
  {
  xbee802.setChannel(0x0D);
  if( !xbee802.error_AT ) XBee.println("Channel set OK");
  else XBee.println("Error while changing channel");
 
  // Chosing a PANID : PANID=0x1234
  xbee802.setPAN(PANID);
  if( !xbee802.error_AT ) XBee.println("PANID set OK");
  else XBee.println("Error while changing PANID"); 
 
  // Enabling security : KEY="WaspmoteKey"
  xbee802.encryptionMode(1);
  if( !xbee802.error_AT ) XBee.println("Security enabled");
  else XBee.println("Error while enabling security"); 
 
  xbee802.setLinkKey(KEY);
  if( !xbee802.error_AT ) XBee.println("Key set OK");
  else XBee.println("Error while setting Key"); 
 
  // Keep values
  xbee802.writeValues();
  if( !xbee802.error_AT ) XBee.println("Changes stored OK");
  else XBee.println("Error while storing values"); 
 
  delay(3000);
  }


Any suggestion?

2、waspmote to gateway
I also tried this way to build communication, also the sending part worked, but until now the serial port of waspmote can't receiving any data from gateway. I uploaded the code which I showed upside on the waspmote, I wrote a code to let the gateway send a message to waspmote, the led of gateway "TX" is limy steps is light.

3、 Meshlium
I am considering whether I have to buy a Meshlium to achieve this comunication.

Did you try like me before? any suggestion? By the way, my object is the communication protocal, not implement the communication. Need you help from a fresher.


Top
 Profile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Thu Jan 19, 2012 3:03 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7515
Dear cyss,

First of all, sorry for delay answering.

Now, let's go step by step into your issues:

1 . Waspmote_A to Waspmote_B communication.

To carry out this, just upload...

- "WaspXBee802_2_sending_receiving" to --------->Waspmote_A;
- "WaspXBee802_2_sending_receivingB" to---------> Waspmote_B;

If upload process is success, just open two serial monitors (one for each Waspmote) and you should see something like next.

Waspmote_A serial monitor:
Quote:
~\0x00\0x04\0x08RMY\0xff~\0x00\0x06\0x08RMY\0xff\0xff\0x01~\0x00\0x1e\0x00R\0x00\0x00\0x00\0x00\0x00\0x00\0xff\0xff\0x00R\0x01#\0x00VxTest message!\0xa5~\0x00\0x06\0x08RMY\0x00\0x00\0xff
ok

Network Address Source: 00
MAC Address Source: 013A2040762048
Network Address Origin: 00
MAC Address Origin: 00000000
RSSI: 49
16B(0) or 64B(1): 0
Data: Test message!
PacketID: 52
Type Source ID: 2
Network Identifier Origin: ACK


Waspmote_B serial Monitor

Quote:
~\0x00\0x04\0x08RMY\0xff~\0x00\0x06\0x08RMY\0xff\0xff\0x01~\0x00 \0x00R\0x00}3\0xa2\0x00@v 6\0x00R\0x01#\0x02ACK#Test message!\0xbc~\0x00\0x06\0x08RMY\0x00\0x00\0xff
ok


Make sure your Xbee modules have same network parameters. You can do it with X-CTU tool or uploading creating Network example.


2 Waspmote to gateway

To carry out this, upload the code "wasp_start_program_802" to Waspmote_A.

When the uploading process is successful, plug one Xbee into Waspmote_A and the other Xbee into the gateway (not Waspmote), and then, open a serial monitor what is coming out from the gateway. You should see something like next lines:

Quote:
~\0x00S\0x80\0x00}3\0xa2\0x00@v H^\0x02R\0x01#\0x01\0x00}3\0xa2\0x00@v H-mac:0013A20040762048 -x:32,y:-8,z:1014 -temp:27 -bat: 94%
\0xb9



3. Meshlium.

You can contact our commercial service and explain what you want to do. They will tell you what can you do with meshlium.


Hope this is useful for you.

Let us know your comments

Kind Regards


Top
 OnlineProfile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Thu Jan 19, 2012 5:40 pm 

Joined: Mon Nov 21, 2011 3:24 pm
Posts: 16
Dear libelium-dev,

Thank you very much for your reply.

I have tried "Waspmote_A to Waspmote_B" . My steps are as following:

Step 1. I uploaded creating Network example to moteA and moteB. serial Monitor print OK.

Step2. I uploaded "WaspXBee802_2_sending_receiving" to moteA, and uploaded "WaspXBee802_2_sending_receivingB" to moteB, then I open two serial monitors (one for each Waspmote).

For moteA, serial monitor printed something as following:
Image

For moteB, serial monitor printed nothing.

Any suggestion?

Thank you again,waiting for your reply.

Best Regards,


Top
 Profile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Thu Jan 19, 2012 5:49 pm 

Joined: Mon Nov 21, 2011 3:24 pm
Posts: 16
Dear libelium-dev,

"Waspmote to gateway"

For uploading the code "wasp_start_program_802", where could I download this code? could you please give me a link? I search in Lielium-Development-waspmote, but there is no.

Waiting for your reply.

Best Regards


Top
 Profile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Thu Jan 19, 2012 6:34 pm 

Joined: Mon Nov 21, 2011 3:24 pm
Posts: 16
Dear libelium-dev,

By the way, for the "Waspmote to Waspmote", I have changed the MAC address in the sending part.

Any suggestion?

Thank you so much!

Regards


Top
 Profile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Thu Jan 19, 2012 6:49 pm 

Joined: Mon Nov 21, 2011 3:24 pm
Posts: 16
Dear libelium-dev,

I am very sorry for my continuously posting reply, but I think maybe I missed something, and it could show my situation clearly.

I have 3 types XBee, now which I am using is "Digi International", the others are "Digi XBee Pro" and "MaxStream XBee". Did I chose correctly?

Thank you so so much.

Regards,

cyyss


Top
 Profile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Fri Jan 20, 2012 9:45 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7515
cyyss,

About "Waspmote_A to Waspmote_B":

Try swaping xbees. it is very strange.

Quote:
I have changed the MAC address in the sending part.
By default, this code is sending packets in broadcast mode so MAC is not relevant.

About "Waspmote to gateway"

Here you are start programs for all radio modules.

Kind Regards


Top
 OnlineProfile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Mon Jan 23, 2012 12:56 pm 

Joined: Mon Nov 21, 2011 3:24 pm
Posts: 16
Dear libelium-dev

About "Waspmote_A to Waspmote_B", the code “WaspXBee802_2_sending_receiving” on the website is UNICAST, so I have changed the mac address in the sending part.

I have 3 types XBee, which I am using is "Digi International", the others are "Digi XBee Pro" and "MaxStream XBee". My protocol is 802.15.4, which type of XBee is ok?

I read “read me first” on the website, and it said that we should set panid, channel, and ap=2, I used the code “createNetwork()” on the website to set these values, but in this example, it do not set ap=2. Then I try to use the last version of X-CTU to set ap=2, but it do not contains my XBEE version. So if I only use “createNetwork()” to initial the Xbee without setting ap=2, is that ok?

my Moden: XBEE (XB24) Function Set:XBEE 802.15.4
Version(I can't find, there are just 1084,10A5,10E6,10EC).

I have tried the comunication for almost one month, and still do not success, I hope you can give me some guide to solve my problem.

Best regards
cyss


Top
 Profile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Mon Jan 23, 2012 5:49 pm 

Joined: Mon Nov 21, 2011 3:24 pm
Posts: 16
Dear libelium-dev
For "Waspmote to gateway ", I uploaded " wasp_start_program_802" to waspmote_A, then I opened a serial monitor what is coming out from the gateway, and it printed the mac address. In the same way, I tested waspmote_B, and it is OK.
But, I do not know why it did not work for "Waspmote to Waspmote".
Any suggestions? Thank you so much!


Best regards,

cyyss


Top
 Profile  
 
 Post subject: Re: Need suggestion "the communication between PC and waspmote"
PostPosted: Tue Jan 24, 2012 9:39 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7515
Dear cyyss,

So you are success sending from waspmote to gateway and not sending from waspmote to waspmote.

However, what do you see when you run the sending_receiving code on each side? Do you see an 'Ok' one both sides?

One tip you can try is to send messages in broadcast mode, just placing the word BROADCAST instead of UNICAST.

Try this please, before go further.

Regards


Top
 OnlineProfile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 14 posts ]
Go to page 1, 2  Next


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use