Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Using the HC-SR04 Ultrasonic Distance Sensor with Arduino - Everything you need to know!

HC-SR04

Ultrasonic Sensor

Arduino

Arduino tutorial

obstacle avoidance

beginners Arduino project

ultrasonic range finder

Arduino Library

NewPing

DHT22

Distance Sensor

HCSR04

Автор: DroneBot Workshop

Загружено: 29 июл. 2017 г.

Просмотров: 632 129 просмотров

Описание:

Learn everything you need to know to use the HC-SR04 Ultrasonic Distance Sensor with an Arduino.

Get more info and all the sketches at https://dronebotworkshop.com/hc-sr04-...
More articles and tutorials: https://dronebotworkshop.com
Join the conversation on the forum: https://forum.dronebotworkshop.com
Subscribe to the newsletter and stay in touch: https://dronebotworkshop.com/subscribe/

The HC-SR04 Ultrasonic sensor is a versatile device that has become a staple in robotics projects. This inexpensive component measures the distance between itself and the nearest solid object using pulses of ultrasonic sound. It has reasonable accuracy “out of the box” and can be made even more accurate with one additional component.

In this tutorial, we’ll learn how to use the HC-SR04 with an Arduino. As it turns out there is more than one way to do this, so we’ll examine them all. You can apply the same knowledge to use the sensor with other microcontrollers or with a microcomputer like the Raspberry Pi.

We’ll start by learning how the HC-SR04 works and how its input and outputs function.

Next, we’ll connect it to an Arduino and write a simple sketch to make it work. I'll show you the test arrangement I set up on my workbench and we’ll use that to measure the accuracy of the sensor.

Then we’ll move on to some improved code using a “code library” called “NewPing”. If you are new to the Arduino and have not used a code library before then this is an excellent opportunity to learn how to increase your programming expertise. Actually, we will end up using three code libraries by the time the video has finished and I’ll show you two different methods of doing this.

While the sensor is reasonably accurate there is room for improvement, as our bench testing will confirm. I’ll show you how you can add an inexpensive temperature and humidity sensor to increase the accuracy of the HC-SR04 by compensating for the change in the speed of sound due to the ambient temperature and humidity.

We will also see how the HC-SR04 can be used in “3-Wire Mode”, eliminating one connection to the Arduino without sacrificing performance. This is great information if you need to save an Arduino I/O pin for another application.

And finally, we will see how we can use multiple HC-SR04’s in the same circuit, a common requirement when building a robot.

This video (and it’s accompanying article at http://dbot.ws/hc-sr04) has pretty well everything that you’d ever need to know to use the HC-SR04 at its full potential. Because of this, it’s pretty long, so here is a breakdown of the contents if you’d like to skip ahead:

00:00 - Introduction
01:46 - How the HC-SR04 Works
08:21 - Basic Arduino Hookup
08:53 - Sketch 1 - Basic Hookup Demo
14:03 - NewPing Code Library
14:21 - Sketch 2 - First NewPing Test
19:20 - Sketch 3 - NewPing with Duration
21:56 - Sketch 4 - NewPing with Iterations
24:37 - Getting Improved Accuracy
26:47 - Using the DHT22
28:31 - Sketch 5 - DHT22 Test
33:06 - Sketch 6 - Improved HC-SR04 with DHT22
38:03 - The HC-SR04 in 3-Wire Mode
38:54 - Sketch 7 - HC-SR04 in 3-Wire Mode
39:51 - Using Multiple HC-SR04 Sensors
41:08 - Sketch 8 - Multiple HC-SR04 Test

Remember, you can get all the sketches and more information on the website at https://dbot.ws/hcsr04info . And while you are on the DroneBot Workshop website be sure to check out all the other articles. I’ve added a “Resources” section to all of the articles to give you downloads and handy links, hopefully, you’ll find this useful.

As always please comment below and please subscribe!

Using the HC-SR04 Ultrasonic Distance Sensor with Arduino - Everything you need to know!

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

The Arduino Family - Uno - Mega - Nano - Pro Mini -ATtiny85

The Arduino Family - Uno - Mega - Nano - Pro Mini -ATtiny85

Programable Logic Controller Basics Explained - automation engineering

Programable Logic Controller Basics Explained - automation engineering

I2C Part 1 - Using 2 Arduinos

I2C Part 1 - Using 2 Arduinos

How Potentiometer Works - Unravel the Mysteries of How potentiometers Work!

How Potentiometer Works - Unravel the Mysteries of How potentiometers Work!

How to Build a Satellite

How to Build a Satellite

STM32 Guide #2: Registers + HAL (Blink example)

STM32 Guide #2: Registers + HAL (Blink example)

ESP32 CAM - 10 Dollar Camera for IoT Projects

ESP32 CAM - 10 Dollar Camera for IoT Projects

LLM и GPT - как работают большие языковые модели? Визуальное введение в трансформеры

LLM и GPT - как работают большие языковые модели? Визуальное введение в трансформеры

Making robot navigation easy with Nav2 and ROS!

Making robot navigation easy with Nav2 and ROS!

Главный враг США. Изгой с ядерной бомбой

Главный враг США. Изгой с ядерной бомбой

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]