Introduction: Creating a Virtual World Using Arduino and Python

Introduction to Our Project

how to create a simple virtual world using vPython library.In this project we are using Arduino and Ultasonic Sensor for sensing the virtual world. The virtual world is use in real time based on measurements from the arduino and ultrasonic sensor. In this project you can use how to combine Arduino, Python, and vPython library to create a virtual world i.e virtual object updated based on sensor measurements.

Step 1: Installation of All Software

Arduino IDE:

Installation of Arduino IDE: You can download the latest Arduino IDE from this link:

https://www.arduino.cc/en/Main/Software

Python:

Download and Install Python 2.7.8.for windows. Link is given below:

https://www.python.org/downloads/windows/

Pyserial:

Download and Install Pyserial version 2.7 for windows. Link is given below:

https://learn.adafruit.com/arduino-lesson-17-email...

vPython:

Download and install the Vpython library for windows. Link is given below:

http://vpython.org/

Step 2: Component Used

For this project you need :

1) Arduino

2) Ultrasonic sensor
3)jumper wires

4)Bread Board

1) Arduino UNO:
Arduino/Genuino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button.

2)Ultrasonic sensor:
This is the HC-SR04 ultrasonic ranging sensor. This economical sensor 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.

Step 3: Circuit Description

First we are going to connect ultrasonic sensor with Arduino board. Then according to program our ultrasonic sensor going to generate a trigger signal which is going to receive by our echo pin of Ultrasonic Sensor. Then we are going to run our arduino code. According to Arduino code our Ultrasonic Sensor detect the distance of any object.

Circuit Diagram of this project is given above.

Here are the connections of our circuit:

Ultrasonic Sensor---Arduino UNO

GND---------------------GND

Echo------------------- pin 11

Trig..........................pin13

Vcc.........................5v

Step 4: Code of the Project

In software part we run two code, first is arduino code and other is python script. Firstly we can run Arduino code, after that run python script. according to python script you make any virtual object, with the help of virtual object ultrasonic sensor detect the distance like figure 1 and figure 2.

Step to run Code:

1) Firstly you can run Arduino code. The code is given below

2) After that You can run python script, before running python script you can install Pyserial and vPython. The python script is given below.

Congratulations you have successfully finished your project.


If have any doubt regarding this project feel free to comment us below or you can mail us on info@deligence.com

Thanks & Regards,

Deligence Technologies

Comments

About This Instructable

242views

8favorites

License:

Bio: We are a team of IoT & Embedded Systems developers. We are working in Raspberry Pi and Arduino.
More by deligence:Over the Air(OTA) Update of Nodemcu(esp8266) Using MQTT)Raspberry Pi Web GPIO With Live Streaming Creating a Virtual World  Using Arduino and Python
Add instructable to: