Introduction: RC CONTROLLER WITH CAMERA V2 (Pi_CAR V2)

About: https://tr.linkedin.com/in/zafersn93

RASPBERRY PI- ARDUINO ANDROID-CONTROLLED RC-CAR ROVER WITH LIVE VIDEO STREAMING

----------------------------- Pi_CAR -----------------------------

NEWER VERSION IS RELEASED V3

  • For English description and setup information,Click here!

Step 1: RC CONTROLLER WITH CAMERA V2 (Pi_CAR)

FOR ORIGINAL DESCRIPTION, CLICK HERE

NEWER VERSION IS RELEASED V3

About this project?

  • Direction control via Android
  • Video streaming from RC-Car to mobile phone simultaneously
  • Follow Me (Very Soon)

Materials

  • Product Name Piece
  • Arduino Nano / UNO / Mega 1
  • Raspberry Pi 1
  • Raspberry Pi Camera Module 1
  • Wi-Fi Dongle 1
  • L298N,BTS7960,L293 Motor Drive 1 or 2
  • DC MOTOR 2 or 4
  • 12V Lipo Battery 1
  • Jumper Cables ~
  • Vehicle Chassis 1

https://github.com/zafersn/WiFi-RC-Controller-With-Camera

Step 2: Arduino

FOR ORIGINAL DESCRIPTION, CLICK HERE

NEWER VERSION IS RELEASED V3

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 between0-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.

  • 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 the this file with double click.
  • For uploading that project file to Arduino, first you must select the Arduino model from Tools => Board menu.

FOR ORIGINAL DESCRIPTION, CLICK HERE

  • 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.

Step 3: RASPBERRY PI:

FOR ORIGINAL DESCRIPTION, CLICK HERE

NEWER VERSION IS RELEASED V3

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:

Raspberry pi setup is quite simple. First, Win32DiskImager is the program that is required to print the operating system to the SD card. Click to download

1. Raspbian Operating System Downloads;

We will need to write the the operating system containing vehicle control software.The point to be noted here is that when selecting the operating systems listed below, download it according to the Wi-Fi module in your hand and print it to the sd card.Modems supported by Operating Systems and Operating Systems are given below.

Downloadable operating system for Raspberry Pi 3

We have 2 alternative methods for Raspberry pi 3;

  1. Using built-in Wi-Fi directly on Raspberry Pi.
  2. Using an external USB Wifi adapter.(It is the recommended method for distance and data speed. Of course this will vary depending on the Wi-Fi adapter you use.)

1.If you want to manage Pi_CAR via Raspberry pi 2 or the built-in Wi-Fi module on the Raspberry Pi3. Download the operating system on this link and print to the SD card.

2.If you want to manage Pi_CAR by using Wi-Fi module externally mounted on raspberry pi 3. Download the operating system on this link and print to the SD card.

For this option, we have avaible and tested wifi devices and chipsets.

Tested Devices Chipsets

  • Dark WDN300A5 RTL8192CU
  • Tenda UH150 RT2870/RT3070
  • AWUS036NH RT2870/RT3070

Detailed information for other supported chipsets and devices:http://elinux.org/RPi_USB_Wi-Fi_Adapters


2. Printing Operating System to Micro-SD Card

FOR ORIGINAL DESCRIPTION, CLICK HERE

We extract the downloaded image file from within the zip.Then we open the Win32DiskImager program we downloaded earlier. We choose our img file from the specified location.

Once you are sure your Sd card is connected to the computer, you can see it in the Devices section. Then click on the write button and start burning. The writing process takes about 5-7 minutes. The completion of the writing process is indicated by the newly opened window "Write Successfull." Wait until you see the article.

3.Connections and Operation

After the writing process is completed, you can remove your SD card from the computer and insert it into the Raspberry. All you need to do now is mount the Arduino to Raspberry via USB and mount it after you have made the necessary power and motor drive connections.

Video description:

FOR ORIGINAL DESCRIPTION, CLICK HERE

Step 4: ANDROID:

