Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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 module measure distance

haohaodk46

Member level 3
Joined
Apr 8, 2012
Messages
62
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,288
Activity points
1,712
Hi all,
This is circuit for module SRF04
1656232353059.png



Why do The everyone know 2 pin P5.1 , P5.2 from STC11 connect to Max232. The STC11 will generate 40Khz on P51 , P5.2 both to ultrasonic 40T ?. If only using a pin of ultrasonic 40T and left pin connect then is it ok ?
How to code for STC11 or any microcontoller for control 40T and read frim 40R ? Anyone have code sample for this ?
Regard ,
Hao
 

doraemon

Super Moderator
Staff member
Joined
Jun 21, 2009
Messages
1,165
Helped
284
Reputation
576
Reaction score
274
Trophy points
1,363
Location
Japan
Activity points
11,816
Hello!
If you look for SRF04.c on the net you will find many examples.
That said, the best method would be to do it yourself and understand what you are doing. As far as I remember, it delivers a pulse (receive pulse), the length of which is related to the distance. So basically, here is how to measure.
- Set up a timer with some clock. The higher the frequency the better.
- Trigger your timer start with a rising edge interrupt
- Trigger your timer stop with a falling edge interrupt
That's it, you get the value.
Have fun!
Dora
 

haohaodk46

Member level 3
Joined
Apr 8, 2012
Messages
62
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,288
Activity points
1,712
Hello!
If you look for SRF04.c on the net you will find many examples.
That said, the best method would be to do it yourself and understand what you are doing. As far as I remember, it delivers a pulse (receive pulse), the length of which is related to the distance. So basically, here is how to measure.
- Set up a timer with some clock. The higher the frequency the better.
- Trigger your timer start with a rising edge interrupt
- Trigger your timer stop with a falling edge interrupt
That's it, you get the value.
Have fun!
Dora
You are wrong my mean . I mean that I want to control direct from STC11 ( above schematic ) . As SRF04 or other ultrasonic module , It is using a microcontoller that programmed. Thus I want to know how to that microcontroller work. As above schemtic , Why does It use 3 pin P5.1 and P5.2 instead of 1 pin P5.1 to generate to transmit ultrasonic ?
 

doraemon

Super Moderator
Staff member
Joined
Jun 21, 2009
Messages
1,165
Helped
284
Reputation
576
Reaction score
274
Trophy points
1,363
Location
Japan
Activity points
11,816
Hello!

As I think you use some kind of automatic translation software, it makes your request very difficult
to understand. Example

You are wrong my mean

???
Is it "You misunderstood my question"?

Beside this:

Why does It use 3 pin P5.1 and P5.2 instead of 1 pin P5.1

???
For my understanding, P5.1 and P5.2 are 2 pins. But "3 pin" is missing a s, so it may also mean P5.3 which is used to power the MAX3232.

Maybe you want to know why 2 pins instead of 1? You are sending a signal to the piezo device. One way is to put 1 pin to ground and drive the other pin. This is a single end transmission. The voltage at the piezo actuator will go like 0V, 5V, 0V, etc. The amplitude is therefore 5V. If you use both pins and drive them like from 01 to 10, then you will have -1V, 5V, -5V, etc, twice the amplitude.

Dora.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,573
Helped
5,036
Reputation
10,096
Reaction score
4,876
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
131,988
As I understand it, and of course I don't know what code is inside the STC11, P5.1 and P5.2 will be driven in software so they are always at opposite logic levels '01' or '10'. They connect to the two MAX3232 transmit channels so the 3.3V logic levels are increased in voltage to maybe 7 or 8V (whatever the MAX3232 output voltages happen to be). Driving them out of phase gives a greater drive voltage to the T40.

That is not the best way to drive the T40 for best results but it does increase the voltage and therefore range.

Brian.
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top