Let's Make Robots!

Picaxe 18 and Ping

I just picked up a Parallax Ping distance sensor from my local Radio Shack and am trying to figure out to how hook it into my Picaxe 18 project board.

The ping uses a single pin for both input and output.  It first requires a trigger pulse to be sent and then it responds with a variable length pulse that determines the distance.  Can a Picaxe pin be switched from output to input?  If not, can I connect 2 pins to the single Ping pin?  Normally I would jut go ahead and try it, but I don't want to fry my Picaxe or the sensor.

The only examples I could find on here were for the Ardiuno and Google didn't turn anything up either. 

Thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

have you guys looked at the parallax site for docs on the ping))) sensor or on their forums?

I know that they have quite a few docs and some of the info could be useful in troubleshooting the issues, possibly having to do with timing.

 From what I've gathered though they aren't the most friendly towards the picaxe crowd on the forums, but no harm in reading them. :)

I've got one of their pings, plus one of the vex robotics ones(4 pin) which seem to work fine on their stuff(I've run it on a bs2 and javalin proc)

I'll try my hand at getting my 08m or the 18x(when it arrives) to work on it. I'm just starting with the picaxes but they are a lot of fun to try to get them to work with the limited resources...

 

wow i think i figured outt he "short reading" problem. if i put cloth or foamy material (ex. spongy packing material) over the sensors it somehow dampens the premature reading and gives me a more accurate distance read. who wuda thunk... ill do more tests on this.

yup, ill make a walkthru when i iron out all the kinks and have the sensors working as intende.

I think this may be a wild goose, but you may be right.

 However - how wuld this code work:

 

 
HIGH PORTC 0
LOW PORTC 0
PAUSE 1
PULSIN  0, 1, W0

or this:

HIGH PORTC 0
LOW PORTC 0
PAUSE 2
PULSIN  0, 1, W0

 or this:

LOW PORTC 0
HIGH PORTC 0
PAUSE 1
PULSIN  0, 1, W0

or this:

LOW PORTC 0
HIGH PORTC 0
PAUSE 2
PULSIN  0, 1, W0

or this:

inserting

TOGGLE 0

just before "Pulsin" 

 

Comments:

  • My experience tells me that when using portC high is = low and the other way around
  • Pulsin automatically changes a port to input, so you will not have to do it (and so you can save valuable puls-time)
  • You may want more than 10 miliseconds of pause

just a thought (and I know nothing about this), the srf005 needs some manipulation done to get the distance correct:

 ‘ now convert range to cm (divide by 5.8) or inches (divide by 14.8)
‘ as picaxe cannot use 5.8, multiply by 10 then divide by 58 instead
let range = range * 10 / 58 ‘ multiply by 10 then divide by 58

 

could the ping be the same for the distance problem?

Nah - and the SRF does not need this. It is only if you as a programmer need the units to be something you know.

I never use this, and was almoust about to comment it on your code, Ant, but thought "whatever - he may like it like that" :)

I always use the real values, and of course they give you a much higher resolution! 

i have my parallax ping and picaxe 28x1 working

 

here is the code i use to make it work:

    LOW PORTC 0
    HIGH PORTC 0
    PAUSE 1
    LOW PORTC 0
    LET dirsc = %00000000
    PULSIN  0, 1, W0

 here are a couple of tips:

make sure it recieves 5v +-10%. after a looong time of debugging i found out it was underpowered and so now i feed it something close to 5.4v and it works

the digital input pins also double up for output, i have the Ping))) signal wire connected to input pin 0 

pulsout does not work on input pins, even if you convert them to output. use the old fashon low-high-low

after you call the block of code above be sure to wait a bit, like a pause 100or similar

 

 My issue right now is it seems the sensor only detects upto just a couple of inches infront of it (commonly uto 84 units) which is what im trying to troubleshoot at the moment. i hope my sensor is not faulty...

 

for more info read page 4 of http://www.eetasia.com/ARTICLES/2002MAR/2002MAR08_RFD_DA_AN.PDF

Cool - I really think you should make a walkthrough on this, aparently many are fighting with it.

Alright, damn... you got me. Did you see? I put "I think" in italics... 

Ok, frits I am starting to think you are right... - I still want to see this thing in action! 

www.rocketbrandcustom.com baby!!

 Ok, I am still the nay-sayer...

I still don't think you can toggle I/O pins... I just did a little looking and I think it is only the 08m can use it's pins for both I and O.

--I would love to be proved wrong but I must say... There doesn't seem to be a post on this thread with the ping plugged in and working yet. 

Good luck to all who are trying this, I would love to see this work. 

www.rocketbrandcustom.com baby!!

Now this is the craziest!

I have never seen such mis-information!

http://letsmakerobots.com/node/113