IIT LOGO Self Pic

ASSIGNMENT-4



ULTRASONIC SENSOR CONTROLLED LEDs

INTRODUCTION

1. Sensors are modules that can be ised for a range of operations like finding location, distance, temperature, light intensity etc. Modern day sensors form a part of everyday life. Some of the sensors we use unknowingly in our day to day life are a part of the smartphones. Modern day smartphonesare sophisticated little machines that have gone through an incredible evolution over the last decade. They are now capable of working as a personal assistant that can monitor our heartbeat, track our movements, and anticipate our needs. Some of the sensors in a modern day smartphone are:-

(a) Accelerometer:- An accelerometer detects acceleration, vibration, and tilt to determine movement and exact orientation along the three axes. Apps use this smartphone sensor to determine whether your phone is in portrait or landscape orientation. It can also tell if your phone screen is facing upward or downward. The accelerometer can also detect how fast your phone is moving in any linear direction.

(b) Gyroscope:- Gyroscope also provides orientation details and direction like up/down and left/right but with greater precision like how much the device is tilted. This is where it differs from accelerometer — gyroscope can measure rotation too but the former cannot.

(c) Magnetometer:- A magnetometer is a sensor we commonly recognize as a compass. It can detect magnetic fields, so the compass app in phones uses this sensor to point at the planet’s north pole.

(d) Global Positioning System:- GPS units in smartphone communicate with the satellites to determine our precise location on Earth. The GPS technology doesn’t actually use internet data this is why we can find our location on maps even after losing the signals, but the map itself is blurry as it requires internet to load the details — this is how offline map works.

(e) Proximity Sensor:- A proximity sensor makes use of an infrared LED and IR light detector to find out how close the phone is to an outside object. It used while making calls and when the phone is held to the face to make or receive a call, the sensor detects it and disables the touchscreen display to avoid unintended input through the skin.

2. Some of the other sensors on present day smartphones are:-

(a) Ambient Light sensor (b) Barcode Sensor

(c) Touchscreen Sensor (d) Fingerprint Sensor

(e) Camera (f) Temperature Sensor etc

3. The aim of this project was to develop a program for controlling LEDs using an HC-SR04, Ultrasonic Range Sensor.

Material Needed

4. The project required the following:-

(a) ArduinoUno - 01

(b) Breadboard - 01

(c) LEDs - 04

(d) HC-SR04 US Sensor - 01

(e) Resistors (220Ohm)- 04

(f) Jumper Wires - As required

Procedure

5. The code was once again developed and tested using TINKERCAD. Once, satisfied that the code works as desired, it was uploaded onto an Arduino UNO and the results were captured.

Project Setup

Working of HC-SR04 Module

6. HC-SR04 is an Ultrasonic Ranging Module. As per datasheet its working voltage is 5V and 15mA current. Its range is between 2cm and 400cm (with Range Accuracy of 3mm). The module works of giving a high ping for atleast 10microseconds and measuring the time duration for receiving the echo signal. The distance from any object in its measuring angle of 15degrees is measured by the formulae:-

Project Setup

Range = [(High Level Time)x(340)]/2

Here, Divided by 2 since Range of Object is half of the total distance travelled by Sound from trigger pin to echo pin.

Speed of Sound was taken as 340m/s.

7. This can also be calculated using the time taken by Sound to travel and then dividing the total time taken between trigger and echo. Here we first measure the total distance travelled by sound, then divide it by 2 to get the range.

To measure Range in cm we use Range = [(Total Time Delay in microseconds)/29.41]/2

Here, 29.41 is the time taken in microseconds by Sound to travel 1cm in air.

Similarly we can measure the distance of object in front of the module in inches using the formulae:-

Range in cm we use Range = [(Total Time Delay in microseconds)/29.41]/2

Methodology

8. The methodology adopted for the project was to measure the distance of an obstruction from the HC-SR04 module and using the distance light up different LEDs, this methodology can be used in real world applications for brightening the path during movement of personnel, which can selectively go dark as people move away from the path. This will allow effective power saving by selctive use of lighting.

Animated Simulation

9. The entire project was run on TINKERCAD as an animated simulation has been captured and is as shown below:-

Actual Project

10. Once satisfied that the code is functioning as required, it was uploaded onto an ARDUINO UNO and using the same layout an actual setup was developed. The code was uploaded and the running of the program was recorded. A video of the functioning of the project is attached.

Project with LCD Display

11. The code was further developed to include an LCD Display using the LCDDisplay.h Library function available online. In this the code was slightly modified to display the distance measured on 16x2 LCD screen in addition to lighting the LEDs. However, due to paucity of time the same has not yet been tried using an Arduino UNO.

12. For the purpose of the exercise a code was written to trigger the operation of a 12V DC vaccum pump using an US Sensor with a display on an LCD screen. The video of the operation of the assembly is attached below.