Questions tagged [hc-sr04]

For questions about the HC-SR04 ultrasonic ranging sensor.

Filter by
Sorted by
Tagged with
1
vote
1answer
210 views

Arduino Uno with HC-SR04 Power saving

My Arduino Uno is powered by 9v battery to run 2 ultrasonic sensors (HC-SR04) and a buzzer. I intend let the circuit run for at least a week. Is there a solution to reduce power consumption / increase ...
0
votes
1answer
114 views

Trying a crude water level sensor

first of all, Im from Cuba, that means I may have some problems to find parts... I have a little system to measure the water level in my house water tank. The system is pretty rough: a proximity ...
1
vote
1answer
23 views

How do I get sensor values using transmitter and reciever

I used an HC-SR04 sensor and connected it to an arduino board (BOARD1) with a 433 mhz transmitter and the other board (BOARD2) is connected to the 433 mhz receiver but I don't know how to see the ...
1
vote
0answers
29 views

What is wrong with my code? (HC-SR04 using 433 mhz module);

I asked a question about this last time but I still couldn't make it work but it somehow gave me an overview about my project. Now I've created an another project that is similar to the last one, the ...
1
vote
0answers
20 views

How do you count objects (using ultrasonic sensor HCSR04) as 1, after they leave the trigger/echo path?

I found a simple code online that meets my goal to almost 100%, however when I place my hand in front of it, the number continues to count. I am trying to only count "1" when the solid ...
1
vote
0answers
37 views

Ultrasonic HC-SR04

Having trouble with arduino Ultrasonic Sensor Module HC-SR04 I'm sure when you read this you're going to say how stupid can he be and you're probably right but I'm 82 years old and I'm trying very ...
1
vote
0answers
92 views

ESP-01 and HC-SR04 problems booting up

