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

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

Lets go by parts.

If you want to distinguish only if calibrations is done or not, just use 0 for non calibrated and 1 for calibrated, and also only one address (so you do not need to increment).

Then, in the beginning of your program, write 0 into address 310 as default vale of this address. After that, if you do calibration just write 1 in same address and when you wake up from hibernate, you can check this address to see if you previously made a calibration or not.

Do not forget to turn on all modules you want to use after hibernate.

regards.


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Mon May 21, 2012 10:53 am 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
Ok Now I got it.

The only problem (and not small!) is that it seems to not wake up from hibernate now:


Powering...
Using SENSOR POWER.
Aaddress = 310 -- Value = 0
NOT CALIBRATED
cal = 0
Hibernating...

And it won't go further.. What is that due to?!?


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Mon May 21, 2012 10:58 am 

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

Lets go by parts.

If you want to distinguish only if calibrations is done or not, just use 0 for non calibrated and 1 for calibrated, and also only one address (so you do not need to increment).

Then, in the beginning of your program, write 0 into address 310 as default vale of this address. After that, if you do calibration just write 1 in same address and when you wake up from hibernate, you can check this address to see if you previously made a calibration or not.

Do not forget to turn on all modules you want to use after hibernate.

regards.


libelium dev, that is what I wanted to do!

But since hibernate runs ALL THE CODE including the setup, if I write 0 as default vlaue in the beginning and once calibrated I write 1, then next time it wakes up it will override that address and put 0 again!

Is there a workaround?

Otherwise I just thought about setting it to 0 and do nothing else the first time i run the program.
Then i remove that line ( Utils.writeEEPROM(add, isCalibrate);) and only add it in the if sentence when I have calibrated.

the problem as I described above is that it is stuck there and won't go further..


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

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
Dear libelium-dev I think i solved it doing the following:

Everytime I set that address to 0 (I dont see another way atm since hibernate run the whole code, setup included) and as a condition for calibrating it's not any longer that "iscalibrated = 0" but I added another condition, with the variable "confirmCalibration" and I do calibrate only when this value is != 1 whose value I store in that add(i use for iscalibrated)+1.

And after i calibrate i set this value to 1 and next time it won't go in to do the calibration.

Is there perhaps a better way or this is "ok" ?

After you answer me to this question I would go back asking for your help regarding my sensor HC-SR04 that I can't really make work! I do exactly what i need to do but i always read 0cm..


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

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

it seems that getting stuck still occurs totally randomly!
here's the output of my program when it runs for the first time with the 2 addresses in memory reset to 0.

Powering...
Using SENSOR POWER.
NOT CALIBRATED
Object found at cm 629.9199829101
Object found at cm 629.9199829101
Object found at cm 629.9199829101
Object found at cm 629.9199829101
Object found at cm 365.7600097656
Object found at cm 365.7600097656
Object found at cm 629.9199829101
Object found at cm 365.7600097656
Object found at cm 365.7600097656
Object found at cm 365.7600097656
Object found at cm 629.9199829101
Object found at cm 629.9199829101
Object found at cm 365.7600097656
Object found at cm 365.7600097656
Object found at cm 365.7600097656
Object found at cm 365.7600097656
Object found at cm 101.5999984741
Object found at cm 365.7600097656
Object found at cm 365.7600097656
Object found at cm 365.7600097656
Hibernating...
Powering...ÿ


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Mon May 21, 2012 12:22 pm 

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

May I have the email of some of you that can help me because here on the forum the thread is growing and we seem not to reach a solution.

That problem do not occur anymore, but my biggest trouble is that all this work I am doing is because the sensor I bought from you, can't read values if below 12cm ca.

If I run it the first time it reads ok 12.69 cm. the next time I do some reading it gets strange values like 40,30,25 etc. What is it due to!?? I thought calibration, so I calibrate the first time without any object in fron of it, for 1 to 3 meters and then do reading but it is still the same!

First time reads 12.69cm.. then I sleep (hibernate) and run again, and it is the same issue! 30-40-20 cm when in fact an object is very close to it!

Can you help me figure out a solution, since if this don't work the whole thing for my project is pretty much useless!!

The other sensor I have can read 2cm min so it would be perfect! But it is also not working! can you please help me on both sides??


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Tue May 22, 2012 8:54 am 

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

We can help you in the part of your code that is related with Waspmote.

However, Due to you are using an external Sensor, we can not support you adjusting sensor measurements due to we have no experience with this sensor.

Libelium offers an ultrasonic sensor to be used with Waspmote. Ask Libelium commercial department to know how you can get one of this sensor.

If you have any question about Waspmote part, please post code you are using and we will be happy to help you.

Best regards.


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Tue May 22, 2012 11:24 am 

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

We can help you in the part of your code that is related with Waspmote.

However, Due to you are using an external Sensor, we can not support you adjusting sensor measurements due to we have no experience with this sensor.

Libelium offers an ultrasonic sensor to be used with Waspmote. Ask Libelium commercial department to know how you can get one of this sensor.

If you have any question about Waspmote part, please post code you are using and we will be happy to help you.

Best regards.


Dear libelium-dev

The whole discussion from page 2 about the problem with the sensor, it was not with the HC-sr04 (with which I have stopped working at the moment) but it is with the sensor I bought from you! The MAxSonar LV-EZ0! So I would appreciate if you could help me out with it!


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Tue May 22, 2012 11:31 am 

Joined: Sun Feb 12, 2012 3:10 pm
Posts: 127
The problem as I see is the following:

When I start reading if it has a clear view for at least 35cm more or less, and then i start measuring, and i progressively put and object closer to the sensor, i can get down to 12,69cm and it is good and consistent.

However if I start measuring and there is an object right in front of the sensor, closer than 17cm more or less, the sensor returns strange values like 40-50-25 etc, which makes it useless!

Because I measure once a day the garbage in a bin, so let's say today it's 24cm, and it reads fine.
Tomorrow there's an object at 15cm, this will return 40-50 or whatever and I have no idea if this is due to an error, or the actual distance!

The sensor states that object closer than 15cm will always return 15, and that would be ok, IF IT DID THAT! but it doesn't.

Why? Is it something different that I have to do?

Please help me out!
PS: How come in the afternoon there is never anyone here? Just wondering..


Top
 Profile  
 
 Post subject: Re: Sensor HC-sr04
PostPosted: Tue May 22, 2012 12:01 pm 

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

Sorry about that, We read in this post that you bought a new sensor but you did not say it was the MaxSonar and we have no way to know it. Anyway, lets go with the Maxsonar.

We realized that we have already talked about this issue into your other post here, and we provided you an example code.

You say that your measures are not accurate in closer distances. Don't you? You can try adjusting the conversion factor, looking into sensor datasheet provided by the manufacturer.

Could you please post the code you are using exactly, in order that we can test it here and see what is wrong?

Best Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 4 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:
cron


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