Book Image

Arduino Robotic Projects

By : Richard Grimmett
Book Image

Arduino Robotic Projects

By: Richard Grimmett

Overview of this book

Table of Contents (21 chapters)
Arduino Robotic Projects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Connecting a sonar sensor to Arduino


Here is an image of a sonar sensor, HC-SR04, which works well with Arduino:

These sonar sensors are available at most places that sell Arduino products, including amazon.com. In order to connect this sonar sensor to your Arduino, you'll need some of those female-to-male jumper cables that you used in the previous chapters. You'll notice that there are four pins to connect the sonar sensor. Two of these supply the voltage and current to the sensor. One pin, the Trig pin, triggers the sensor to send out a sound wave. The Echo pin then senses the return from the echo.

To access the sensor with Arduino, make the following connections using the male-to-female jumper wires:

Arduino pin

Sensor pin

5V

Vcc

GND

GND

12

Trig

11

Echo