Need help setting up my ultrasonic distance sensor


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,

    The question is ...

    did you use a RS232 chip on YOUR board ??? ( like in the datasheet scheme )

    more ...

    Could you , please , attach YOUR scheme ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    The question is ...

    did you use a RS232 chip on YOUR board ??? ( like in the datasheet scheme )

    more ...

    Could you , please , attach YOUR scheme ???

    Alain
    Hi, here is my hardware photo, just my sensor jumpered to my PICKIT2 in the following configuration:
    ; PortC.0 = PWM Receive ; ; ; ; ; PortA.0 = Receive Pin ; ; ; ; PortA.1 = Transmit Pin ; ; ; ; PortA.2=Trigger Pin
    PWR_ON is directly connected to 5V on the PICKIT2
    Also I am using TTL I/O, I have arranged the jumpers accordingly.
    Attached Images Attached Images   

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,

    OMG ...

    I also think you are exceeding the Pickit sourcing authorized current ... Especially when " pinging " ...

    Alain
    Last edited by Acetronics2; - 22nd June 2010 at 16:47.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    OMG ...

    I also think you are exceeding the Pickit sourcing authorized current ... Especially when " pinging " ...

    Alain
    Oops! will try everything again with seperate supply and update here. May be this is the reason that it is not working.

  5. #5
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    OK, I tried with this approach and it works, but as you will see in the code, even though the object is under 5 meters away (for eg. 4meters), PORTC.2 goes high & does not toggle. Is there something wrong with my calculation. It is working fine upto 1 meter. LED connected to PortC.2 does alterate it's toggling speed depending upon how far is the object under 1 meter. My latest code goes like this:
    Code:
    ; Phase2: RA0=TRIG (OUTPUT) ;;;;RA1- PWM (INPUT)
    w1 var word
    
    pause 500
    main1:
    w1=0
    High PortA.0
    pause 1
    Low PortA.0
    pause 1
    High PortA.0
    
    main:
    Pulsin PortA.1,0,w1
    if w1>500 or w1=0 then 
    		high PortC.2
    	else
    		toggle PortC.2
    			pause w1
    	endif
    goto main1
    end

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Everything works as written ...

    W1 = 500 is a distance of 1 meter ...

    ...

    try 2500 instead ...

    and note no measure will send back ... 5000 Pulsin units ( 50 000 µs )

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  7. #7
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    Everything works as written ...

    W1 = 500 is a distance of 1 meter ...

    ...

    try 2500 instead ...

    and note no measure will send back ... 5000 Pulsin units ( 50 000 µs )

    Alain
    Hi, it works fine with 2500. Can you please explain how you calculated 2500? Thanks

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts