Monday, July 18, 2016

RC CONTROLLER WITH CAMERA

Picture of RC CONTROLLER WITH CAMERA
FOR ORIGINAL DESCRIPTION, CLICK HERE

About this project?
  • Direction control via Android
  • Video streaming from RC-Car to mobile phone simultaneously
  • Follow Me (Very Soon)
Materials
  • Arduino Nano * Raspberry Pi
  • Raspberry Pi Camera Module
  • L298N Motor Drive * DC MOTOR X 2
  • 12V Lipo Battery * Car Frame (Body)

Step 1: Arduino

Picture of Arduino
PURPOSE AND TASKS:
  • Arduino was used for motor control.
  • Arduino and Raspberry Pi were connected by serial communication.
  • Before PWM signal interval which will be sent from Android phone to Arduino don't transfer, this signal was calculated. (Because of the next updates and easily interfere to PWM variable by users.)
  • The Raspberry Pi provides the Wi-Fi communication with Arduino and the user (Android phone).
  • In the following section, we show the circuit schematic for Raspberry Pi, Raspberry Pi Camera, Arduino, L298N Motor Driver, motors and batteries.
SETTING UP ARDUINO AND PIN CONNECTION SCHEMATIC
  • Data which come to Arduino is sent as a PWM interval that go to the motors directly. There are two values `+ (forward)` or `- (backward)` for decide direction with PWM value.
  • Above-mentioned situations is considered by us, there can be made various modifications.
  • PWM interval is between` 0-255.`
  • RIGHT AND LEFT motor PWMs' and servo motor angle is taken as a String(e.g. `200:200!888`) from phone. This String value is splitted with `:` and `!` characters and created the array that has 3 elements.
  • The value after the `!` character is the servo motor's angle value which connected with camera. Servo motor is not used in this project.
Motor Moving, PWM data and situations of the car
Example:
0:0 //stop
200:200 // move forward. (2 motors work with 200pwm)
200:-200 //move backward. (2 motors work with 200pwm)
200:-200 // left motor turns 200 pwm to forward, right motor turns 200 pwm to backward (The car turns its around from left to right.)
200:-200 // left motor turns 200 pwm to backward, right motor turns 200 pwm to forward (The car turns its around from right to left.)
200:100 // The car moves as turning to the right.
https://github.com/zafersn/WiFi-RC-Controller-With-Camera/blob/master/images/wificontrol.png
  • Connections among Arduino, Raspberry pi,Raspberry pi camera module, L298N motor driver, Motors and Power Supply are set up as above picture.
  • After connected Arduino pins and Raspberry pi as above picture, we can load our codes to Arduino. That do by this sequence:
  • Detail information about Arduino codes is placed in that codes.
  • Download `androidToRaspberry.ino` file and open this file with double click.
  • For uploading that project file to Arduino, first you must select the Arduino model from `Tools => Board` menu.
https://github.com/zafersn/WiFi-RC-Controller-With-Camera/blob/master/images/ra1.png
  • Again from `Tools` menu, you must show which port plugged to Arduino board. `Tools => port`
  • After realize all steps, now you can upload the codes to Arduino board. You can complete the uploading process by pressing `Upload` button from left-up corner of the program.
https://github.com/zafersn/WiFi-RC-Controller-With-Camera/blob/master/images/ra2.png

Step 2: RASPBERRY PI:

Picture of RASPBERRY PI:
PURPOSE AND MISSIONS:
  • Taking video stream with Raspberry Pi camera module and trasfer that stream to phone via Raspberry pi.
  • Connection between Arduino and Android phone.
