ping))) sensor works only few seconds !?
fukakai
Posts: 9
Hi,
I have a Ping))) sensor plugged on an arduino card, you can see documentation here : http://www.parallax.com/Portals/0/Downloads/docs/prod/robo/570-28015-PingBracket-v2.0.pdf
When i'm trying some really simply codes with (https://code.google.com/p/arduino-new-ping/wiki/Simple_NewPing_Example) or without (https://gist.github.com/flakas/3294829) NewPing library my issue it the same :
I first, upload my program on the arduino card.
I start the program by the position 2 of the start button, all is working fine, i have distance with pings and i can use them.
Few seconds after the program starting (30 seconds approximately), all continue to working fine except the ping sensor who return 0 instead of the inch or centimeters distance.
Moreover, the ping green light is also stopping !
If now, i move the start button du 0 position to stop it and move again on position 2 it always don't work !
But : if i move the button to 0, push reset button and start again the arduino card now it works again !!!! and i can have new values for distance with ping censor !!!
I want to use the ping))) sensor during few minutes, not only for seconds ...
So, how can i solve this problem ?
Someone ever had this problem ?
I have always test the watchdog solution to do a "software" reset but it's don't working ...
Thank you in advance,
Romain
I have a Ping))) sensor plugged on an arduino card, you can see documentation here : http://www.parallax.com/Portals/0/Downloads/docs/prod/robo/570-28015-PingBracket-v2.0.pdf
When i'm trying some really simply codes with (https://code.google.com/p/arduino-new-ping/wiki/Simple_NewPing_Example) or without (https://gist.github.com/flakas/3294829) NewPing library my issue it the same :
I first, upload my program on the arduino card.
I start the program by the position 2 of the start button, all is working fine, i have distance with pings and i can use them.
Few seconds after the program starting (30 seconds approximately), all continue to working fine except the ping sensor who return 0 instead of the inch or centimeters distance.
Moreover, the ping green light is also stopping !
If now, i move the start button du 0 position to stop it and move again on position 2 it always don't work !
But : if i move the button to 0, push reset button and start again the arduino card now it works again !!!! and i can have new values for distance with ping censor !!!
I want to use the ping))) sensor during few minutes, not only for seconds ...
So, how can i solve this problem ?
Someone ever had this problem ?
I have always test the watchdog solution to do a "software" reset but it's don't working ...
Thank you in advance,
Romain
Comments
1. Are you using a Parallax Ping))) or an HC-SR04 Sensor?
Your examples are for the HC-SR04 which uses two pins for trigger and echo, whereas the actual Ping))) uses a single pin and requires a slightly different timing between trigger and echo instances.
2. What are you using to supply power to the Arduino and sensor? Battery power?
Although it does not sound like you have a reset problem, it could be that you are not supplying enough amperage for both the Ping))) and the Arduino. And, since you quote the Ping))) Bracket product, are you running a servo as well? You may want to check your power supply...
dgately
Chris Savage :
You confirm what I suspected also, it can be a stack overflow / underflow issue (when i discovered the reset button tips ^^) but i don't reach to do it in arduino or to find tutorials / example to do that.
I'm currently trying to find others informations about.
dgately :
1 : I am using Parallax Ping))). In code, when I am using NewPing library i set trigger and echo pins with the same value and it works ... during few seconds ^^ (as the other way)
I saw here the NewPin 1.5 library support also the Parallax Ping))) : http://forum.arduino.cc/index.php?topic=106043.0
2: to support Arduino and sensor, I have five AA batteries. But the issue occurs also with only one cable connected to the computer (and no batteries)
Here is another sample (http://arduino.cc/en/Tutorial/Ping). Again the same issue with it.
Does the 5V regulator get hot after 30 seconds with the power switch in position 2?
http://learn.parallax.com/KickStart/28015
Chris Savage : i suspected also the stack overflow since i'll discover the reset button result. You confirm my second thoughts. But i don't reach to find any tutorials / examples about the stack clearing with arduino commands. I actually doing some test.
Dgately :
1 : i'm using Parallax Ping)))
When i'm using the NewPing 1.5 library, i set trigger and echo pins with the same value for only one pin because i saw here http://forum.arduino.cc/index.php?PHPSESSID=srvcptqvesmu7jomidkc4lkn35&topic=106043.0 the NewPing 1.5 library support the Parallax Ping))).
2 : To supply power to the Arduino and sensor, i'm using five AA batteries. But the issue occurs with batteries or without (connected by USB cable to my computer)
i have other servos connected. i've tried without them and with only the ping sensor : same issue.
Mike Green : i've upload 2 pictures to show you what i am using. After few seconds of work in the position 2 there is no hot component (servos, ping))), or other if they are connected)
Steph Lindsay : i did all the last part for Arduino Uno : connections and code. Same issue again
Here is the logs i can see with the code find on your link
16
16
16
16
16
16
[...] //voluntary cut here ^^
58
145
44
48
44
47
48
44
70
44
52
59
145
145
45
46
56
58
46
44
45
46
48
46
44
44
45
50
58
145
48
45
45
46
46
47
145
145
78
44
81
72
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
....
and here two pictures :
I have an arduino uno, 3 servos (right and left wheel and ping))) servo), a color detector in front of the robot but it's not actually connected
Thanks a lot, i want to find a solution and you give me really good directions
Try making the trigger pulse longer. Change the first delayMicroseconds from 2 to 5 and the second delayMicroseconds from 5 to 10 and see what happens. Try adding a delayMicroseconds(5); between the digitalWrite(...,LOW); and the pinMode
ok, i understand better now the green light on the front of the PING.
I have always the same issue with delayMicroseconds(); corrections.
i just timed with my phone, the PING sensor : it auto stopping exactly at 1 minute (01:00) after start !
i tried to magnify delayMicroseconds() wtih 10 / 100 / 50 ,I have not noticed any variation.
but i think, here we have a good clue :
i added a delay(1000) inside the loop() method and it happens a curious thing : the ping is flashing all seconds but stopped also to exactly one minute ! consequently : it take less measurements !
so, can we deduce the issue is not related to the number of pings or their frequency ? but ... ? arf ... i think we reach the goal ^^
i have somes news ! good .. i'm not sure ^^.
With a lot of "Serial.println()" commands in the NewPing library, i isolated the issue in the library code. it's :
this code fragment is on the line 99-99 into the NewPing.cpp file.
I understand each time this code return false, the ping trigger return NO_ECHO and 0 value !!!!
Obviously, i tried to comment this part of the code, and in place of return 0, it return always the last ping value !
Actually, i don't know anymore, but i continue ...
Help me if you are knowing wich var in this code fragment can cause this problem.
Thank you in advance,
Romain
What are your I/O pins in use for your entire board? I cannot quite tell from the photos. I just want to make sure you are not using P11 next to the breadboard and also the P11 Servo Header pins at the same time.
The Ping))) sensor should get regulated 5V. If you connect the Ping))) sensor to the Servo Header pins, and the Servo Header jumper is set to VIN, it might be getting too much power. If you want to connect the Ping))) sensor to the Servo Header pins, set the jumper to 5V.
In your list of measurements, I see I see "145" in there at random. They look like they might be false readings. I have seen random "144" when the Ping))) sensor is receiving a 40 kHz signal from the fluorescent light fixture in my office. If you think the "145" should not be there, try again with the lights off.
I used differents I/O pins tu connect the PING))) sensor, 11 sure but, only one by one obviously (the one for cerveau or the other one on the left. I also connect the PING))) to the 9, 3, and 5 pins.
According with the official tutorial, i've connect it on 5V Servo Headers pins and set the jumper to 5V (blocks with black, red, white) and i tried on the other 5V and GND pins.
For measurements, i don't know 145 was false reading but it can be there the "bug" is starting. But i dont understand, with wich lights off you want i try ?
Thanks in advance,
Romain
I was this week-end to the SUPINFO robotic competition in France : http://grenoble.labo-robotique.com/8-et-9-juin-2013-competition-robotique-a-supinfo-grenoble/.
The robotic "full professor" of Grenoble campus lent me another PING))) sensor and it works perfectly !!!! With the exactly same codes i had, and all others i've tried -.-".
So good news, it was an hardware issue !
Thanks a lot for help and quick answers.
Romain
Edit : Some photos for fun http://troyes.labo-robotique.com/2013/06/09/competition-robotique-grenoble/