Introduction: Android Controlled RC Vehicle With Real-time Video Via Bluetooth & Wi-Fi

On the Internet there are many articles on the use of RC cars with IP or Web-based camera. But most of them used a laptop or an internal router with Open-WRT or DD-WRT firmware. View the video and control of the RC car in such projects usually implemented with a PC or Laptop. In this article describes the control crawler platform from any Android-device (tablet, smart phone, etc.), as well as viewing real-time video and rotation control pan/tilt of IP-Camera. All hardware has remained virtually unchanged in the first project, changes were made Android-applications to work with the Wi-Fi IP camera.


The project is built on the Arduino. To control the car using Bluetooth channel. As an IP camera I used the popular model Foscam FI8918 (80-100$).

Step 1:

As seen in the figure above, the interaction between the smart phone and tracked platform implemented directly on Bluetooth-channel, and the interaction with the camera implemented on Wi-Fi channel, but through the router. And this is a big disadvantage - because without a router, all operations with the camera will not work, for example in the street or anywhere outside the city. I tried to make a direct control via Wi-Fi, turning on Android'e mode Host Wi-Fi, but nothing worked. In the future, I will try to make a direct interaction without a router. I have suggestion that this requires a camera with support W-Fi Direct.

Step 2: IP-Camera

IP-camera Foscam FI8918 gives a video stream in a format MJPEG (Motion JPEG), in which each frame is compressed using the popular JPEG image compression algorithm. At a resolution of the video stream 320x240, FPS is 25-30. If the video resolution of 640x480, the FPS drops by about 2 times. For Android on the Internet has been found MJPEG class for processing and display of data in activity.

FI8918 model has the function of the rotation and tilt of the camera via the web-interface. In this project, this feature is also implemented. Functions Foscam cameras are well documented (see file IPCAM CGI SDK V1.7). View video stream, control, configuration made through CGI scripts. View the video stream via script videostream.cgi with the appropriate parameters, for example:
http://192.168.1.10:8081/videostream.cgi?user=cxemcar&pwd=cxemcar&resolution=8
where the user - user name, pwd - password, resolution - video resolution (8 - 320x240px, 16 - 640x480px)

To control the movement of the camera (the function pan / tilt) is used script decoder_control.cgi, and the parameter "command" set command:
0 - move the camera up
1 - stop the upward movement
2 - move down
3 - stop the downward movement
4 - turn to the left
5 - stop turning left
6 - turn to the right
7 - stop turning to the right
25 - set in the middle
26 - vertical "patrol"
27 - Stop vertical "patrol"
28 - Horizontal "patrolling"
29 - Stop horizontal "patrol"

In the Android application I have used only the interaction with only two scripts, but as noted above, via CGI scripts can do a lot things:
get_camera_params.cgi - get the current camera settings. The script returns the resolution, brightness, contrast, mode 50/60 Hz mode, flip mode.
camera_control.cgi - camera settings.
reboot.cgi - reboot the camera.
restore_factory.cgi - restore factory settings.
get_params.cgi - information about the camera and the many parameters.
set_datetime.cgi - to set the time and date.
set_network.cgi - network settings.
set_wifi.cgi - Wi-Fi network.
set_ddns.cgi - set of configuration Dynamic DNS.
set_ftp.cgi - setting FTP connection.
set_mail.cgi - setting for MAIL.
Etc.

The camera configured to work with a static IP-address. So that it can be accessed from the Android application. Although Foscam support DDNS services, so you can use a dynamic IP

Step 3: Chassis

Since the IP-camera represents a massive construction, so the platform must be of appropriate size. As the chassis, I used the widespread undercarriage "Rover 5".

The platform comes without top cover. The cover has been cut out of plastic and mounted on a small racks to put in batteries to power the camera and motors, a battery to power the Arduino, and a 5V voltage converter to power the camera.

Batteries and converter board were placed inside the chassis. The cover was cut holes for the wires to the control board, camera, and motor driver. To charge the batteries were put 2 connector. IP-camera, Arduino, Bluetooth-module and motor driver were mounted on the chassis cover.

For electronic parts have been cut out of the plastic bumpers and made a small cap, which is screwed on screws and can be removed if necessary.

