Post a new topicPost a reply Page 2 of 3   [ 29 posts ]
Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Wed Jan 11, 2012 11:16 am 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi
Thanks for the reply, but i stiil until now dont have any solution to send Email...

So, now i have an Ultrasonic XL-MaxSonar®-WRA1 from MaxBotix™ sensor (also LV-MaxSonar®-EZ0™) and i want to use it, but i don't have any document or tutorial to show me how can i use it...
juste a smal description in page 12 and 13 but is totly clear...

please can you tell me how can i use it and give me a complete code to use it... :)

Best Regard


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Wed Jan 11, 2012 1:15 pm 

Joined: Wed Jul 14, 2010 12:22 pm
Posts: 36
Hi Pamela.

Sorry, I don't know anything about that sensor. Never have worked with something similar. You'll have to deal with the I/O pins (reading in both digital & analog, writing in digital, setting sensor power...) and learn how it is used. If you have a more focused question in that sense, post it and maybe someone can help you.

Regarding the e-mail, if you followed all of both libelium-dev and my tips, I don't know what else can be done, but you shouldn't be far from succeed.

Regards!


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Wed Jan 11, 2012 3:50 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7475
Dear pamela,

Regarding ultrasonic sensor, you can download its datasheet from here:http://www.maxbotix.com/products/MB7070.htm

About its usage, on page 19 of smart cities sensor board guide, a detailed description of this sensor is also provided, with some tips for its usage.

Check the board guide here.
http://www.libelium.com/documentation/w ... rd_eng.pdf

Kind regards


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Fri Jan 13, 2012 12:27 pm 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi
Thanks for the reply...
Now i have a question about Gases, i see the example of Temperature Sensor – MCP9700A and it work perfectly with USB port, but when i want to use it with XBee 802.15.4 and send the value to the GateWay, i see tha strange symbol and value...

I don't understand exactly what's the problem?? please can you help me because i want to measure the temperature of 3 rooms, every room have a Waspmote with temperature sensor attached...

The code is above:

packetXBee* paq_sent;
float value;
int8_t state=0;
long previous=0;
char aux[200];
char* macHigh=" ";
char* macLow=" ";
int aux_1 = 0;
int aux_2 = 0;
uint8_t PANID[2]={0x12,0x34};
#define key_access "LIBELIUM"
#define id_mote "WaspMote01"


void setup()
{
USB.begin();
USB.println("Starting...");

// +++ Must go before RTC.ON() to avoid I2C problems +++
SensorGas.setBoardMode(SENS_ON);
delay(100);

// Init RTC
RTC.ON();
delay(100);

// Store key access in EEPROM
for(int i=0;i<8;i++){
Utils.writeEEPROM(i+107,key_access[i]);
}

// Write Mote ID in EEPROM memory
for(int i=0;i<16;i++)
{
Utils.writeEEPROM(147+i,id_mote[i]);
}

XBee.setMode(XBEE_ON);
XBee.begin(9600);
delay(1000);
XBee.print("+++");
delay(2000);
XBee.println("ATBD5,AP2,WR,CN");
delay(150);

XBee.setMode(XBEE_OFF);
XBee.close();

Utils.setLED(LED0, LED_ON);
Utils.setLED(LED1, LED_ON);
delay(5000);
Utils.setLED(LED0, LED_OFF);
Utils.setLED(LED1, LED_OFF);
for (int i=0;i<24;i++){
Utils.blinkLEDs(125);
}

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

// Powers XBee
xbee802.ON();

// Get the XBee MAC address

delay(500);

int counter = 0;
while(xbee802.getOwnMac()==1&&counter<4){
xbee802.getOwnMac();
counter++;
}

Utils.hex2str(xbee802.sourceMacHigh,macHigh,4);
Utils.hex2str(xbee802.sourceMacLow,macLow,4);

}


