Post a new topicPost a reply Page 2 of 6   [ 56 posts ]
Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: Sensor HC-sr04
PostPosted: Sun May 13, 2012 7:48 am 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
maeishoj wrote:
If u know what it may be Please let me know, even though rhis is not a priority atm.
Right now i am more focused on trying setting the mote in hybernation, and perform a task everyday at 23:00.

For testing I just sleep for 30 seconds and then do something.

I am having trouble however, i read that in hibernate the jumper has to be off, and I do that, but it seems very random when it works and when not, depending on "exactly" when I remove the jumper..

I used a code example from the forum here:

Code:
/*-----------------------------------------------------------
   +++++    Set here time of sleeping period  +++++
   -----------------------------------------------------------*/
char * sleepTime = "00:00:00:20\0"; // 10 minutes
//char * sleepTime = "00:00:00:10\0";    // 10 seconds for testing

// +++++++++ Global variables ++++++++++

float sensorValue = 0; //stores measured ultrasonic sensor values
char frame[40];

void setup(){

  USB.begin();
 

  //////////// ONLY FIRST TIME /////////
  //RTC.ON();
  // Setting time. YY-MM-DD-XX-HH-MM-SS
  //RTC.setTime("12:02:02:05:10:25:00");
  //USB.println(RTC.getTime());
  /////////////////////////////////////

  // Checks if we come from a normal reset or an hibernate reset
  PWR.ifHibernate();


}


void loop(){

  Utils.blinkLEDs(1000);

  // If Hibernate has been captured, execute hte associated function
  if( intFlag & HIB_INT ) doStuff();

  // Goes to Hibernate disconnecting all switches and modules
  USB.println("Hibernating...");
  PWR.hibernate(sleepTime,RTC_OFFSET,RTC_ALM1_MODE2);    //!!!!!!!!!!!!!! hay que hacer alll off !! y cerrar la UART

}


// ++++++++++++++++++ PUBLIC FUNCTIONS ++++++++++++++


// measures sensor, builds frame and sends by GPRS
void doStuff(){

  char value[10]; //stores sensor value
 
  USB.println("Wake up! Doing stuff...");

  // Measure values
//  sensorValue = measureSensor();
  sensorValue = 131;
  Utils.float2String(sensorValue,value,0);

  // Build frame.
  RTC.ON();
  sprintf(frame,"$%s; %s; %d;$",RTC.getTime(),value,PWR.getBatteryLevel() );
  USB.print("Frame: ");
  USB.println(frame);
 
  // Send by GPRS
  //sendByGPRS();

  // save anything?

}


This works most of the time, however If I want to send the frame in a sms it doesn't work!
IT doesn't always get there (in the code) and sometimes do not even start (doesn't say hibernating..., which is in the start.)

Where do I have to put the sms code for the configuration:
Code:
//sendByGPRS();
  GPRS_Pro.ON();
  USB.println("GPRS_Pro module ready...");
 
  // waiting while GPRS connects to the network
  while(!GPRS.check());
  USB.println("GPRS_Pro connected to the network");
 
  // configure SMS and Incoming Calls
  if(GPRS.setInfoIncomingCall()) USB.println("Info Incoming Call OK");
  if(GPRS.setInfoIncomingSMS()) USB.println("Info Incoming SMS OK");
  if(GPRS.setTextModeSMS()) USB.println("Text Mode SMS OK");


In the setup? in the start or after ifHibernate()?

Then the code that actually send the sms
Code:
uint8_t count = 0;
    if(count==0){
//    Utils.blinkLEDs();
//    Utils.blinkLEDs(1000);
    if(GPRS.sendSMS(frame,"+4521704476"))USB.println("SMS Sent OK");
    if(GPRS.sendSMS(frame,"+4541294761"))USB.println("SMS Sent OK");
    }
    count++;


This code I put it in the section in the original code that stated: //GPRS code here.

Please help me out, this is important.


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Mon May 14, 2012 9:15 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
maeishoj,

Please refer to section 4.4 of Waspmote technical guide. There you can read about the process of hibernate. As you say it depends on when you remove jumper.

The right process is:
  1. Connect the battery
  2. Connect the button battery
  3. Switch Waspmote on.
  4. Wait for red led to light on and off
  5. Once red led is off, remove hibernate jumper

Also do not forget to turn ON again modules you are going to use after doing hibernate.

Let us know if you are success.

Best Regards.


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Mon May 14, 2012 1:59 pm 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
libelium-dev wrote:
maeishoj,

Please refer to section 4.4 of Waspmote technical guide. There you can read about the process of hibernate. As you say it depends on when you remove jumper.

The right process is:
  1. Connect the battery
  2. Connect the button battery
  3. Switch Waspmote on.
  4. Wait for red led to light on and off
  5. Once red led is off, remove hibernate jumper

Also do not forget to turn ON again modules you are going to use after doing hibernate.

Let us know if you are success.

Best Regards.


I will try again this evening.. And yes I did read the procedure and section 4.4.
But could you tell me why it started correctly and going in hibernate, initialize the modules correctly, connected to gprs, but then failed to send sms?
When I try to send sms (to the same numbers) normally without doing hibernate operation, it always works! Is there something i am missing?


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Tue May 15, 2012 7:48 pm 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
It is ok now! I guess you have to remove the jumper at the correct time?!?

IT works now anyway, so thanks for the moment!

PS: About the sensor I will abandoned that for the time being, but later i will try again!


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Wed May 16, 2012 8:38 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Glad to hear that maeishoj.

If you have another questions about Libelium sensor we will be happy trying to solve it.

Best Regards.


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Thu May 17, 2012 6:39 pm 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
libelium-dev wrote:
Glad to hear that maeishoj.

If you have another questions about Libelium sensor we will be happy trying to solve it.

Best Regards.


Dear libelium-dev!

The hibernate works fine with a sleeping time pre-set.
But what if I want to hibernate and wake up every day at 23:00 and do some measurements and then hibernate again, and loop this.??

I read in the rtc programming guide that it is different if using hibernate, to set alarms -> they don't work? ?
I didn't really understand what they say there.

How can i perform daily tasks at a specific time? Could you please help me with this?

thanks a lot!!


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Fri May 18, 2012 8:35 am 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
Hey libellium,

Today I have to upload the new code for conducting a test, could you please tell me about the question i asked above about hibernating and and wake up at a certain time (23:00) everyday? Please.
Thanks a lot.


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Fri May 18, 2012 8:36 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Hi maeishoj,

you may configure the alarm you please, it doesn't matter the type, the only limitation is that you should use the RTC only to generate the hibernate wake up alarms.

Regards.


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Fri May 18, 2012 8:42 am 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
libelium-dev wrote:
Hi maeishoj,

you may configure the alarm you please, it doesn't matter the type, the only limitation is that you should use the RTC only to generate the hibernate wake up alarms.

Regards.


Could you please write an example here for waking up every day at 23:00? Cause I could make it work yesterday..


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Fri May 18, 2012 8:43 am 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
char * sleepTime = "23:00:00"

PWR.hibernate(sleepTime,RTC_ABSOLUTE,RTC_ALM1_MODE3);

This didn't work.


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