Step 4: Hardware

The hardware of the project is almost identical Arduino RC car. But added a camera, and it requires a 5V supply. So was added step-down voltage converter on a chip LM2596.

Used by: Bluetooth module HC-06 (3-4$ on AliExpress), Arduino Nano v3 and Motor Driver L298N. If you power the Arduino board from 4V and above, between the terminal RX (Module HC-06) with TX (board Arduino) necessary put a voltage divider, because HC-06 logic levels is 3.3V. Better yet, use specialized chip, such as MAX232.

Sketch for Arduino has remained the same, and posted on the GitHub'e (link below).

Step 5: Software

Software written in the open-source IDE Eclipse.

Project contains 4 activity: main, about the program, working with Flash and basic activity for chassis control and view the video. To work with MJPEG stream, there are 2 classes: MjpegInputStream and MjpegView.

On the left are buttons for control platform, in the middle is displayed the video stream from the camera and on the right are buttons for camera pan/tilt control.

If you are familiar programming on the PC, you can implement control of track platform from your computer through the Internet and other means.

Project for Android (GitHub)
Project for Arduino (GitHub)

Comments

author
Ronan+Steder made it!(author)2017-03-10

will the app work if you used a different camera

author
rajanananth31 made it!(author)2016-07-22

Hi. I am trying to stream video from an IP camera. What app did you use for the control of both the camera and the bot?

author
pabloi14 made it!(author)2016-06-23

Hi Tolik. I am working on a project in which I need to stream video from an IP camera to an Android app. I need the stream to be real time (more than 0.5 second of delay is unacceptable). I have been trying with another camera that streams RTSP protocol and the results are not good. What delay are you experiencing with the Foscam camera an MJPEG protocol?

author
bauck made it!(author)2016-05-08

Cool project :)

Direct interaction without a router is possible if you setup your smart phone as a wifi hotspot (shared internet through wifi). I was able to stream data from my ip camera after configuring the wifi settings on the camera and changing to dynamic ip. I am using this 30$ camera from ebay:

http://www.ebay.com/itm/WIreless-WIFI-720P-IP-Came...

author
nhuber3 made it!(author)2015-07-30

Where do you get the program to be able to control it from your phone? I cannot figure out how to run the the Android GitHub link. Thanks!

author
tolik777 made it!(author)2015-07-30

You can donwload APK from my blog: http://solderer.tv/wp-content/uploads/2014/01/Cxem...

Soon, we will make a new version of Application

author
nhuber3 made it!(author)2015-07-31

Thank you! How do I sync the IP camera with the app? I didn't quite understand your explanation. Thanks!!!

author
hakanc made it!(author)2015-05-14

author
hakanc made it!(author)2015-05-14

how u use ip camera without LAN cable

author
hakanc made it!(author)2015-05-14

how u use ip camera without LAN cable

author
Abd+El-RahmanO made it!(author)2014-08-18

Yeah, chriss2 I have a project that controlling Robots with Wii controller and PS3 controller

author
ghulamqadir.butt.5 made it!(author)2015-03-31

can u plz tell me how we control any h/w using wifi. i m in final year and want to make my final project

any doc or vid or link wil b welcomed

ghulamqadir90@gmail.com is my id

plz do send some info

author
Buraksevinc.92 made it!(author)2015-03-04

Hello Tolik,

I will make this project,will use same components.

I wanna ask you about android application, I will get foscam fi8918w but how I'm going to use your app.I couldnt find where I should write camera's ip adress sth like that.Can you give me information about it ? Because I dont know java and I cant make that application by myself,I got knowledge about arduino,motors.Here is my e-mail adress:

Buraksevinc.92@gmail.com

Regards,

Burak

author
chriss2 made it!(author)2014-08-13

did u think about controlling this car via ps3 controller or something like that ?

author
xandralee made it!(author)2014-06-25

Sir, can you help me with the coding and hardware things? I'm a very newbie one. Thank you! I'm looking forward. ^_^

author
faziefazie made it!(author)2014-05-17

I'm sorry for bothering to asking again, I really need your help. if I just need to streaming the MJPEG without buttons and bluetooth thing, can you help me with the syntax in activitybuttons (what syntax I should delete)?

