.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

Raspberry pi remote control car camera

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

This project will make remote car control which can view camera attached on car.
It will need:
Hardware side:
1. Car toy
2. Two gear motor
3. Raspberry B+
4. Wifi dongle
5. Power bank (10A) (for Raspberry board)
6. Battery (for gear motor)
7. H-bridge circuit (L298N)



Software side:
1. Install camera using ffmpeg (Link)
2. Install Local web (Apache)
3. Make web page to control
4. Control through Internet (by port forwarding)


Step 1. Make a car
Install gear motor to car toy. It will need your clever hand and some thinking to put all things in right way
Also put H-bridge inside the car


Briefly introduction about H-bridge:
H-bridge is used to control motor direction: to make motor run clockwise A1 and A2 must be ON; run counter clockwise B1 and b2 must be ON
Above image is type of Mechanical H-bridge using relay, this project will use H-bridge from IC L298N
This electronics H-bridge also have 4 inputs A1 A2 B1 B2 (indicated in PCB is IN1 IN2 IN3 IN4) which will triggered by Raspberry GPIO
Make connection from Raspberry to H-bridge
This project connect:
GPIO0 - IN1 
GPIO2 - IN4 
GPIO3 - IN3 
GPIO4 - IN2  
GND Raspberry - GND H-bridge
For example, to make car run forward -> 2 motor have to run clockwise -> IN2, IN4 should be ON; IN1, IN3 should OFF -> GPIO2, GPIO4 should ON; GPIO0, GPIO3 should OFF

Step 2. Install camera
In previous article, follow instruction there to install ffmpeg into Raspberry (Link here)

Step 3. Make a web page to control
Install Apache and php by following command
sudo apt-get install apache2 php5 libapache2-mod-php5
After installation, input Raspberry IP address (this case is 192.168.1.71) in Web browser to see if local web working or not. If working, it will have result as here:

This webpage is saved at /var/www/html/
Next is making a local web which will load camera image on Step 2, and have 4 buttons to control motor of car
cd /var/www/html/
gedit camera.php

Then, input following content:
<html>
    <head>
        <meta charset="utf-8" />
        <title>Raspberry Pi - Camera rotate</title>
    </head>

    <body style="background-color: white;">
<center>
<img height="240" width = "320" src="http://192.168.1.71:8090/test.mjpg" />
<br>
<button id="myP" onmousedown="mouseDown(02)" onmouseup="mouseUp(02)">Backward</button>
<button id="myP" onmousedown="mouseDown(03)" onmouseup="mouseUp(03)">Turn right</button>
<button id="myP" onmousedown="mouseDown(37)" onmouseup="mouseUp(37)">Forward</button>
<button id="myP" onmousedown="mouseDown(27)" onmouseup="mouseUp(27)">Turn left</button>
<br>

<!------------------------------------------------ php -->
<?php
//set the GPIO0, GPIO7 mode to output
system("gpio mode 0 out");
system("gpio write 0 0");
system("gpio mode 2 out");
system("gpio write 2 0");
system("gpio mode 3 out");
system("gpio write 3 0");
system("gpio mode 7 out");
system("gpio write 7 0");

//-----update button status
$output = shell_exec("cat temp");
if ($output ==0) {
echo ("<img id='status' height=48 width = 120 src='data/ON.png'/>");
}
else {
echo ("<img id='status' height=48 width = 120 src='data/OFF.png'/>");
}
?>

</center>

<!------------------------------------------------ javascript -->
<script src="camera.js"></script>

    </body>
</html>

Save file, go to web browser, input 192.168.1.71/camera.php will see camera image come along with 4 buttons

To make those buttons working with 2 motor (e.g: push "Backward" button, 2 motor should run anti-clock wise; so on for other buttons), two more files need to be done:
   (1) The file camera.js contains mouse_up and mouse_down function for Raspberry GPIO, also update this signal come to Raspberry or not.
   (2) The file camera_rotate.php receive content from camera.js, then will apply GPIO output command, which make GPIO in state 0V or 5V

This project web page can be download at here (Google share)
All files should be saved in /var/www/html
From now, go to local web (192.168.1.71/camera.php) -> can see: camera image & car wheel will rotate if button is clicked (wheel will stop when button is released)

Step 4. Put all thing in car
Attach power bank in car. This power bank will feed Raspberry board

Attach camera, another power for H-bridge motor, and car cover





Done! Now open Local web at 192.168.1.71/camera.php to control it




4. Control through Internet (by port forwarding)
In order to control through Internet (any where in world!), port need to open in Router
At Raspberry:
   Change port of /etc/apache2/ports.conf from 80 to 8082
   Change port of /etc/apache2/sites-enabled/000-default.conf from 80 to 8082

At Router:
   Depend case on case at Router manufacturer, follow Router manual to open port 8082 for Local web, and port 8090 for camera
Now, finding Internet IP address by webpage, eg. http://www.canyouseeme.org/
Put internet IP address with Raspberry webpage, now the car can control anywhere in world!





You might also like:
1. Rasbperry pi - FFmpeg install and stream to web
Following tutorial will show how to install FFmpeg into Raspberry Pi, then stream video to Local web which can be access through Computer/Phone/Tablet






Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel Raspberry pi remote control car camera, Diterbitkan oleh scodeaplikasi pada Rabu, 26 Oktober 2016. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to