Surrounding mapper

/Surrounding mapper
Total score : 0 (0 / 0)
|
x 0

Idea

This is a device used to map the surrounding area to detect the obstacle in a path. The view of the device is 360 degrees. The view is mapped in the graph to represent the obstacle distance and path.

Classification
IoT
O/S
CLOUD
Project participants
harsha(harshabm96@gmail.com)

Project summary

This project is created in order to obtain Map of the surrounding area. Ultrasonic senors are utilized to get the distance of the object. These distance data's are obtained for 360 degrees and plotted in the polar plot. The data's of all 360 degrees are stored in database for further utilizing in technologies like machine learning and AI, etc.


Project Content

Introduction:

IoT is a developing and revolutionary field with scope of new innovations and technologies. IoT (Internet of Things) is the networks of physical devices which are present in vehicles, home appliances, and other environment. These physical devices are embedded with electronics, software, sensors, actuators, and connectivity which enable these things to connect and exchange data. This gives the devices to get connected with physical world. Automation which has used IoT has covered almost every industrial field with several areas of application. Due to high efficiency and reliability, automated systems have reduced the human load and intervention to a great extent. This project application is utilized in fields like navigation in robots, mapping, tracking and predicting the movements, mobile transportation, unmanned vehicles, underwater exploration etc.

STORY:

Step 1 : Theory

In this project, we are using an ultrasonic Distance sensor. It generates sound waves which are used to measures distance by calculating the time required by these waves to hit an obstacle and travel back. This is similar to the principle used by bats and cruise ships to detect the object in the path.

The ultrasonic sensor we are using gives the data in the direction we have placed . In order to rotate the ultrasonic sensors we are going to use a servo motor. Servo motor can turn very precisely to a given angular position and hold its state there. When a servo motor is given pulses of a specific duration, it moves to the corresponding angular position and holds that position for the duration specified.

MQTT broker:

MQTT is a machine-to-machine (M2M)/”Internet of Things” connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.

Components utilized:

Components                                                              Number of them Used

Wizwiki-W7500                                                                   1x                

Wizfi310 shield                                                                    1x

Servo motor.                                                                        1x

Ultrasonic sensors                                                              4x

Push button                                                                          1x

Jumper wires                                                                   To connect all

 

IDE’s Used for Programming:

Mbed Compiler is utilized from the website: https://os.mbed.com/ to program Wizwiki-W7500 to rotate the servo motor , get ultrasonic data , Connect and send the data to the MQTT broker by initializing Wizfi310-shield.

Programming language: C++.

Jetbrains Pycharm Community Edition is utilized to create a server to receive the data from MQTT broker. Process it and store the data in database.

Programming language:  python.

PostgreSQL is utilized to store the data in form of columns.

Hardware Assembly:

Wizwiki-W7500 placed and attached using double sided tape to the box. This ensures that it not moved when moved.

 

Now the Wizfi310-shield is mounted on Wizwiki-W7500.

Mechanical assembly:

 Using a small bread board to place all the ultrasonic sensors to mount on the servo motor.

Fourth ultrasonic senor is attached to inner section of the bread board.

Second ultrasonic sensor is placed opposite to the fourth ultrasonic sensor.

Wire the remaining two ultrasonic sensors.

First ultrasonic sensor is placed to the right side of the bread board. This attached using double sided tape.

Attach the third ultrasonic sensor to the left side of the bread borad.

We will be using the servo motor to rotate 90 degrees. This way we can get a field view of 90 degree for a ultrasonic sensor. Four ultrasonic sensors are placed according to the figure shown below. With four ultrasonic sensors it gives a total view of 360 degrees.

    

  • The first ultrasonic sensor gives the view of 0 degree to 90 degree.
  • Second ultrasonic sensor gives the view of 90 degree to 180 degree.
  • Third ultrasonic sensor gives the view of 180 degree to 270 degree.
  • Fourth ultrasonic sensor gives the view of 270 degree to 360 degree.