RASPBERRY PI SETUP:
We need some additional packages for can work our application. These are;
GSTREAMER1.0 :
After connect with SSH, we must type that in order:
I. Write `sudo nano /etc/apt/sources.list` and press Enter. From coming screen;
https://github.com/zafersn/WiFi-RC-Controller-With...
II. Write `deb http://vontaene.de/raspbian-updates/ . main` command and exit the page with CTRL + O ==> Y
https://github.com/zafersn/WiFi-RC-Controller-With...
III. Write `sudo apt-get update` and get latest updates.
https://github.com/zafersn/WiFi-RC-Controller-With...
Then by turns, apply that steps:
IV. `sudo apt-get dist-upgrade`
V. `sudo reboot`
VI. `sudo apt-get install gstreamer-1.0`
https://github.com/zafersn/WiFi-RC-Controller-With...
VII.`sudo apt-get install gstreamer1.0-tools`
And after this steps, we installed gstreamer package.
SETUP MAIN FILE:
Now we install the main file of the application;
  • We are downloading our GitHub file in Raspberry pi terminal screen. git clone https://github.com/zafersn/Wi-Fi-Gstreamer-Server.git
  • Also with `ls` command with control that file. The file which we downloaded is shown as a `Wi-Fi-Gstreamer-Server` name.
  • Write `cd Wi-Fi-Gstreamer-Server` and enter in the file. You can see with `ls` command a `robotcontrolV1.pyc` named python application.
  • We need to move this file with `sudo cp robotcontrolV1.pyc /home/pi` command to our `/home/pi` directory. If you can't do this, application is not working correctly.
  • https://github.com/zafersn/WiFi-RC-Controller-With...
  • In case of skip that steps successfully, we give our first start on the Raspberry Pi manually. Because, this is useful for us to see working this application.
  • Execute the application manually: execute the program with `sudo python robotcontrolV1.pyc` command in main terminal. If you are setting up until this step successfully, you must see `Client Baglantisi Bekleniyor...` print.
  • Last, you try to conncect from Android phone to Raspberry Pi via our application.
  • If we are execute our Python code (`robotcontrolV1.pyc`) in Raspberry Pi manually, our phone's IP and port informations will appear in the screen when we connect from Android.
FOR ORIGINAL DESCRIPTION, CLICK HERE

Step 3: ANDROID

Picture of ANDROID
PURPOSE AND MISSIONS:
  • Maintaining control of RC-Car that made from Android and Raspberry Pi.
  • Simple and pure design for user.
  • Taking video stream via Raspberry Pi and show this to user.
INSTALL ANDROID APPLICATION:
  • There are two application for car control; that are pro and demo versions of the application. There is no difference between pro and demo version of the application in point of using features. Only in demo version using count of the application is restricted. This using count is 30 and this can be increased and decreased by administator. (Note: When calculaing of the using count, there won't be used entering to application or exiting from application, there will be used in connecting and controlling from Android to RC-Car successfully. For increasing using count in that case, system must work as a whole. Peace of mind there can be downloaded the application and there can be used the system as a freeware from your side.)
  • https://play.google.com/store/apps/details?id=com....
  • https://play.google.com/store/apps/details?id=com....
  • When above-mentioned case is considered, installing of the application is very simple. Only after enter the ANDROID GOOGLE PLAY market, you can type in searching box com.stackcuriosity.tooght or application name RC CONTROLLER WITH CAMERA for directly access to application.
USING THE APPLICATION AND HINTS
Raspberry Pi Connection Informations
APPLICATION DETAILS
1. EXPLAINING OF THE VISUAL DESIGN AND PROGRAMMING LOGIC
Our application rely on 3 basis. These are;


I. Provide direction control of the car.

II. Transfer live video streaming from car to user.

III. Follow Me (Vey Soon). (Following the car its owner.)
To that 3 basis;
  • Main details using direction control of the car was told in `Arduino` section. If we explain to the Android side, there will be available `Seek bar (Velocity setting)` and `Arrow keys`.
  • ![Screen Shot](images/device-2016-06-30-195734 english information.png)
  • Seek bar(Velocity setting) is created from 15 slice and velocity coefficient is 17. So any move of the Seek bar, there will be changing 17 and its multiples. For instance, If Seek bar in fifth order, produced pwm = 5*17 = 85. * Arrow keys provide seperating directions of data which take from Seek bar(Velocity setting). For moving direction of the car, `+` or `-` sign come to head of the PWM value.
For example:
200:200 // move forward. (2 motors work with 200pwm)

200:-200 //move backward. (2 motors work with 200pwm)

200:-200 // left motor turns 200 pwm to forward, right motor turns 200 pwm to backward (The car turns its around from left to right.)

200:-200 // left motor turns 200 pwm to backward, right motor turns 200 pwm to forward (The car turns its around from right to left.)

200:100 // The car moves as turning to the right.

2.SENSITIVITY IN TURNING LEFT AND RIGHT
ICON OF OUR APPLICATION:
https://github.com/zafersn/WiFi-RC-Controller-With-Camera/tree/master/images/raspi_car.png

English translator: Mustafa YEMURAL
Thanks Mr. YEMURAL


FOR ORIGINAL DESCRIPTION, CLICK HERE

Step 4: TEST VÄ°DEO

VIDEO 

0 comments:

Post a Comment