FOR ORIGINAL DESCRIPTION, CLICK HERE

NEWER VERSION IS RELEASED V3

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:

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
IMPORTANT NOTE:
After installing our Android app, it is normally necessary to automatically connect to the Wi-Fi network we created on the car.However, in newer versions of Android (5 and up), Android tries to connect to Google's services to increase user experience and prevent them from connecting to captive networks. According to this connection status, it allows or blocks data communication on the Android Wi-Fi network. Due to this situation, the new versions of Android (5 and above) do not allow connection to the Wi-Fi network we created on our car.For detailed information click here!.

We have 2 Alternative methods for solving this problem.

1st METHOD (RECOMMENDED):

Using Android StudioThis method assumes that you are an android developer.

Download android Studio from here!.

After downloading and making the necessary adjustments, you need to activate your phone's developer options;

Settings ==> About Your Phone ==> Compile Number 5 times in a row. The Phone will now say that you are a developer.

In the same way

Settings ==> Developer Options ==> Turn on.

Settings ==> Developer Options ==> Enable USB debugging

Now, after you make sure that your phone is connected to the computer and that the phone is recognized by the computer (install the drivers if the phone is not recognized by the computer), In the Android studio environment, you should check that your phone is recognized. The simplest control is to display your phone model on the screen that opens by pressing Shift + F10.

Now, all we have to do is click on the Terminal tab on the bottom left or press Alt + F12. On the opened terminal screen;

  1. adb shell
  2. settings put global captive_portal_detection_enabled 0

If everything goes well, you should type settings get global captive_portal_detection_enabled in this command and the terminal should also type 0 (zero).

If you see 0 (zero), you can now connect and use the car smoothly

2nd METHOD

FOR ORIGINAL DESCRIPTION, CLICK HERE

Settings ==> Wireless ==> Pi_CAR ==> Advanced Options

Password: TRaspberry

IP settings = Statik

Ip address = 192.168.57.57

Gateway = 192.168.57.1

Network prefix length = 24

DNS 1 = 8.8.8.8

DNS 2 = 8.8.4.4

Once you have entered the required information above, click Connect. And get ip address and connect. Then if you get a warning that you do not have internet access on your wireless connection, press yes again after you select the Ask again for this network option.

VIDEO EXPRESSION

FOR ORIGINAL DESCRIPTION, CLICK HERE

Raspberry Pi Connection Informations
Once you've downloaded your Android app, you will see the following welcome : Now all you need to do is check the tool. screen.

Let's briefly explain the working principle and the introduction of the application.

APPLICATION DETAILS

1. EXPLAINING OF THE VISUAL DESIGN AND PROGRAMMING LOGIC

Our application rely on 4 basis. These are;

I. Provide direction control of the car.

II. Transfer live video streaming from car to user.

III. Connection signal level indicator of vehicle.

IV. Follow Me (Vey Soon). (Following the car its owner.)

To that 4 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), Camera On / Off,Wi-Fi status indicator and Arrow keys.


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.
Menu keys (Camera On/Off and WiFi Indicator) Other vehicle control functions beside Seekbar 'ın;Camera on / off button for taking the camera image through the vehicle " Open ", " CLOSE ", In the same way, an indication of whether our application is connected to the Wi-Fi network we created on Raspberry Pi." NOT CONNECTED ", " CONNECTED "

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

When our car moving to right cross and left cross, motors' PWM value which will be turning side decreases, and so this provides slower motor rotating. So, the car can achieve the intended turnings. This rotating sensitivity setting let to user.

  • The formula for calculating cross turnings: PWM VALUE - ((PWM VALUE) / PWM RATE)
  • In default, PWM RATE is 2.
  • You can reach the PWM RATE setting from right-top button in the screen and from there to Settings menu.
  • PWM interval which can be entered is a value as a minimum and maximimum between 1-4 interval in integer and double type.

FOR ORIGINAL DESCRIPTION, CLICK HERE

IoT Builders Contest

Participated in the
IoT Builders Contest

Arduino Contest 2016

Participated in the
Arduino Contest 2016