Questions tagged [hc-sr04]

For questions about the HC-SR04 ultrasonic ranging sensor.

Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

How to map floor using arduino and HC-SR04 [closed]

I am working on a bot controlled by Arduino-UNO using HC-SR04. I want my bot to go around the floor, avoiding all obstacles, covering the entire floor. I tried measuring wall distance on all sides ...
0
votes
1answer
25 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
48 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
votes
2answers
84 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'...
0
votes
0answers
42 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 ...
0
votes
0answers
36 views

How to program GPS and Compass guided robot? [duplicate]

I am using the following things... Ublox Neo 6m GPS module HMC58883L magnetometer HC 05 for BT HC SR04 for obstacle avoidance Arduino mega I am using the following libraries (given as links): 1....
0
votes
3answers
119 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
0answers
34 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 ...
0
votes
0answers
27 views

How can I connect as many HC-SR04 as I can to my ESP8266

I have an ESP8266 to which I want to connect a few ultrasonic sensors. I need to poll them every second in order to calculate the distance they measure. Because ESP8266 doesn't have many digital pins, ...
0
votes
3answers
306 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 ...
0
votes
0answers
16 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
123 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 ...
0
votes
2answers
83 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 ...
0
votes
0answers
93 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
74 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, ...
-1
votes
1answer
115 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 ...
0
votes
1answer
42 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 ...
0
votes
2answers
6k 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. ...
-2
votes
1answer
324 views

How to fade an RGB with distances from an Ultrasonic Sensor (HC-SR04) so that they do not fade completely [closed]

Implement an Ultrasonic sensor to register the distance of objects in front of the sensor and display the values of these distances on the serial monitor in real time. Use an RGB LED to represent ...
0
votes
1answer
150 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 ...
-1
votes
1answer
257 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
1answer
149 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
107 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
3k 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 ...
1
vote
1answer
102 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 ...
0
votes
0answers
92 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 ...
0
votes
1answer
729 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
411 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 ...
2
votes
3answers
3k 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
309 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(...
0
votes
2answers
3k 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 ...
1
vote
0answers
152 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
170 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.
1
vote
1answer
73 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 ...
1
vote
2answers
951 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 ...
2
votes
3answers
1k 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. ...
0
votes
1answer
747 views

Trying to map a room with Arduino controlled bot [closed]

What you see above is a map of my room. The boxes in black are obstacles and the box in red is my bot. Now I want my bot to go around the room, avoiding all obstacles, but at the same time, covering ...
0
votes
1answer
322 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
1answer
966 views

How do I use ultrasound to track a moving object?

I'm trying to create a small scale, dumb-downed version of the pitch tracking systems used to detect the speed and direction of baseballs. I'm currently working with an HC-SRO4 sensor and an Arduino, ...
0
votes
1answer
478 views

HC-SR04 pulse at multiple angles

I have a HC-SR04 sensor mounted on a stepper motor, mounted on a car. The idea is this: The car moves forward with the ultrasonic sensor facing the front If the sensor reads a small distance the car ...
2
votes
3answers
2k 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
3k views

Turn on one by one the LEDs of a Neopixel rgb LEDs strip for each detection at the same distance from an Ultrasonic Distance Sensor (HC-SR04)

For this project I seek to create a counter of water glasses we drank throughout the day. I use for this an Arduino UNO card, a Piezo buzzer and a Neopixel rgb LEDs strip (5 LEDs for this test). ...
3
votes
1answer
2k views

Using multiple HC-SR04: sharing trigger pin and interference between HC-SR04

If I have four HC-SR04 detectors, can they share the same trigger pin on the Arduino? This would reduce the number of pins needed from eight to five. Even if they can share the same trigger, maybe ...
0
votes
1answer
1k views

Arduino + UltraSensor - Serial Monitor outputs garbage

I am trying to connect an HC-SR04 to an Arduino Uno. For some reason when I run this code on the serial monitor it outputs wingdings in a straight line. ýòøÿüÿøÿüòý÷ÿ÷ýÿÿúýÿýúÿòý÷ûòûòû÷ýÿøÿøÿÿ÷...
1
vote
3answers
826 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
802 views

How to make battery last for months?

I have a simple circuit: detect that a person is walking towards the circuit (with HC-SR04), measure distance, light diodes (a wave effect) according to that distance – the closer, the faster the led ...
1
vote
2answers
4k views

Alternative distance-meter, HC-SR04 doesn't work very well

On door to my room there is HC-SR04 that triggers led-wave. The shorter the distance, the faster the led-wave (8 leds). The circuit works fine in synthetic tests – moving hand or flat object towards ...
2
votes
1answer
198 views

Simultaneous output from sonar array

I am working on a project that records the elevation changes of a 1 foot wide section using sonar distance measurement. I have 10 HC-SR04 sensors arranged in a straight line over this 1 foot section. ...
0
votes
2answers
2k views

How to turn a LED if ultranonic HC-SR04 reading is on defined range for some interval

My objective is if ultrasonic readings ranging between 1 to 10 cm and no distance change for 10 seconds or more, a LED will turn on. Here is my current code. #define trigPin 7 #define echoPin 8 #...