void loop()
{
// ++++++++ Temperature ++++++++

// Read value in volts
value = SensorGas.readValue(SENS_TEMPERATURE);

USB.print("Measured value from sensor:");
USB.println(value);

// --- coversion equation---
value = ( value - 0.5 ) * 100;

USB.print("Temperature:");
USB.println(value);
USB.println();

sprintf(aux,"-id_mote:%s -mac:%s%s -temp:%f -bat: %d%c%c%c",id_mote,macHigh,macLow,value,PWR.getBatteryLevel(),'%','\r','\n');

paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=BROADCAST;
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, "0013A20040762047",aux, MAC_TYPE, DATA_ABSOLUTE);
xbee802.sendXBee(paq_sent);

free(paq_sent);
paq_sent = NULL;

delay(2000);

}


Please, can you tell me what is my mistake...
Best Regard
Pamela


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Fri Jan 13, 2012 4:11 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7475
Dear Pamela,


Code:
sprintf(aux,"-id_mote:%s -mac:%s%s -temp:%f -bat: %d%c%c%c",id_mote,macHigh,macLow,value,PWR.getBatteryLevel(),'%','\r','\n');


The problem is with the float value in your sprintf function, you can see it if you print aux before sending.

Try casting the variable to a string for example and let us know.

Utils.float2String(,);

Kind regards


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Mon Jan 16, 2012 2:45 pm 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi Libelium-dev
Until now i still stack at this problem and i can't see the Temperature Value via XBee 802.15.4
I di the change from float to String but the same problem
I can see the value with USB port but not with Radio what i want to send the value from xbee to the Gateway...

please tell me what can i do???

CODE:
packetXBee* paq_sent;
int8_t state=0;
long previous=0;
char aux[200];
char* macHigh=" ";
char* macLow=" ";
int aux_1 = 0;
int aux_2 = 0;
uint8_t PANID[2]={0x12,0x34};
#define key_access "LIBELIUM"
#define id_mote "WaspMote01"


void setup()
{
USB.begin();
USB.println("Starting...");

// +++ Must go before RTC.ON() to avoid I2C problems +++
SensorGas.setBoardMode(SENS_ON);
delay(100);

// Init RTC
RTC.ON();
delay(100);

// Store key access in EEPROM
for(int i=0;i<8;i++){
Utils.writeEEPROM(i+107,key_access[i]);
}

// Write Mote ID in EEPROM memory
for(int i=0;i<16;i++)
{
Utils.writeEEPROM(147+i,id_mote[i]);
}

XBee.setMode(XBEE_ON);
XBee.begin(9600);
delay(1000);
XBee.print("+++");
delay(2000);
XBee.println("ATBD5,AP2,WR,CN");
delay(150);

XBee.setMode(XBEE_OFF);
XBee.close();

Utils.setLED(LED0, LED_ON);
Utils.setLED(LED1, LED_ON);
delay(5000);
Utils.setLED(LED0, LED_OFF);
Utils.setLED(LED1, LED_OFF);
for (int i=0;i<24;i++){
Utils.blinkLEDs(125);
}

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

// Powers XBee
xbee802.ON();

// Get the XBee MAC address

delay(500);

int counter = 0;
while(xbee802.getOwnMac()==1&&counter<4){
xbee802.getOwnMac();
counter++;
}

Utils.hex2str(xbee802.sourceMacHigh,macHigh,4);
Utils.hex2str(xbee802.sourceMacLow,macLow,4);

}


void loop()
{
// ++++++++ Temperature ++++++++
float valueTemperature=0;
char temp[10];
Utils.float2String(valueTemperature,temp,2);

// Read value in volts
valueTemperature = SensorGas.readValue(SENS_TEMPERATURE);

USB.print("Measured value from sensor:");
USB.println(valueTemperature);

// --- coversion equation---
valueTemperature = ( valueTemperature - 0.5 ) * 100;

USB.print("Temperature:");
USB.println(valueTemperature);
USB.println();

//sprintf(aux,"-id_mote:%s -mac:%s%s -TEMP:%s -bat: %d%c%c%c",id_mote,macHigh,macLow,temp,PWR.getBatteryLevel(),'%','\r','\n');

paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=BROADCAST;
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, "0013A20040762047",aux, MAC_TYPE, DATA_ABSOLUTE);
xbee802.sendXBee(paq_sent);