Implementing this position gives advantage by

  • Reducing the time taken by the sensor to receive data.
  • Reducing time taken by the servo motor to turn 180 degree.
  • Reducing the time taken by the Wizfi310 to publish the data to MQTT broker.(Since it can be fit into a single topic and can be segregated in server).

The ultrasonic sensors are wired as the specified pins assigned for each connections.

Ultrasonic sensor 1:   Trigger   :  A1 of Wizfi310-shield

                                        Echo      :  A0 of Wizfi310-shield

                                        Vcc        :  5v of Wizfi310-shield

                                        Gnd       :  Gnd of Wizfi310-shield.

Ultrasonic sensor 2:   Trigger   :  A3 of Wizfi310-shield

                                        Echo      :  A2 of Wizfi310-shield

                                        Vcc        :  5v of Wizfi310-shield

                                        Gnd       :  Gnd of Wizfi310-shield.

Ultrasonic sensor 3:   Trigger   :  A5 of Wizfi310-shield

                                       Echo      :  A4 of Wizfi310-shield

                                       Vcc        :  5v of Wizfi310-shield

                                      Gnd       :  Gnd of Wizfi310-shield.

Ultrasonic sensor 4:   Trigger   :  D14 of Wizfi310-shield

                                       Echo      :  D15 of Wizfi310-shield

                                        Vcc        :  5v of Wizfi310-shield

                                        Gnd       :  Gnd of Wizfi310-shield.

Servo motor (sg90):  Wire color:  Orange  :  D3 of Wizfi310-shield

                                                              Red       :  5v of Wizfi310-shield

                                                              Brown    :  Gnd of Wizfi310-shield.

Simple representation of Wizfi310 connection and push button is connected as shown in this diagram.

Create the bin file from the compiler and burn it to Wizwiki-W7500.

Working process of the components:

  •  Push button is used to give the command for the movement of the servo motor. When push button is pressed the servo motors rotate in the steps of 1 degree to 90 degree.
  • For each degree moved all ultrasonic sensors gets the distance of the object and stores it in four different arrays specified for each ultrasonic sensors.
  • When the rotation is completed the servo motor returns to its original position and with 360 values from all ultrasonic sensors.
  • Each ultrasonic sensor contains about 90 data’s. These values are sent to MQTT broker by utilizing MQTT protocol in the program.

Server Side Explanation:

First to program in the Server we need to install Jetbrains pycharm Community Edition. I have utilized Jetbrains pycharm Community Edition 2017.1.1.

Link to download pycharm: https://www.jetbrains.com/pycharm/download/#section=windows

Installing the libraries for the project.

  • Open CMD specify the python path in CMD and type “install pip” press Enter. When installed in CMD the packages are globally distributed.
  • Open CMD specify the python path à type “pip install paho-mqtt”.
  • Open CMD specify the python path à type “pip install psycopg2”.
  • Open CMD specify the python path à type “pip install flask”. 
  • Open CMD specify the python path à type “pip install matplotlib”.

 Create a new project in pycharm.

  • Open pycharm à File à New project.
  • New window opens to create the project, replace the project name in the region of “untitled” and select the interpretor python3.6 à click on “create” below.
  • Gives on option to open the project in current or new window.

When the project is opened new blank file will be present for opening for the first time.

Download the server program in the github link

 open “script_python.py” in Pycharm à right click on python page à Click on Run ‘script_python.py’

Note: The server needs to be started simultaneously only when the button is pressed. 

Explanation of process in Server:

  • The program receives all the data from MQTT broker in four different topics.
  • All the data’s are appended into single array as “ r[ ] ”  in the server.
  • Corresponding theta (degrees) is generated.
  • Graph is plotted with respect to “theta” and “r” value.
  • Database connection is opened.
  • New column in the table is created with the title as the radii_”date and time of that instance the server is strated”.
  • Example: When todays date is 20/9/2018 and time is 2.30 pm à the table column created is “radii_20_9_2018_14_30_Secs”.
  • The data is stored in the created column with respect the degree already stored in database.
  • New figure opens to show the plot in polar form as shown below.

RESULT:

2 31 0

Leave a Reply