Book Image

Arduino By Example

By : Adith Jagadish Boloor, Adith Jagdish Boloor
Book Image

Arduino By Example

By: Adith Jagadish Boloor, Adith Jagdish Boloor

Overview of this book

Table of Contents (18 chapters)
Arduino by Example
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Index

A bit about the sensor


The SR04 is a very powerful and commonly used distance/proximity sensor. And that is what we are going to look at first. The SR04 sensor emits ultrasonic waves which are sound waves at such a high frequency (40 kHz) that they are inaudible to humans. When these waves come across an object, some of them get reflected. These reflected waves get picked up by the sensor and it calculates how much time it took for the wave to return. It then converts this time into distance.

We are firstly going to use this sensor to make a simple proximity switch. Basically, when you bring an object closer than the set threshold distance, an LED is going to light up.

This is the circuit that we need to construct. Again, be very careful about where everything goes and make sure there are no mistakes. It is very easy to make a mistake, no matter how much experience you've had with Arduinos.

In reality it is going to look something like this, much messier than the Fritzing circuit depicted in...