free(paq_sent);
paq_sent = NULL;

delay(2000);

}

please help me...

Best Regard
Pamela


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Mon Jan 16, 2012 5:24 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7475
Pamela,

Just use float2String function after reading value, not before.

And also if you want to debug your code, check always variable values using USB.println().

Kind regards.


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Mon Jan 16, 2012 7:42 pm 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi Libelium-dev
It is the same problem and i can't see the Temperature Value in Radio

I can see the value just with USB port but not with Radio

please test my code with the libelium team and tell me what's the problem???? :)

CODE:
packetXBee* paq_sent;
int8_t state=0;
long previous=0;
char aux[200];
char* macHigh=" ";
char* macLow=" ";
int aux_1 = 0;
int aux_2 = 0;
uint8_t PANID[2]={0x12,0x34};
#define key_access "LIBELIUM"
#define id_mote "WaspMote01"


void setup()
{
USB.begin();
USB.println("Starting...");

// +++ Must go before RTC.ON() to avoid I2C problems +++
SensorGas.setBoardMode(SENS_ON);
delay(100);

// Init RTC
RTC.ON();
delay(100);

// Store key access in EEPROM
for(int i=0;i<8;i++){
Utils.writeEEPROM(i+107,key_access[i]);
}

// Write Mote ID in EEPROM memory
for(int i=0;i<16;i++)
{
Utils.writeEEPROM(147+i,id_mote[i]);
}

XBee.setMode(XBEE_ON);
XBee.begin(9600);
delay(1000);
XBee.print("+++");
delay(2000);
XBee.println("ATBD5,AP2,WR,CN");
delay(150);

XBee.setMode(XBEE_OFF);
XBee.close();

Utils.setLED(LED0, LED_ON);
Utils.setLED(LED1, LED_ON);
delay(5000);
Utils.setLED(LED0, LED_OFF);
Utils.setLED(LED1, LED_OFF);
for (int i=0;i<24;i++){
Utils.blinkLEDs(125);
}

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

// Powers XBee
xbee802.ON();

// Get the XBee MAC address

delay(500);

int counter = 0;
while(xbee802.getOwnMac()==1&&counter<4){
xbee802.getOwnMac();
counter++;
}

Utils.hex2str(xbee802.sourceMacHigh,macHigh,4);
Utils.hex2str(xbee802.sourceMacLow,macLow,4);

}


void loop()
{
// ++++++++ Temperature ++++++++
float valueTemperature=0;
char temp[10];

// Read value in volts
valueTemperature = SensorGas.readValue(SENS_TEMPERATURE);
Utils.float2String(valueTemperature,temp,2);
USB.print("Measured value from sensor:");
USB.println(valueTemperature);

// --- coversion equation---
valueTemperature = ( valueTemperature - 0.5 ) * 100;

USB.print("Temperature:");
USB.println(valueTemperature);
USB.println();

sprintf(aux,"-id_mote:%s -mac:%s%s -TEMP:%s -bat: %d%c%c%c",id_mote,macHigh,macLow,temp,PWR.getBatteryLevel(),'%','\r','\n');

paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=BROADCAST;
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, "0013A20040762047",aux, MAC_TYPE, DATA_ABSOLUTE);
xbee802.sendXBee(paq_sent);

free(paq_sent);
paq_sent = NULL;

delay(2000);

}

please Test the code and tell me what's my mistake... please :)

Best Regard
Pamela


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Tue Jan 17, 2012 9:42 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7475
Pamela,

Your code is wrong. You did not get the idea that you have to first read value, second apply conversion factor and third apply float2string(). In your code you are sending temp without applying conversion factor!

