Touch output pin with finger and program cycles faster? Servo/PING issue.

Dave E

Senior Member
Hi all,
I have been out of the programming loop (pun intended) for about a year but am back and I am rebuilding a robotic car that decided to launch itself down a flight of stairs. Dumb robots.

What I have so far is a 20X2(C.1) running 2 servos, 2 PING sensors, 2 LEDs and a LCD. Have not connected the drive wheels yet. The servos are used to allow the PINGs to look around. Everything was going well until I was hooking up the communication pins for the PING sensors. I hooked one up and started getting good data out to the LCD. Then I added another SEROUT command for the other PING, ran it, decided all was displaying properly then turned off the power to hook up the com pin to the second PING. When I turned the power back on the 2 servos would only move about 10 degrees either side of center and they were doing that faster than the program was suppose to allow. They were moving about 45 degrees from one side of center to 45 degrees to the other side of center per the program. Thinking that I had hooked something up wrong I reached for the 1K resistor that I had just installed from B.3 to the PING com pin and pulled it out. At this point all returned to normal. Being very careful, I placed the resistor back into the breadboard at pin B.3 and before I put the other end of the resistor into the connector track for the PING the servos started their short swings again. It turns out that as long as I only have one PING com pin connected (either one) all works well. Anytime I hook up or even touch the resistor for the second PING pin, thats when things go wrong. Keep in mind that I do not change the program. The program is coded for both PING sensors. The problem only occurs when I hook up the second PING sensor or touch the wire leading to the pin being used for the PING com.

I moved the com pins to the other side of the chip (port C instead of port B with the servos) but this had no effect. I added a high output with a 100 ms pause and this 100 ms time does not change. It just happens more often. When all is running well the program cycles about every 1.75 seconds. With both PING coms connected the program seems to speed up to about one cycle per just under a second. The servo com output pulse width does not change but instead of the chip sending it every 20ms the pins only send this info every 75ms so that the servos are not updated often enough. I added a 1 second delay between the commands that tell the servos to move left-center-right-center. I seem to be getting the proper 20 ms communication updates with the servos and the servos do drive to the proper angles now but the overall program cycle time still changes when I connect the second ping com to the PICAXE pin. With only one ping com connected, the program cycles every 5.8 sec. With both connected, the program cycles every 4.5 seconds.

At the beginning of the program, I drive both servos 90 degrees to the left then center them then drive then 90 degrees to the right. This works fine.

I have done the normal things like changing chips, verifying voltage and such. I have not searched the forum much because I am not sure what to search for. I keep thinking this is a loading issue but I have 1K ohm resistors on the PING com pins and 330 ohm resistors on the servo com pins.

I hope someone has an idea. Any help would be appreciated. If I need to post the code, I will.

Dave E
 

BeanieBots

Moderator
As intimated by Geoytex, it almost impossible to help without circuit and code.
However, the syptom is that of a floating input.
That could either be an input that you are monitoring and your code is seeing an unexpected state and doing something you don't expect. Or, more likely, the serin pin is floating and your code keeps resetting. The 20X2 does not have a reset pin but chips which do have one can exhibit similar behaviour if it is left floating.
 

srnet

Senior Member
I gave up after half a paragraph, a picture (circuit diagram) is worth a many thousands of words ........

PING = Packet Intenet Grouper ?

(and yes if you touch something with or put your finger near a circuit and it action changes to something not intended, its highly indicative of a floating input)
 

inglewoodpete

Senior Member
I think that PING refers to Parallax's PING))) ultrasonic ranging module.

If you don't connect a ping module but still have the same code running, the PulsIn command behaves like a 650mS Pause statement. The PulsIn statement waits either for the falling(closing) edge of the pulse or its timeout period to expire.
 

Dave E

Senior Member
Thanks everyone.
I had several issues going at once but did not realize it. The main issue was caused by me pulling (floating) the input but the result was, as inglewoodpete has listed, not the floating of the input but the time out of the PULSIN command. Apparently when I touched the floating input, it satisfiey the PULSIN command and everything ran faster (no 650mS pause). And yes, the PING I was talking about was the ultrasonic sensor that pete lists above.

Dave E
 
Top