Ultrasonic Module (HCARDU0047)

Modules for various types of sensors including accelerometers. gyro's, IR motion, etc
Post Reply
admin
Site Admin
Posts: 790
Joined: Sun Aug 05, 2012 4:02 pm

Ultrasonic Module (HCARDU0047)

Post by admin » Sat Jun 20, 2020 9:28 am

Image



1.Working Voltage : 5V(DC)

2.Static current: Less than 2mA.

3.Output signal: Electric frequency signal, high level 5V, low level 0V.

4.Sensor angle: Not more than 15 degrees.

5.Detection distance: 2cm-500cm.

6.High precision: Up to 0.3cm

7.Input trigger signal: 10us TTL impulse

8.Echo signal : output TTL PWM signal



Pinout:


1.VCC

2.trig(T)

3.echo(R)

4.GND




Arduino example:


Image


  1. #define SOUNDCONSTANT 340.29
  2. #define TRIG 2
  3. #define ECHO 3
  4.  
  5. void setup()
  6. {
  7.   Serial.begin(9600);
  8.  
  9.   pinMode(TRIG, OUTPUT);
  10.   pinMode(ECHO, INPUT);
  11.   digitalWrite(TRIG, LOW);
  12. }
  13.  
  14. void loop()
  15. {
  16.   unsigned long TimeMs;
  17.   double DistanceCM;
  18.  
  19.   /* Triggers the module to send a ping */
  20.   digitalWrite(TRIG, HIGH);
  21.   digitalWrite(TRIG, LOW);
  22.  
  23.   /* Measures the time for ultrasonic burst to leave and return. */
  24.   TimeMs = pulseIn(ECHO, HIGH);
  25.  
  26.   /* Calculates the distance to an object in CMs */
  27.   DistanceCM = SOUNDCONSTANT * ((double)TimeMs / 20000);
  28.  
  29.   Serial.print("Distance to object: ");
  30.   Serial.print(DistanceCM);
  31.   Serial.println(" cm");
  32.  
  33.   delay(1000);
  34. }



Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

fedoratio
Posts: 1
Joined: Sat Dec 26, 2020 8:58 pm

Re: Ultrasonic Module (HCARDU0047)

Post by fedoratio » Sat Dec 26, 2020 9:19 pm

Hi guys,
I bought two ultrasonic module sensors (HC-SR04) at hobbycomponents which I connected to an STM32 board and the sensors are working. However I stumbled over something strange. In all the data sheets or specs that I could find, it's indicated that the output-voltage of the ECHO-pin is 5V when the pin is HIGH. However I measured the signal of the ECHO-pin with my (cheap) oscilloscope and the pulse is consistently at 3.4 V even though the VCC-pin is on 5V. I checked both of my sensors and they both behave the same way.
Any ideas what's going on here? Why is everybody talking about voltage dividers and stuff when the sensors already deliver a 3.4V signal?

Thanks a lot for your help!

andrew
Site Admin
Posts: 1076
Joined: Sun Aug 05, 2012 4:15 pm

Re: Ultrasonic Module (HCARDU0047)

Post by andrew » Sun Dec 27, 2020 12:11 pm

Yes I can confirm that the echo pin on the ultrasonic modules that we are currently shipping has a logic high voltage of ~3.4V.

I do need to point out for anyone reading this post in the future though that you should always check the output voltage of module you have before connecting it to a 3.3V microcontroller that isn't 5V tolerant, or if you cannot check this assume that it is 5V.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply