Post a new topicPost a reply Page 1 of 5   [ 43 posts ]
Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Help Required
PostPosted: Wed Jul 11, 2012 12:06 pm 

Joined: Wed Jul 11, 2012 11:53 am
Posts: 23
Dear All,

I am implementing the code for agriculture sensor boards, but unable to transmit the data using wireless module. The code given below is working but I want to convert that piece of code for wireless module. I read many of posts on forum but my problem is still there.
Please help me in this regards.




float temp_value = 0;
float value_pressure = 0;
float value_humidity=0;
void setup()
{
// Opening UART to show messages using 'Serial Monitor'
USB.begin();
}

void loop()
{
// Blinking LEDs
Utils.blinkLEDs(1000);
SensorEvent.setBoardMode(SENS_ON);
temp_value = SensorEvent.readValue(SENS_SOCKET5);
delay(100);
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_PRESSURE);
value_pressure = SensorAgr.readValue(SENS_AGR_PRESSURE);
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_HUMIDITY);
value_humidity = SensorAgr.readValue(SENS_AGR_HUMIDITY);
// Printing a message, remember to open 'Serial Monitor' to be able to see this message
USB.print("\nHello World, this is Waspmote!");
USB.print("\nTemperature: ");
USB.print(temp_value);
USB.print("\nPressure : ");
USB.print(value_pressure);
USB.print("\nHumidity : ");
USB.print(value_humidity);
// A little delay
delay(2000);
}


The following code is not working as it is for wireless communication. Please guide me in this regard.




float value_temperature = 0;
float value_pressure = 0;

void setup()
{
SensorAgr.setBoardMode(SENS_ON);
RTC.begin();
delay(100);
SensorAgr.setAnemometerThreshold(90.0);
}
void loop()
{
RTC.begin();
delay(100);
value_temperature = SensorAgr.readValue(SENS_AGR_TEMPERATURE);
delay(100);
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_PRESSURE);
delay(100);
value_pressure = SensorAgr.readValue(SENS_AGR_PRESSURE);
XBee.setMode(XBEE_ON);
delay(100);
XBee.print(value_temperature);
XBee.print(value_pressure);
delay(100);
XBee.setMode(XBEE_OFF);
}


Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Wed Jul 11, 2012 1:29 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7455
rahimgiki,

Please take a look into example codes of your XBee protocol. they are included in IDE.

Also take a look into development section and read programming guide corresponding to your protocol. It will helps you to understand how it works.

Regards.


Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Wed Jul 11, 2012 2:52 pm 

Joined: Wed Jul 11, 2012 11:53 am
Posts: 23
Dear Sir,
We have checked the link it is quite useful but we have already read all material available. I request you to please guide us in the simplest code for the wireless communication so that we can test our module. we have already mentioned that we have checked our boards and they are communication via USB device. However, we have write a simplest code just for checking wireless communication. it is successfully loaded into the board but we haven't received any value at the serial monitor.
I am attaching the simplest code for wireless communication.



void setup()
{
SensorAgr.setBoardMode(SENS_ON);
RTC.begin();
delay(100);
SensorAgr.setAnemometerThreshold(90.0);
}
void loop()
{
RTC.begin();
delay(100);
XBee.setMode(XBEE_ON);
delay(100);
XBee.println("Baba G");
delay(100);
}



Kindly, check this code and help us in sorting this problem. we will be thankful indeed.


Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Thu Jul 12, 2012 8:42 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7455
rahimgiki,

OK, Maybe you read it it, but looking at your code it seems that you miss examples part due to your code is not correct. What XBee protocol are you using? Digimesh, Zigbee, 802.15.4...

YOu could test sensor boards, that is great. Now, for communication testing, there are specific examples. Just go to XBee category on your IDE and select the sending_receiving example for your corresponding protocol. Like the one on thislink for 802.15.4

You should use functions init() and ON() for your corresponding protocol, not XBee.setmode.

Regards


Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Thu Jul 12, 2012 11:57 am 

Joined: Wed Jul 11, 2012 11:53 am
Posts: 23
Dear Sir,
This piece of code is working and output is quite strange as shown in the figure, initially Sir we are concerning about the communication among the node and Gateway. Kindly help us in sorting this problem.

Also mention the problems in previous code.
Xbee.print("") is also not working, compiling and uploading are successful but there is no output.




packetXBee* paq_sent;
int8_t state=0;
long previous=0;
int g=0;
uint8_t PANID[2]={0x12,0x34};
float value_temperature = 0;
char temp[10];

void setup()
{
// Inits the XBee 802.15.4 library
xbee802.init(XBEE_802_15_4,FREQ2_4G,NORMAL);

// Powers XBee
xbee802.ON();
}

void loop()
{
// Set params to send
value_temperature = SensorAgr.readValue(SENS_AGR_TEMPERATURE);
// --- coversion equation---
value_temperature = ( value_temperature - 0.5 ) * 100;
Utils.float2String(value_temperature,temp,2);
sprintf("\n",temp);
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, MAC_TYPE);
xbee802.setDestinationParams(paq_sent, "0013A200407620F5",temp, MAC_TYPE, DATA_ABSOLUTE);
xbee802.sendXBee(paq_sent);
if( !xbee802.error_TX )
{
XBee.println("ok");
}
free(paq_sent);
paq_sent=NULL;

delay(500);
}


Output:

~}3¢@v ÎGR#}3¢@v Î0.32L~€}3¢@v ÎCR#}3¢@v Î-6.45~€}3¢@v Î?R#}3¢@v Î-13.2
2ô~€}3¢@v Î:R#}3¢@v Î-17.09ð~€}3¢@v Î:R#}3¢@v Î-20.64õ~€}3¢@v Î:R#}3¢@v
Î-22.90ô~€}3¢@v Î:R#}3¢@v Î-24.83ð~€}3¢@v Î:R#}3¢@v Î-26.45ð~€}3¢@v Î<R
#}3¢@v Î-27.74ë~€}3¢@v Î=R#}3¢@v Î-28.70í~€}3¢@v Î:R#}3¢@v Î-29.35î~€}3¢
@v ÎBR#}3¢@v Î-30.32ñ~€}3¢@v ÎFR#}3¢@v Î-30.00ò~€}3¢@v ÎLR#}3¢@v Î-29.67
×~€}3¢@v ÎFR#}3¢@v Î-32.58ã~€}3¢@v ÎFR#}3¢@v Î-30.64è~€}3¢@v ÎFR#}3¢@v
Î-29.35â~€}3¢@v ÎCR#}3¢@v Î-28.06è~€}3¢@v Î@R#}3¢@v Î-30.00ø~€}3¢@v Î@R#
}3¢@v Î-30.96é~€}3¢@v ÎBR#}3¢@v Î-29.35æ~€}3¢@v ÎDR#}3¢@v Î-30.00ô~€}3¢@
v ÎBR#}3¢@v Î-32.90ë


Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Thu Jul 12, 2012 1:03 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7455
rahimgiki,

Could you please tell us if you are able to run successfully 802.15.4 examples?

Besides that, please be sure you followed all steps of Waspmote checklist.

Let's try first make communication work and later add sensor board part.

Regards.


Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Thu Jul 12, 2012 1:52 pm 

Joined: Wed Jul 11, 2012 11:53 am
Posts: 23
we have checked the two examples waspXBee802_2sending_receiving and waspXBee802_2sending_receivingB. The results are same for communication between two nodes and similarly between a node and gateway. The output is as shown in our previous post. Kindly send us any testing code for wireless communication between sensor and gateway. We shall be greatly thankful to you.


Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Fri Jul 13, 2012 8:33 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7455
rahimgiki,

OK, lets go by parts.

First of all, communication between Waspmote and Xbee module must be understood. They uses UART communication, and Waspmote uses two UARTs. if XBee is placed on socket 0 (UART0) it will share this UART with USB, so every message you send to XBee it will also be printed by USB. That is the reason because you see strange characters on Waspmote side. You can read many post about that.

Secondly, in the Gateway side, you will also see those strange characters besides that valid data. they are API headers used for packet transmission. Take a look into 802 programming guide to see their description.

Finally, could you specify what is you problem exactly? Did you test a network of Node1 (Waspmote+XBee) and Node2 (Gateway + XBee) ? Did you see transmitted data on node 2 side?

Let us know.

Regards.

On tip: Please do not duplicate post, we will try to answer you as soon as we can.


Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Fri Jul 13, 2012 11:49 am 

Joined: Wed Jul 11, 2012 11:53 am
Posts: 23
Dear Sir,

We apologize for the double post.
We have checked communication on both (Waspmote + Xbee) and (Gateway +Xbee), Communication occur but strange characters are found on serial monitor as shown in the previous posts.
Please help us in removing these characters from output.

Secondly, we are attaching a small piece of code in this post kindly check it and tell us if there is any error, because it has been compiled and uploaded successfully but there is no output on the serial monitor.

float value_temperature = 0;
float value_pressure = 0;

void setup()
{
SensorAgr.setBoardMode(SENS_ON);
RTC.begin();
delay(100);
SensorAgr.setAnemometerThreshold(90.0);
}
void loop()
{
RTC.begin();
delay(100);
value_temperature = SensorAgr.readValue(SENS_AGR_TEMPERATURE);
delay(100);
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_PRESSURE);
delay(100);
value_pressure = SensorAgr.readValue(SENS_AGR_PRESSURE);
XBee.setMode(XBEE_ON);
delay(100);
XBee.print(value_temperature);
XBee.print(value_pressure);
delay(100);
XBee.setMode(XBEE_OFF);
}



Top
 Profile  
 
 Post subject: Re: Help Required
PostPosted: Mon Jul 16, 2012 12:23 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7455
Hi rahimgiki,

I can see you are using the agriculture board now. Which board version are you using?

Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 5   [ 43 posts ]
Go to page 1, 2, 3, 4, 5  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