SRF05 circuit and code

ashawthing

New Member
Just made a small circuit to interface an SRF05 using an 08M. The idea is that the program reads the length of the output pulse from the sensor (which will be between 100uS and 30mS). This is then compared to a value from "readadc", the voltage is controlled by a variable resistor placed across the 5V supply.

The output from the circuit is simply a 1 or 0 depending on which value is greater. However I'm having trouble getting the circuit to function as I intend. I think I may be doing somthing slightly wrong in the calculations. I cant seem to get the full range of the sensor. I have tried adjusting the numbers a bit but below is about the best I can get.

The closest I can get the trigger distance to the sensor is about 20cm but then as i increase the variable resistor the trigger distance very rapidly reaches the maximum distance the sensor can recognise (about 4m). I would like a steady increase from minimum to maximum over the full travel of the variable resistor.

I have attached a circuit diagram and code. In the circuit diagram, on the 08M pin 3 is used as a trigger, it will be connected to a seperate circuit. Pin's 4 and 6 are input and output pin's for the SRF05 sensor.

Any help with the code would be greatly appreciated.

Another problem I am having is with programming the chip. I am not able to program the 08M on this board, the editor gives me an error saying the chip is not powered, then list a few other possibilies. Am able to program it fine on a separate board.
 

Attachments

slurp

Senior Member
I don't quite get the concept in terms of interface to SRF05, not read the code yet... in terms of programming I'd expect there to be a link between the LED part of the circuit and the programming - connected to one or other but not both.

regards,
Colin
 

hippy

Ex-Staff (retired)
Check the download connector is wired up correctly. If you've got RX, TX or 0V crossed-over it won't work. You can use the View -> Options -> Serial Port -> Test to help with that.
 

ashawthing

New Member
Check the download connector is wired up correctly. If you've got RX, TX or 0V crossed-over it won't work. You can use the View -> Options -> Serial Port -> Test to help with that.
Just tried the test and all seemed to work ok but it still wont program, when the test signal was off it wasn't exactly -1V though, it was more like -0.5V
 
Last edited:

inglewoodpete

Senior Member
Could you post a couple of photos of your setup? Sometimes others can see a wiring/board error that you can't.

-0.5v should be ok for the idle state. Does the Serial In pin (leg #2) go high when when you press the "test" button in the Programming Editor's test window? If so, does the serial out pin (Leg #6) output bursts of pulses at the same time?
 

Bill.b

Senior Member
hi

the srf05 requires a 10 mS rechage time. may be this is what is giving you problems.


pulse:
pulsout 1,1 'Produce a 10us pulse on pin 1
pulsin 3,1,distance 'Read the length of the pulse on pin 3
pause 10 ' SRF04 mandatory 10mS recharge period after ranging completes

distance=distance/120 'Convert the length of the pulse roughly into divisions of 255

return
 

Xinxin

New Member
I am sorry but if no any defence,could anyone provides me the circuit of SFR05 itself?
As I can see it's much simplier than SRF04
and I hate the way to use RS232 to send pulse out
 

westaust55

Moderator
Hello Xinxin,

Firstly Welcome to the PICAXE forum.


,could anyone provides me the circuit of SFR05 itself?
As I can see it's much simplier than SRF04
Can you please clarify, are you (a) seeking the schematic diagram of the actual SRF05 module, or (b) how to connect the SRF05 to a PICAXE microcontroller?
IF (a) then the Manufacturer (http://www.robot-electronics.co.uk/) has copyright over the design and does not provide schematic diagrams for these modules.
If (b) then see: otherwise see: http://www.robot-electronics.co.uk/htm/srf05tech.htm

and I hate the way to use RS232 to send pulse out
Are you trying to control the SRF05 directly from a computer/PC/laptop or using a PICAXE microcontroller.


Edit: for connection to a PICAXE may be this thread where I posted a connection arrangement sketch will help: http://www.picaxeforum.co.uk/showthread.php?24386-Can-i-Use-SRF05-Ultrasonic-Range-Finder-In-PICAXE-08M2/page2
 
Last edited:
Top