Please help me Sir, I only have a few weeks to complete my final project for college...

author
faziefazie made it!(author)2014-05-17

Hi, I want to ask, if I'm not using Foscam camera, but I used Dlink camera and it's control using servo, in camera control on android can I still using the URL? or what syntax I should change on the android?

I have final project about controling camera via android, and I found your project, it's really helpful but I got confused. please help me...

author
kas38 made it!(author)2014-04-13

Hi tolik777

Thanks for this great tutorial, very good job

>> And this is a big disadvantage - because without a router, all operations with
>> the camera will not work, for example in the street or anywhere outside the city.

You can have direct WiFi connection by adding a mini WiFi router in your tank
Very small size, 10 bucks shipped
Go to Ebay and search for "Mini MiFi Wireless WiFi Router" without quotes


Thanks again for your hard work

router.png
author
tolik777 made it!(author)2014-04-14

Thanks for advice!

author
abencomo made it!(author)2014-03-20

Nice work! We built a similar project. However, we installed an Android device onto a RC car and used an IOIO board instead to control it autonomously. Here is the preliminary result:

author
firazpeerjade made it!(author)2014-02-08

how to connect Bluetooth module to cxem app when i put my bluetooth ip address

it shows it's wrong and where is connecting opposition

please tell me me or send me video or imeages

author
firazpeerjade made it!(author)2014-02-08

CAN I USED ARDUINO RV3 MOTOR SHIELD

author
firazpeerjade made it!(author)2014-02-08

WHERE IS CAMERA CONNECTION BRO

author
cdragos+george made it!(author)2013-10-18

this is one of the comprehensive guide that I find about real-time video streaming between a robot and Android device

author
sarathyplkr5 made it!(author)2013-09-14

hi, i wanted to know if it is possible to take photos while streaming and store in the phone database

author
Atom+6 made it!(author)2013-08-20

Did you make this ?

author
tolik777 made it!(author)2013-09-02

Special for NP6 and Thom Kouwen:

DSC07455.jpg
author
tolik777 made it!(author)2013-08-20

What do you mean?

author
Thom+Kouwen made it!(author)2013-08-27

He means that it looks like you just wrote how you think it's possible to make this, but you didn't actually build it. As far as I know, you have to build something, to submit it, not just write how you think it is possible to make it.

I as well doubt you build it, because all of these pictures are publicly available and you haven't included a photo of the finished RC Vehicle.

author
tolik777 made it!(author)2013-08-27
You think wrong. I am the author of this project. Check out my other projects

and you haven't included a photo of the finished RC Vehicle

See first photo

author
Thom+Kouwen made it!(author)2013-08-27

Nope, the first photo is also from the world wide web, you posted this instructable on 20 august, but on the 18th of august, the same photo was posted on a I think Russian website. That means either the Russian can look into the future, or you stole their photo.

Here's the site, browse a bit down: http://malatok.at.ua/

author
tolik777 made it!(author)2013-08-27

malatok.at.ua - it's not my site, they stole my project. I have other blog.
Here is the original project in Russian language: http://cxem.net/uprav/uprav57.php
Android application also has 2 languages: english and russian

author
Thom+Kouwen made it!(author)2013-08-28

I saw your site, and the date you posted it. I owe you an apology. I don't mean to offend you or anything, but it looked like you stole it, which you didn't. There are people who do indeed copy stuff, and I was too confident you did it, without thinking about other options, my fault. (You at least earned my vote) ;)

author
Thom+Kouwen made it!(author)2013-08-27

Or, I just thought of this, that site could be yours and you uploaded it there 2 days earlier then here. In that case, I owe you an apology, but I think the people from instructables will want proof that it's your site for it to compete in this contest.

author
tolik777 made it!(author)2013-08-27

If you need proof - ask any questions about the programming and assembly. I myself wrote all the code and do a project without any help.

About This Instructable

81,708views

191favorites

License:

Bio: I like Electronics, Robots and Arduino!
More by tolik777:Android controlled RC Vehicle with real-time Video via Bluetooth & Wi-FiCxemCAR 1 - Android Control RC Car over BluetoothArduino Ampermeter (ZXCT IC's)
Add instructable to: