Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SRF04 output problem

Status
Not open for further replies.

Azaruk

New Member
I built the SRF04 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 negative 10V is being generated correctly.

All this indicate that things are happening as designed, BUT .......

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?
 
Last edited:
I see no 555 timer in the SRF04 circuit? Regardless a schematic of everything would help.

And if there are no hardware problem as you claim (which can be a big if), and the PIC Is misbehaving it might very well be a software problem.
 
Last edited:
SRF04 problem

Thanks for the fast reply!

No, there is no 555 in the SRF04. I have built the SRF04 module.
To test it, I am using an external 555 oscillator connected to the trigger pin of the SRF04.

As I said, the signals that ARE being produced seem to be OK.

There are definitely 8 pulses being generated to drive the MAX232 and the transmitter unit. There is definitely a signal being received by the amplifier and the comparator is producing pulses which vary in width as an obstruction is sensed.

The output pin (6) of the PIC, though, remains at 0V.

I have tried a pull-up resistor on the output, with no difference.

Do you have the SRF04 schematic? If not I'll post it, but at www.robot-electronics.co.uk, there is a schematic and source code available under the SRF04 item.

Thanks again for trying to help. I am totally lost!
Regards
 
Last edited:
Software hassle

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 is well.

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.
 
From the start without diving deep into the code, I see a possible mismatch between schematic and code. Code has pulse = gpio1 and echo = gpio2. These are the reverse in the schematic.
 
Last edited:
No. The pin assignments are correct.

GPIO,0 (pin7) is the trigger input from the host. In my case, for testing, the 555.

GPIO,1 (pin6) is the output to the host system (the one that's stuck low) on my module.

GPIO,2 (pin5) is the input to the PIC from the comparator (part of the SRF04 module).
 
GPIO,1 (pin 6) is an output. It should have a pulse on it whose width is proportional to the echo time. It is asserted high when the pulses to the transmitting transducer are sent, and drops to low when an echo is received.

I have a suspicion that the Watch-Dog timer is holding things reset. How would I prove it? Switch the WDT off and remove the WDT_Clear?

The other concern I have is that the original circuit used a 12C508, while I have used 12F508.

Does anyone know whether there are any changes that have to be made in order to use the FLASH version?

I have looked at the data sheets, but can't see anything obvious.

I have also managed to erase the OSCCAL settings from the chip. Is there any way to re-enter the values?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top