Showing posts with label HC-SR04 Ultrasonic Range Sensor. Show all posts
Showing posts with label HC-SR04 Ultrasonic Range Sensor. Show all posts

Friday, October 27, 2017

Remote SOund Navigation And Ranging(SONAR) Application with Raspberry Pi 2 in the Local Network Area(LAN)

Hello everybody, today I am here with another post. I will construct a remote SONAR application using Raspberry Pi 2, servo motor and HC-SR04 ultrasonic range sensor. In order to understand this post better, please check the previous posts that I have already written.

1 - Controlling Servo Motor using Raspberry Pi, Python (RPi.GPIO) software based Pulse Width Modulation(PWM)
2 - Using HC-SR04 Ultrasonic Range Sensor with Raspberry Pi 2

What do we need?

1 - Raspberry Pi 2
2 - HC-SR04 Ultrasonic Range Sensor
3 - Micro Servo Motor
4 - 1x1kΩ and 1x2.2kΩ Resistors
5 - Bread Board
6 - Jumper Male to Female Wires
7 - Laptop(for remote communication)

We need all the components above. But, if you want to display the results on Raspberry Pi locally, then you don't need a Laptop. However, here I will use Laptop. Because, Raspberry Pi is a small board which is used for remote applications generally.

Here is the technical description.

1 - My laptop's config(It will be the client machine):

- IP Adress:192.168.1.106
- Communication port is 9000
- Operating System: Windows 10
- This will be the client machine

2 - My Raspberry Pi's config(It will be the server machine):

- IP Adress:192.168.1.108
- Communication port is 9000
- Operating System: Raspbian Jessie Lite
- This will be the server machine

Thursday, October 26, 2017

Using HC-SR04 Ultrasonic Range Sensor with Raspberry Pi 2

The HC-SR04 ultrasonic range finder is a sensor that provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit. It is very cheap and simple to use, however the signal output needs to be converted from 5V to 3.3V so as not to damage the Raspberry Pi. I will introduce some Physics along with Electronics in this tutorial in order to explain each step. But first, we should have the following components:

1 - Raspberry Pi 2 Model B
2 - HC-SR04 Ultrasonic Range Sensor
3 - 1x1kΩ and 1x2.2kΩ Resistors
4 - Bread Board
5 - Jumper Male to Female Wires

Ultrasonic Range Sensors and How do they works?

There are two types of ultrasonic range sensors: active and passive. An active sensors set sends out sound pulses called pings, then receives the returning sound echo. Passive sensors sets receive sound echoes without transmitting their own sound signals.

How HC-SR04 ultrasonic range sensor works? It is an active sensor and basically, it creates a pulse of sound, often called a "ping", and then listens for reflections (echo) of the pulse. If you check the following images. You will understand the concept better.