Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SRF04 output problem: default routine doesn work correctly

Not open for further replies.


Member level 1
Feb 12, 2007
Reaction score
Trophy points
Activity points
srf04 and pic

I built the SRFo4 unit as shown in the schematic from Devantech. I used a PIC12F508 rather than a 'C' device as my stockist only carries the 'F' version.

I changed the processor statement in the source code to reflect the 'F' device.

I am triggering the module from a 555-based oscillator - transistor inverted to give a 10uS high level, with about 50mS low period.

Scoping around the circuit shows pulses appearing on 7 and 14 of the MAX232, a good transmit signal, a decent amplified received signal, variable width pulses at pin 5 of the PIC (varying as an object is moved back and forth in front of the transducers), but the is nothing out of pin 6 of the PIC.

The -10V supply is being generated correctly.

Pin 6 remains at a low level.

The PCB has been checked countless times and is 100% correct.

I do not know what I could have done wrong.

I have tried two PICs - the chances of both being identically faulty would be remote.

Has anyone else tried building their own SRF04 units, and did they work?

Can anyone shed some light on the subject?

Added after 2 hours 6 minutes:

Looks like a software problem.....
In the source code supplied by Devantech, there ar two ECHO routines. The default is a transistion detection on the echo line.

The other is a bit more sophisticated - it looks for 3 cycles of 40kHz to give a valid output.

I commented out the default, uncommented the 3-cycle detect routine, reassembled, burnt the PIC and all seems OK, there are pulses appearing at the ECHO pin. They don't seem to vary, but I'll check more deeply a bit later.

I'll look into the code in more depth when I have some time and try to determine why the default routine doesn't function correctly.

SRF04 output problem

Thi thread has been looked at by 42 viewers! And not one can offer any assistance? Hard to believe with all the PIC specialists here.

Could it be the watchdog timer holding the output reset?

Are there any config differences, or other slight differences between the 12C508 and 12F508?

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to