Hi.
I have read this:
HY-SRF05 // https://www.robotshop.com/letsmakerobots/node/34909
Start here robot ultrasonic sensor // https://www.robotshop.com/letsmakerobots/node/27536
I want to build this bot:
Beta of Next generation "Start here robot" // https://www.robotshop.com/letsmakerobots/node/33757
So, I bought this items:
- Picaxe 28x2 (Axe401)
- Instant robot shield (Axe408)
- HY-SRF05 ultrasonic sensor
I have tried to test the sensor but I don't know if really works, I can only hear one kind of sound, even if I bring my hand or anything else close of the sensor.
I have added a picture to have a better idea.
http://www.subirimagenes.cl/?v=2013012218.jpg
Also, I have read many datasheets and I found two modes of wires connection (single pin mode // dual pin mode).
So, ultra command is used with SINGLE pin mode connection (It also have 2 modes: 5 way header or 3 way header)...
And pulsin/pulsout commands are used with DUAL pin mode connection?
Am I right?
I noticed in SRF005 datasheet, the order of pins (Vcc / Echo / Trigger / Mode / Gnd).
Vs
The order of HY-SRF05 pins (Vcc / Trigger / Echo / OUT / Gnd).
It matter?
I tried connecting the wires of sensor in the same order:
Sensor = (Vcc / Trigger / Echo / OUT / Gnd)
To
Board = (Vcc / Trigger / Echo / OUT / Gnd)
And, also I tried connecting, but following the SRF005 pin order (Out and Mode not connected):
Sensor = (Vcc / Trigger / Echo / OUT / Gnd)
To
Board = (Vcc / Echo / Trigger / MODE / Gnd)
My testing code is this:
'symbol trig = 3 ; Define output pin for Trigger pulse (A, M, X, X1 parts)
'symbol echo = 6 ; Define input pin for Echo pulse (A, M, X, X1 parts)
symbol trig = b.3 ; Define output pin for Trigger pulse (M2, X2 parts)
symbol echo = b.6 ; Define input pin for Echo pulse (M2, X2 parts)
symbol range = w1 ; 16 bit word variable for range
main:
pulsout trig,2 ; produce 20uS trigger pulse (must be minimum of 10uS)
pulsin echo,1,range ; measures the range in 10uS steps
pause 20 ; recharge period after ranging completes
let range = range * 5 / 58
if range>20 then '**My Own Test**
sound S.12, (50, 20) 'One kind of sound, if something is far.
elseif range<10 then
sound S.12, (112, 1) 'Another kind of sound, if something is close.
endif
goto main 'And around forever
I'll be honest, I don't know how to use the debug window in Axepad or Programming Editor.
So, What can I do? I just want the sensor work correctly.
Thks.
Jorge.