Ultrasonic HC-SR04 distance sensor in a tube

Hi,this is my first time on the Arduino site.
Currently i'm using HC-SR04 to read the water level in a tube with the next dimensions: diameter 4 '' and large 2 meters, but the sensor only gets the measure of 50cm of the tube.
should i get a new tube with more diameter? or it could be other thing?
Can you, please, have look at this.
Many thanks in advance. I will be happy to read you.

We would be happy to assist you. Please post your entire sketch, in code tags, according to forum protocol. It would also be helpful to see photos of your "tube" installation.

Edit - like this, thank you for providing:

Sorry for my paint, at the moment I can’t take photos, but that will be a graphic representation of how the project would look.
About the code, i use this:

#include <NewPing.h>

#define TRIGGER_PIN 12
#define ECHO_PIN 11
#define MAX_DISTANCE 200

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup() {
Serial.begin(9600);
}

void loop() {
delay(1000);
int uS = sonar.ping_median();
Serial.print("Distance: ");
Serial.print(uS / US_ROUNDTRIP_CM);
Serial.println(“cm”);
}

Your sensor has a beam width it seems like 15 degrees - so it will not take a large distance for the beam to be looking at the tube. Can you mount it without the tube? Also that sensor does not seem to be protected much from the elements.

i need to use the tube because it will be buried to detect the ground water level, should i get a new tube with more diameter?

Shamaal:
. . . , but the sensor only gets the measure of 50cm of the tube. . . .

Do you mean the system works if the water level is 0 to 50 cm and not for 50 to 200 cm?

Speculating since I’ve never done this sort of thing, but it may be that the sonar beam reflecting off the walls of the tube are traveling a greater distance than the direct path of the beam and you get destructive interference between the direct and indirect paths. A larger diameter tube might help if this is the case, but it would have to be quite a bit larger diameter.

Any recommendation with another sensor?

Try positioning the transmit transducer directly in the center of the pipe (the receiver will be offset).

The problem may be due to this:

int uS = sonar.ping_median();

If my math is correct, this will return a round trip time of 29153 uS at 50 cm, which is close to the 32767 maximum "capacity" of a two-byte integer.

The ping_median method returns an unsigned int, so try this:

unsigned int uS = sonar.ping_median();