Jump to content
43oh

[hc-sr04]3.3V may not triggger the 5.5V device well?


Recommended Posts

Hello Stellaris Community.

This is my first post up in this community. I will be very grateful if you give me some advice. I am not sure if it is okay to post this subject in this forum.

I am using lm3s8962 board and Stellarisware 10636 library. HC-SR04 is a distance finder.

I have been working on hc-sr04 devices for a long time. I really don't know why the result I get keeps unreliable. I may have a lot of questions. But I start by a question I am not sure of.

 

First of all, I am aware of the device requirement. Those are the requirements of the datasheet hc-sr04.

 

Working Voltage DC 5 V
Working Current 15mA
Working Frequency 40Hz
 
 
In order to work the device, I need to trigger at least 10uS high pulse to the trigger pin of the device. My question comes here. As the datasheet says, my mcu creates 3.3v GPIO pulse, and it provides up to 25mA current. Do you think triggering the 5.0V device with 3.3V gpio high pulse may not work well? This one can be a cause to affect the accuracy?
 
I would appreciate your help.
Dongseop
Link to post
Share on other sites

Well...

I think I am using similar configuration.

 

I connected:

HC-SR04 pin named "Vcc" to Stellaris board pin named "VBUS" 

HC-SR04 pin named "Trig" to Stellaris board pin named "PE4" 

HC-SR04 pin named "Echo" to Stellaris board pin named "PF4" 

HC-SR04 pin named "Gnd" to Stellaris board pin named "GND" 

 

And it works...

 

I think, GPIO E4 has level of 3.3V. And it seems is enough to trigger measurement.

Also, "Echo" is correctly recognized on pin F4. It seems 5.0 V it is not too much for GPIO.

 

 

I am also novice in this area. Maybe some expert should give us advice (comment).

Link to post
Share on other sites

LM3S8962 is 5v0 tolerant on GPIO only if the processor pin is configured as an input, so the "ECHO" pulse is okay. A small current-limit resistor may be a good idea though.

 

HC-SR04 logic levels are TTL, so any signal between GND and 0.8v is considered logic "LOW"; any signal above 2.2v to VCC is considered logic "HIGH". Therefore, driving the "TRIG" signal with 3v3 falls within the level requirements for the device.

Link to post
Share on other sites

thanks for reply. 

The HC-SR04 module send out an 8 cylcle burst of ultrasound at 40kHz and raise its echo. 

I set my board's system clock as 50 mHz and calculate the pulse width from the echo pin of the hc-sr04.

Do you think I need to change my board's system clock same as the system clock of the hc-sr04 module? Do I need to compensate the pulse width because I get the 40kHZ pulse? 

As I look at the datasheet, there is no specification which system clocks hc-sr04 use. I am guessing maybe this module is only made for Arduino. I found many references working the module with Arduino but Arm board. 

 

 

 

 

 

 

 

Link to post
Share on other sites

thanks for reply Kartman

As the processor doesn't matter with the measurement, I have really no idea why I get the unreliable results. 

 

To trigger the device, as the datasheet recommends, I use a pwm signal with 60 ms period and its duty cycle corresponds to 10uS high pulse. Do you think it is not appropriate to trigger the device with a pwm signal? maybe when calculating the pulse width, pwm should not trigger the device.

 

I am using code composer studio v6 and stellaris library. My target is lm3s8962. 

 

I appreciate your help.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...