I have a problem in a project that I am working, basically I need to use a ESP-01 to receive the measurements from a HC-SR04 and send it to another ESP-01 (which I won't cover here). Basically my ESP ...
-1
votes
1answer
220 views

Why is my Arduino code for running a Bluetooth controlled robot with obstacle sensor not working as it should be?

I have created a Bluetooth based smartphone controlled robot (a 4 wheel car) earlier using Arduino and an obstacle avoidance robot. Now, I wanted to combine both of them. So, I combined their ...
1
vote
1answer
717 views

Connecting multiple ultrasonic sensors(hc-sr04) to a single arduino board.(mega)

I am currently working on an alarm system using multiple sensors and one arduino board and I am getting readings from 2 of the sensors but one gives a constant zero and a constant buzzer sound even ...
3
votes
1answer
177 views

Ultrasonic Sensor(HC-SR04) recording random distance

I am am trying to make a code which automatically controls relay on basis of ultrasonic sensor measurements. I am using a nodeMCU as a microcontroller rather than an arduino. The relay and the ...
0
votes
1answer
65 views

Error for compiling for board Arduino Uno

I am new to Arduino and just got this error after writing this code:The error message is pasted after the code. I am kindly requesting for assistance so that someone can help me understand why it isn'...
1
vote
0answers
75 views

Why is my buzzer always on?

I wanted to make a buzzer go off when the distance measured by the ultrasonic sensor becomes more than 100cm. The things used in this project are a 4x4 keypad, an hc-sr04 ultrasonic sensor, and a ...
0
votes
1answer
44 views

Arduino Coding Issue

I'm running a water pump based on ultra sonic readings. Once the Ultra Sonic Sensor reads > 10 cm , I want the water pump to start until sensor reads < 5 cm. Would you please help me adjust the ...
1
vote
1answer
274 views

Code for 2 ultrasonic sensors

This is my code: int trigPin=13; //Sensor Trig pin connected to Arduino pin 13 int echoPin=11; //Sensor Echo pin connected to Arduino pin 11 float pingTime; //time for ping to travel from sensor to ...
0
votes
2answers
863 views

HC-SR04 ultrasonic sensor: How to check voltage on the ECHO pin

I'm using and ESP8266 with HC-SR04 ultrasonic sensor. The sensor requires 5v input and will also output to the GPIO pins at 5V. ESP8266 has a strong recommendation to use 3.3V into the GPIO pins. I'...
1
vote
0answers
64 views

Combining two scripts

I'm trying to combine two scripts I've found. One to get my remote control model to work via a controller and the other to enable 6 ultrasound modules I have. When I omit the code highlighted in "THIS ...
1
vote
3answers
775 views

How far can a HC-SR04 can stand from the microcontroller?

I was wondering if I connect a HC-SR04 to an Arduino or any other microcontroller by normal cables, what would be the maximum length of this cable so that the measurements will still be true, and not ...
0
votes
3answers
2k views

Level shifting 5V <-> 3.3V

My main goal is to use connect the HC-SR04 ultrasonic sensor with ESP8266. Problem is, HC-SR04 works with 5V while the ESP8266 works with 3.3V In order to solve this, idea would be to use a logical ...
1
vote
0answers
114 views

ESP8266 GPIO limitations with HC-SR04

I want to build a systems that measures if some parking spots are occupied or not. I chose to use an ESP8266 12-E NodeMCU Kit with multiple HC-SR04 ultrasonic sensors. In my project, it is essential ...
1
vote
2answers
11k views

No headers (.h) found in Documents\Arduino\libraries\arduino_144469 with demo code

I followed this tutorial for a demo code for the SR04 ultrasonic distance sensor (without the LCD display). I've installed the Arduino IDE and wrote the code in it and saved it in some location. ...
0
votes
1answer
264 views

HC-SR04 Echo Pin Fails To Go Low After Trigger Pulse

I have implemented an HC-SR04 distance sensor using an Arduino. After power up, the sensor operates well when objects are within range of the sensor. However, if the distance to be measured exceeds ...
2
votes
3answers
3k views

HC-SR04 distance measuring without delay?

I am using the HC-SR04 ultra sound sensor for Arduino. I have used the following code to calculate distance and it works perfectly. long duration; digitalWrite(trigger, LOW); ...
1
vote
0answers
19 views

Getting weird output for following object detection code using interrupts on HUZZAH ESP8266 and motor controller L293D along with 3 HCSR04 sensors

I am trying to implement a bot which can sense obstacle in front, left or right and post detection send interrupts. Which in turn will perform the appropriate motor function to avoid these obsticles. ...
2
votes
3answers
239 views

Arduino ultrasonic sensor weird output

So I just got into arduino and bought Elegoo's car robot v3 kit and built it, but when I put the robot on "object avoidance" it constantly spins as though there is an object in front of it. I tried ...
-1
votes
1answer
306 views

NodeMCU with HC-SR04 ultrasonic sensor

How can I interface an ultrasonic sensor with a MCU with 3.3 V GPIO like the NodeMCU? I tried powering the sensor with both 5 V and 3.3 V from the MCU. Both failed to show any results as the distance ...
0
votes
2answers
196 views

Help with Stair Lighting using HC-SR04 sensor and WS2812 LED Strip

Excuse my naivete in this as I am very new to Arduino and the programming of. I am trying to put together a project for stair lighting triggered by a ultrasonic sensor at the bottom of the stairs and ...
1
vote
0answers
489 views

HC-SRO4 always returns zero no matter what I do?

Wondering if it's the sensor or the code? can anyone help? I've used the code here /* HC-SR04 Ultrasonic Sensor with LCD dispaly HC-SR04 Ultrasonic Sensor VCC to Arduino 5V GND to Arduino GND ...
0
votes
1answer
152 views

Waking Arduino from sleep with an ultrasonic sensor

I have a parking guide using an ultrasonic sensor (HC-SR04), based on the instructions here. I'm trying to modify the code so that the Arduino goes to sleep after a certain period of inactivity (say, ...
0
votes
1answer
61 views

Problems when attaching a second ultrasound sensor (HC SR04)

I am working on an obstacle avoiding robot. It uses an ultrasound sensor to avoid obstacles, but currently has trouble avoiding objects that are diagonal to it. Thus, i want to add a second ultrasound ...
3
votes
0answers
1k views

(Arduino + official GSM shield + ultrasonic HC-SR04 sensor) inaccurate measuring

I'm using an Arduino Uno, 1.0.5 r2 version of the IDE with and ultrasonic HC-SR04 sensor for measuring a tank water level. I want to send the data obtained over internet using the official arduino GSM ...
0
votes
1answer
258 views

Problem with interrupts

Alright. This is what I wanted to do: Make a circuit and code the arduino such that there are 2 tactile switches, each with a predefined pwm value. Whenever any one button is pressed the led should ...
0
votes
1answer
166 views

Bending pins of HC-SR04 [closed]

I got a question regarding the ultrasound sensor (HC-SR04) connecting to the arduino. I have a project, and the space is really tight, so i will have to bend the pins of the HC-SR04. Is this okay to ...
1
vote
1answer
5k views

Getting 0 cm from ultrasonic sensor when nothing is in front

My Ultra sonic sensor (HC-SR04) is returning these types of values when it has nothing in front: Ping: 144cm Ping: 0cm Ping: 0cm Ping: 0cm Ping: 105cm Ping: 105cm Ping: 94cm Ping: 0cm Ping: 378cm ...
2
votes
3answers
2k views

Convert from 3 V to 5 V

I'm new to Arduino, electronics, and this forum. I have made up a little project that connects an HC-SR04 ultrasonic range detector, and displays the distance on a 4 digit, 7 segment LED display. ...
2
votes
3answers
5k views

Is my HC-SR04 sensor broken?

I am extremely new to Arduino and electrical engineering, and the project I am attempting involves a ultrasonic sensor. I am using the HC-SR04 with the Elegoo Mega2560 Arduino board. A few days ago ...
1
vote
1answer
134 views

SdFat initialization blocks HC-SR04

I appreciate the help of this forum very much and it`s my first time to ask you experts befor driving crazy... ArduinoUno and SDcard-BreakOutboard and DistanceSensor HC-SR04 are not working well ...
1
vote
0answers
120 views

HC-SR04 systematically finding a weird value

I have a HC-SR04 connected to my Arduino. its all working very nice. Yet with a constant interval a weird value appears (see the Serial Plot picture). I am wondering what causes this. I will soon ...
1
vote
2answers
1k views

How do I make the HC-05 bluetooth module take data from the HC-SRO4, and then send it to my Android app?

Currently, I have an Arduino Uno set up, with a HC-SRO4 ultrasonic sensor printing distances of objects in front of it on a scale from 1-15 to the serial monitor. I want to attach the HC-05 bluetooth ...
0
votes
1answer
385 views

Arduino HC-SR04 water experiment

I am working on an experiment with the HC-SR04 sound sensor, and i am using it to record the speed of sound. I successfully measured the speed of sound in air, but when measuring it in water, I ...
1
vote
2answers
4k views

JSN-SR04T-2.0 with NodeMCU not starts after reset or reconnect usb power

I have bought a NodeMCU (1.0) and a JSN-SR04T waterproof ultrasonic sensor compatible with HC-SR04. If I upload my program to NodeMCU it works but sometimes it measures a wrong distance - it is an ...
0
votes
1answer
914 views

Strange discrete errors when reading HC-SR04 sonar sensor

I'm experimenting with an HC-SR04 sonar sensor. Basically I'm measuring the distance to a cardboard box twice a second with these lines of code running on an ESP32: unsigned long sonarMeasure() { ...
0
votes
2answers
483 views

Communication between Arduino Uno and Mega

I am working on a project which uses a set of sensors (HC-SR04). These sensors use pins 2 to 13 of the Arduino Uno. Here you can find the board: . I also want to add an MP3 shield (VS1053B) to it ...
1
vote
2answers
3k views

Transmitting Variables over RF

I'm using the 3715 RF arduino modules and a hc-sr04, and i'm trying to send the distance i get from the ultrasonic over to the arduino with the rf recieving module but i get something like this: ...
1
vote
3answers
950 views

Arduino with 2 echo sensors

For a project I'm doing I need the Arduino to be connected to two echo sensors (I have the HC-SR04). Currently I have 4 sensors that I can use, but I will need only 2 or 3. I have almost no knowledge ...
1
vote
1answer
359 views

Object Sensor on conveyor belt (want to record the data in EEPROM for testing)

void setup () pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(LED_Blue_pin, OUTPUT); pinMode(LED_White_pin, OUTPUT); Serial.begin(9600); digitalWrite(LED_Blue_pin, LOW); digitalWrite(...
1
vote
2answers
3k views

How often can I ping an HC-SR04 ultrasonic sensor?

In my current project, I want the sensor to be continuously scanning for a value of less than 30cm. I was wondering how long of a delay I need (if any) between each call of the ping function. It ...
2
votes
0answers
191 views

Interference in readings

I have an project which control a heat exchanger. I read 4 temperature sensors DS18B20, a distance with HC-SR04 Ultrasonic Sensor, and a flow with YF-S201 (with attach interrupt). I can turn on and ...
2
votes
1answer
192 views

Keep RTC time in a loop

I recently started a project with HC-SR04 sensors and RTC DS1302 clock. The idea is when a sensor detects an object, call and keep a timestamp (hh:mm:ss) all over the loop until Else If{} appears, ...
2
votes
2answers
4k views

Ultrasonic HC-SR04 echo and trig pins

I am doing a watch with GPS tracker project. I am using an Ultrasonic HC-SR04 sensor. I don't know where to connect the Echo and trig pins with my Arduino. Please let me know how to connect it.
2
votes
1answer
109 views

Ultrasonic distance module works without connecting to gnd

I have a (HCSR04) ultrasonic distance module connected to arduino , i have connected all the four pins of the module properly and its working fine , then when i pull off the wire which is connected to ...