How to switch from using HC-SR04 sensor to URM07 ultrasonic sensor in a circuit

I'm doing a project involving an ultrasonic sensor for object detection. Originally I used a HC-SR04 ultrasonic sensor but then I decided to change it to a URM07 sensor because it had a longer range. I can't figure out how to get the URM07 sensor to work, since it uses TX and RX pins where the HC-SR04 sensor would use Trig and Echo pins.

I've provided a picture of my circuit. Basically, I want to replace the HC-SR04 sensor in my circuit with a URM07 and get it to do the exact same thing except with longer range. Any help would be appreciated.

SEN0153-MAIN-500x500.jpg

hewa_hx:
I'm doing a project involving an ultrasonic sensor for object detection. Originally I used a HC-SR04 ultrasonic sensor but then I decided to change it to a URM07 sensor because it had a longer range. I can't figure out how to get the URM07 sensor to work, since it uses TX and RX pins where the HC-SR04 sensor would use Trig and Echo pins.

I've provided a picture of my circuit. Basically, I want to replace the HC-SR04 sensor in my circuit with a URM07 and get it to do the exact same thing except with longer range. Any help would be appreciated.

Is there a data sheet on your URM07 that give you more of a clue about how to use it?

Paul

Nope. No information was given about how to use it. There are some online tutorials but they are very very limited.

hewa_hx:
Nope. No information was given about how to use it. There are some online tutorials but they are very very limited.

I don't think you even tried!!!! The VERY FIRST Google return for "URM07" gave a link to a very clear specification on how to use the thing and communicate with it.

Paul

I've looked at every single result on the first and second page. They are all very basic and provide no help with my problem. Have you actually read the results? Just because you saw them doesn't prove anything.

The very first one in my search gives:

  • a connection diagram
  • an Arduino sketch

When you hooked it up like that and ran the code, did it give you the right distance?

I'm in the process of switching between two ultrasonic sensors for my circuit. The original one was a HC-SR04 but I switched to a URM07 for better range.

The HC-SR04 uses Trig and Echo pins which I understand how to code, but the URM07 (the one im switching with) uses Rx and Tx pins instead for sending input and output. What does Rx and Tx mean and how do I put it in my code? Can I just plug in the Rx and Tx pins in place of where the Trig and Echo pins once were or do I have to use different code?

Any help would be appreciated.

hewa_hx:
What does Rx and Tx mean

Rx stands for "receive". Tx stands for "transmit".

hewa_hx:
how do I put it in my code?

This sensor has a UART interface. That means you will need to use the appropriate serial commands to configure and read the sensor. Probably the easiest way to work with it is via a library. A quick Google search provided this one:

I can't say whether that is the best library available. You might find some other alternatives with a bit of searching.

hewa_hx:
Can I just plug in the Rx and Tx pins in place of where the Trig and Echo pins once were

You will need to connect the pins to a serial port on your Arduino board. If you don't have a spare serial port then you can create one using the SoftwareSerial library.

hewa_hx:
or do I have to use different code?

Yes you need to use different code. This sensor has a completely different interface from the other sensor you were using previously.

Im using a ultrasonic sensor with tx and rx pins for input and output. How do I write code for the sensor?

Nope. The code doesn't even work, nor does the connection diagram because it doesn't even connect to power! I've looked at that page already and none of the code or diagrams actually work. They provided datasheets, but I have no idea what any of those mean.

Read the how to use this forum - please read stickies and try again by providing enough information so that we can help you.

Also asking here and here

hewa_hx:
nor does the connection diagram because it doesn't even connect to power!

 pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
digitalWrite(3, HIGH);  //Ultrasonic VCC
digitalWrite(2, LOW);   //Ultrasonic GND

Peak Current: <9 mA
Average Current: <5 mA (measured under continuous measurement, for reference only)

Thanks for pointing out the cross posts 12Stepper.

I've merged your cross posts @hewa_hx.

Cross posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes writing a detailed answer on this thread, without knowing that someone else already did the same in the other thread.

Repeated cross posting will result in a suspension from the forum.

In the future, please take some time to pick the forum section that best suits the topic of your question and then only post once to that forum section. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.