Try your code in this way please:
Quote:
void loop()
{
// ++++++++ Temperature ++++++++
float valueTemperature=0;
char temp[10];

// Read value in volts
valueTemperature = SensorGas.readValue(SENS_TEMPERATURE);

USB.print("Measured value from sensor:");
USB.println(valueTemperature);

// --- coversion equation---
valueTemperature = ( valueTemperature - 0.5 ) * 100;

USB.print("Temperature:");
USB.println(valueTemperature);

USB.println();
Utils.float2String(valueTemperature,temp,2);

USB.print("Temp:");
USB.println(temp);

sprintf(aux,"-id_mote:%s -mac:%s%s -TEMP:%s -bat: %d%c%c%c",id_mote,macHigh,macLow,temp,PWR.getBatteryLevel(),'%','\r','\n');



Kind regards


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Tue Jan 17, 2012 1:09 pm 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi Libelium-Dev

Thanks for the reply and the correction...
On USB port it work well, but when i use it in Radio 802.15.4, it is the same problem that i see just a stranger caracter...

i see the 3 led of RSSI turn on indicate that packet is sent but i see the strange symbol and caracter and not the Temperature value in the screen...

Ahhhh, i'm very sad because this code doesn't work.... and i'm stack in my project because i want to collect Temperature from 3 waspmote and sed it to Gateway...

Please help me...

Code to send with Xbee802.15.4:
packetXBee* paq_sent;
int8_t state=0;
long previous=0;
char aux[200];
char* macHigh=" ";
char* macLow=" ";
int aux_1 = 0;
int aux_2 = 0;
uint8_t PANID[2]={0x12,0x34};
#define key_access "LIBELIUM"
#define id_mote "WaspMote01"

void setup() {

USB.begin();
USB.println("Demarrage du Systeme...");

// Initialisation de la SensorBoard
SensorGas.setBoardMode(SENS_ON);
delay(100);

// Initialisation de la RTC
RTC.ON();
delay(100);

// Store key access in EEPROM
for(int i=0;i<8;i++){
Utils.writeEEPROM(i+107,key_access[i]);
}

// Write Mote ID in EEPROM memory
for(int i=0;i<16;i++)
{
Utils.writeEEPROM(147+i,id_mote[i]);
}

XBee.setMode(XBEE_ON);
XBee.begin(9600);
delay(1000);
XBee.print("+++");
delay(2000);
XBee.println("ATBD5,AP2,WR,CN");
delay(150);

XBee.setMode(XBEE_OFF);
XBee.close();

Utils.setLED(LED0, LED_ON);
Utils.setLED(LED1, LED_ON);
delay(5000);
Utils.setLED(LED0, LED_OFF);
Utils.setLED(LED1, LED_OFF);
for (int i=0;i<24;i++){
Utils.blinkLEDs(125);
}

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

// Powers XBee
xbee802.ON();

// Get the XBee MAC address

delay(500);

int counter = 0;
while(xbee802.getOwnMac()==1&&counter<4){
xbee802.getOwnMac();
counter++;
}

Utils.hex2str(xbee802.sourceMacHigh,macHigh,4);
Utils.hex2str(xbee802.sourceMacLow,macLow,4);


}
void loop()
{
// ++++++++ Temperature ++++++++
float valueTemperature=0;
char temp[10];

// Read value in volts
valueTemperature = SensorGas.readValue(SENS_TEMPERATURE);

USB.print("Measured value from sensor:");
USB.println(valueTemperature);

// --- coversion equation---
valueTemperature = ( valueTemperature - 0.5 ) * 100;

USB.print("Temperature:");
USB.println(valueTemperature);

USB.println();
Utils.float2String(valueTemperature,temp,2);

USB.print("Temp:");
USB.println(temp);

sprintf(aux,"-id_mote:%s -mac:%s%s -TEMP:%s -bat: %d%c%c%c",id_mote,macHigh,macLow,temp,PWR.getBatteryLevel(),'%','\r','\n');

paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=BROADCAST;
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, "0013A20040762047",aux, MAC_TYPE, DATA_ABSOLUTE);
xbee802.sendXBee(paq_sent);

free(paq_sent);
paq_sent = NULL;
delay(3000);

}

Best Regard
Pamela


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