loading

Remote Control cars are fun to drive around the room or wandering the house. What could be more fun of it? When you have the visibility as if you are riding in it. A wireless IP camera is the answer. Or let's say you have CCTV cameras around the house or office but there are some blind spots, then this project can be your Patrol Cam. Do It Yourself? Yeah, that is another fun of it. You can buy any rover on the market that has gorgeous futuristic cases. This project is for fanatics who love boards and wires and some headache :P

I am encouraged by ASCAS with his DIY Phone Controlled FPV Rover (Fast & Agile). What I built is similar to his, but I change some parts because of budget, and some parts I got at special price at special occasions. Then it get the title "Triple S" : Slow & Sluggish Spy :D

Step 1: Bill of Materials

Step 2: Chassis

There are several modes of chassis can be made by Tamiya Universal Plate and Tamiya Track and Wheel Set. Try several combination to get what mode you desire. Some configuration are only suitable for flat tracks. The other may be good for All Terrain Forward.

I pick Tank mode because it is best for All Terrain Forward and Backward moving. I am not explaining how to assemble the motor gear set because the instruction manual is already included in the box in one piece of paper. It has a very clear steps with images. The Track and Wheel set is also comes with a manual, but you can design a new model by your imagination and the parts you have in hand. I only provide some images to boost your imagination to get the style you love or what purpose of your RC toy will be.

Now get two pieces of female to female jumper cables with different colors, cut them into two in the middle with same lengths. Solder them to the DC motors' terminals. This is not crucial but it will make you easier to swap the terminals in accordance with the codes we write. Solder each motor with two colors on its terminals. In my case, I use grey wire for left terminal and purple wire for right terminal.

Step 3: Wiring : Bluetooth Module to Arduino

After some reviews on the net, I pick up JY-MCU Bluetooth Module. It is small in size, low in price, plug and play. It is a HC-06 module which support only in "slave mode" and also known as "Linvor" while there is a HC-05 module which can be configured to master or slave. To know more about HC-06 Bluetooth Module you can visit this link or just google keyword "HC-06".

Wiring it on Arduino Uno R3 is pretty simple for it has only four cables. This JY-MCU Bluetooth Module comes with four pins female to female cables mark with red dashes and dots. I change this cables, because I need female headers on bluetooth module and male headers on Arduino.

I use rainbow-color cables so that it is easier to follow and I will guide you and explain with the colors I use.

  1. Red wire from HC-06 VCC to Arduino 5V.
  2. Brown wire from HC-06 GND to Arduino GND.
  3. Black wire from HC-06 TXD to Arduino Digital Pin 0 (Rx).
  4. White wire from HC-06 RXD to Arduino Digital Pin 1 (Tx).

Some of you would have this question crossing your mind : The color code for Ground is Black, then why I use Brown instead? Well, the jumper cables I have is 40 pins in a group. I torn up a group of four, I keep the Red for VCC, then Brown is next to it. I think it is not bad to use Brown as Ground rather than messing up the group of cables.

Step 4: Wiring : L298N Motor Driver to Arduino

Again I will explain the connection in my colors :)

  1. Red wire from Motor Driver +5V to Arduino VIN.
  2. Brown wire from Motor Driver GND to Arduino GND.
  3. Orange wire from Motor Driver ENB to Arduino Digital Pin 6.
  4. Yellow wire from Motor Driver IN4 to Arduino Digital Pin 7.
  5. Green wire from Motor Driver IN3 to Arduino Digital Pin 5.
  6. Blue wire from Motor Driver IN2 to Arduino Digital Pin 4.
  7. Purple wire from Motor Driver IN1 to Arduino Digital Pin 2.
  8. Grey wire from Motor Driver ENA to Arduino Digital Pin 3.

If you are using another Motor Driver, maybe you need to adjust the connection to Arduino refer to your board's manual. If you have any question, I will give my best to help.

Step 5: Wiring : Battery and Motors

  1. Purple and Blue wires from Motor Driver MOTOR-A to Right Motor terminals.
  2. Green and Yellow wires from Motor Driver MOTOR-B to Left Motor terminals.
  3. Red wire from Motor Driver VMS to Mini Switch bottom terminal.
  4. Another Red wire from Mini Switch middle terminal to Battery 5V (Red wire).
  5. Black wire from Motor Driver GND to Battery GND (Black wire).

For point 1 and 2, later on testing when the wheels move the opposite way than the button you pressed, you need to interchange the terminal wires. That is why I solder female headers on the motors' terminals, so that we can swap them easily.

Step 6: Get Things on Board

The L298N Motor Driver I use is not Arduino stackable board, so I put all the boards vertical. I put my Arduino and Motor Driver back to back, and I use a thin foam in between to avoid short circuit. I shape the foam to leave the holes unblocked so that I can tie the boards to Tamiya Universal Plate using zip ties.

Battery is best placed at the back to give more weight at the back, because in front of the tank lies Dual Motor Gearbox. We should distribute the weight well so that it is stable in movement. You don't want your tail up while moving, do you? :)

Cables are another problem. You can tidy up those cables by adjusting the length of the cables needed, but that will kill your plug and play jumper wires. For me, I try to keep those cables in groups and shape them as you can see in my photos, as long as they don't block the wheels' movement :)

Step 7: Adding a WiFi Camera

Now we put an eye on the tank. I get this one less than $50 with pan and tilt ability, night vision IR LEDs and audio support. The most important thing is : it runs at 5V DC which is perfect match for Arduino project. Can we just set it up on the tank? Well, you can do so, but I think it weigh too much for my little tank with standard DC motors, and also too bulky. The camera base will block the tank treads movement. You can put something to set it up higher, but I think it is still too heavy and bulky.

Actually all we need is the mainboard which handle the video streaming wirelessly and the camera module itself. Take a look at my iBle showing how to dismantle it. I have reduced approximately 70% of its weight, sacrificing its pan and tilt ability. The size? Only a thin mainboard which I can put it vertically and the camera case about the size of a golf ball.

The camera comes with an AC adapter. I cut the wire off and as you see in my photos, I solder it to a switch. You don't need to do this, you can simply screw the Black wire to Motor Driver GND and the Red wire to Motor Driver 5V as seen on photo number 3. The switch I use was preventing power consumption while I was testing the tank movement.

Below the DC power jack there is a curve on the board. I put the antenna there. But before that, I put some tape on the board to prevent short circuit, because there lay some solder pads. I put a double tape below the camera and then tie it to its mainboard and the tank's plate.

Step 8: Optional Camera

Sadly I have to tell you that my OpAmp chip on my camera mainboard smokes... T-T

It was while I am testing my camera alone without the tank. I was carelessly grab a 7.4V battery fully charged to 8.2V. Either that caused the burnt or my setting in higher resolution that draw too much current to the chip. I tell you this so that you don't experience the same bad luck like me.

It's okay. My project will go on. While I am searching for a replacement chip, I found my old android phone which I use for backup, lying in my drawer. I found a software streaming the phone's camera through wifi. I will go on with this application on the next step 10.

I use a tweeter (speaker) stand to hold my phone. I puts some foam and cable ties. I use double tape to stick it on the motor gear box. It is done. Now we move to softwares.

Step 9: Arduino Sketch

Upload this sketch to your Arduino :

/*
  Chienline @ 2015
  Controlling an Arduino car/tank using an Android phone over Bluetooth connection. 
  Android Software : BlueCam 2 by Johnny Visser [in PlayStore].
*/
char dataIn  = 'S';        //Character/Data coming from the phone. S=Stop;

int IN1Pin = 2; // Motor A IN1
int ENAPin = 3; // Motor A Enable
int IN2Pin = 4; // Motor A IN2
int IN3Pin = 5; // Motor B IN3
int ENBPin = 6; // Motor B Enable
int IN4Pin = 7; // Motor B IN4

int delayTime = 100;

void setup() 
{
  Serial.begin(9600);  //Initialize serial communication with Bluetooth module at 9600 baud rate.  
  pinMode(IN1Pin, OUTPUT);
  pinMode(ENAPin, OUTPUT);
  pinMode(IN2Pin, OUTPUT);
  pinMode(IN3Pin, OUTPUT);
  pinMode(ENBPin, OUTPUT);
  pinMode(IN4Pin, OUTPUT);
  
  //Stop both motors on power up.  
  stopMotors();
}

void loop()
{
  if (Serial.available() > 0)    //Check for data on the serial lines.
  { 
    dataIn = Serial.read();  //Get the character sent by the phone and store it in 'dataIn'.
    if (dataIn == 'F'){   //if incoming data is a F, move forward
        moveForward();
        delay(delayTime);
    }  
    else if (dataIn == 'B'){   //if incoming data is a B, move backward
        moveBackward();
        delay(delayTime);
    }  
    else if (dataIn == 'L'){   //if incoming data is a L, move wheels left  
        moveLeft();
        delay(delayTime);
    }  
    else if (dataIn == 'R'){   //if incoming data is a R, move wheels right
        moveRight();
        delay(delayTime);
    }
    else {
        stopMotors();    
    }
    stopMotors();    
  }
}

//These direction functions are designed for Keyes L298N Motor Driver.
//You need to change them to suit your other motor drivers.
void moveForward(){
    digitalWrite(IN1Pin, LOW);
    digitalWrite(IN2Pin, HIGH); //L-Forward
    digitalWrite(IN3Pin, LOW);
    digitalWrite(IN4Pin, HIGH); //R-Forward
    digitalWrite(ENAPin, HIGH);
    digitalWrite(ENBPin, HIGH);
}

void moveBackward(){
    digitalWrite(IN1Pin, HIGH);
    digitalWrite(IN2Pin, LOW); //L-Backward
    digitalWrite(IN3Pin, HIGH);
    digitalWrite(IN4Pin, LOW); //R-Backward
    digitalWrite(ENAPin, HIGH);
    digitalWrite(ENBPin, HIGH);
}

void stopMotors(){
    digitalWrite(ENAPin, LOW);
    digitalWrite(ENBPin, LOW);
}

void moveLeft(){
    digitalWrite(IN1Pin, HIGH);
    digitalWrite(IN2Pin, LOW); //L-Backward
    digitalWrite(IN3Pin, LOW);
    digitalWrite(IN4Pin, HIGH); //R-Forward
    digitalWrite(ENAPin, HIGH);
    digitalWrite(ENBPin, HIGH);
}

void moveRight(){
    digitalWrite(IN1Pin, LOW);
    digitalWrite(IN2Pin, HIGH); //L-Forward
    digitalWrite(IN3Pin, HIGH);
    digitalWrite(IN4Pin, LOW); //R-Backward
    digitalWrite(ENAPin, HIGH);
    digitalWrite(ENBPin, HIGH);
}

Step 10: Android Apps

Video Streaming :

IP Webcam by Pavel Khlebovich.

Download this on your camera phone if you are using an android phone as the camera. This app will stream your camera through wifi and you can open it in any web browser. Then you can also view it within BlueCam 2 which we use as the tank controller.

First, you need to setup your phone connect to your wireless router. Open IP Webcam then you are taken to the setting page. If you attach your phone to stand vertical on the tank, go to "Video preferences" (the first one in settings), set "Video orientation" to portrait. If you attach your phone in landscape mode like mine, you can skip this one. Go back to Settings. Go to the last item in settings that is "Start server". Then you will see what your camera sees on your screen. At the bottom center you will see something like : "http://your.ip.address.here:port". This is how you connect to your streaming camera. If you are using a web browser then just type that in the address bar. I will tell you later about how to connect from BlueCam 2.

We don't need this screen on because it is on the tank and it will waste the phone's battery. So you click on the "Actions..." button on upper right corner, then choose "Run in background". It will tell you that you can just press the "Home Key" on your phone and this app will still run in background. Click "Ok, I get it!". You will see the IP Webcam icon is on upper left corner, means that it is streaming the video in background, then you can turn off your screen.

Tank Controller :
BlueCam 2 by Johnny Visser.

Download this one on your controller phone. Before you run this apps make sure you have paired your JY-MCU module to your phone. Turn on your tank. Open bluetooth settings on your phone, search for devices. It will shows up as "LINVOR" or "HC-06" with default password "1234" (without quotes). Make sure your phone's wifi is connectinig to the same router as the phone you use as the tank's camera. Turning on bluetooth first before running the app is important, otherwise you won't see the bluetooth paired devices list and you need to exit the app and then open it again. Okay, now let's run the BlueCam 2.

This app is working in landscape mode only and it is good, we will have a wide camera view on the screen. Press the menu (Three Dots) button then choose "Configure buttons". If you don't see the menu buttons, you need to show it permanently in your navigation key. I haven't told Johnny about this one because I have my menu key "always visible" in navigation pane. Go to your Android Phone Settings > Navigation > Navigation bar > Menu visibility > Always show. This might be different a little bit depends on your phone models, but all you have to search is Menu visibility set to always show and it is under navigation bar setting.

Let's move on ... now we configure the buttons to match the sketch we uploaded to Arduino, that is :

  • F for FORWARD button.
  • B for BACKWARD button.
  • L for LEFT button.
  • R for RIGHT button.

Then turn on both Burstmode buttons next to Forward-Backward and Left-Right buttons. This Burstmode is sending the character every 250 ms. So when our finger is still pressing on the arrow, it will keep sending the character to Arduino. If it is off, it will only send the character once even if your finger is pressing the button, and the tank will move once then stop. Special thanks to Johnny who fixed it for us :) The "+" and "-" buttons are not in use. I configure them to send "S" which I called Brake buttons. When I was in testing, the motor won't stop even when I have released my finger from the buttons. Then I need this button to stop the tank. Something on my mind is to put a servo on the camera so that we can move the camera up and down. We don't need the left and right as we can move the wheels :) Now click on the Diskette button to save the buttons configuration.

On bottom left there is a list of paired bluetooth devices. My bluetooth module is already renamed to "PANZER", find your tank either "LINVOR" or "HC-06". Then click on the bluetooth icon, it will change to orange means connecting. If the connection is successful then the icon will change to red. Now you can move your tank with arrow keys.

On bottom right is the address to connect to your IP camera. The default address is :

http://your.ip.address.here/axis-cgi/mjpg/video.cgi?resolution=320x240

Example : http//192.168.1.1/axis-cgi/mjpg/video.cgi?resolution=320x240

Simply change the IP address with your camera IP address. If you are using a phone as IP Camera then type this on the camera address :

http://your.ip.address.here:port/videofeed

Example : http//192.168.1.1:8080/videofeed

Then Click on the Camera icon. There you go.... Spy Panzer is ready for action ^_^

Step 11: Final Words

It is easier to build the Panzer than to write this instruction. But it is okay, I love to share knowledge. Fiuh... I'm glad that it is done. Taking pictures, writing the details, making video, I try to explain as detail as possible, but if I miss something and you have any question regarding this project I will try my best to help you :)

Special thanks to :

ASCAS who inspired me building this panzer. You have so many inspiring iBles.

Johnny Visser who help me out with his free BlueCam 2 on Android.

Pavel Khlebovich who I haven't contact, but his free IP Webcam app on Android works so well.

<p>i thought of using an fpv, will there be any problem in signal range if I use it indoors or from top of a building.</p>
JY-MCU bluetooth is said to cover approx. 10 meters. While video has the range of where your wifi router covers. If you want to go far enough you need to use stronger bluetooth or mod it with external antenna for wider range :)
There's also an Android app called BT Bot Control.<br><br><br><br>
Yes, I have tried that one also. I have to admit that it has gorgeous interface. But the free trial version send the char &quot;9&quot; to any button I pressed. We have to pay for the full version to test if it works. I won't pay for things that is not sure, what if it is not working as expected? They should have make the free version with limited time or limited setting instead of sending &quot;9&quot; for every button we pressed.<br>I also try CXEM Car 2. It works but it has a very small viewer for the cam.
<p>hey chienline can you help me how to use this motor driver http://www.centralelectro.com/catalog.php?action=show_custom&amp;id=2193&amp;cat=68 i dont know whre is en B and en A thnks. thats nice project btw</p>
<p>ah.. Googling around I find this pinout of your board. You have to remove two jumpers that spin your motors right away (EN-A and EN-B are connected to 5V by jumpers).</p>
Im getting ready to build this. One question though. Can i use a 11.1 lipo battery for longer run time
Yes you can. The L298N chip has input voltage up to 46V according to the datasheet. The Keyes board I used has a 5V voltage regulator chip on it.
<p>I bought your motor shield from gearbest.com and the shield works When the project is ready I will send you the pics and thanks for all your help and sparing your time with me.</p>
Good to hear you have made it ^_^ Can't wait to see your panzer on the move :)
<p>sorry for bothering you chienline since my motor shield didn't work I thought i will check out with a new project and came across this <a href="https://www.instructables.com/id/Arduino-wall-avoiding-robot-FabLab-NerveCentre/?ALLSTEPS" rel="nofollow">https://www.instructables.com/id/Arduino-wall-avoid...</a></p><p>Now I need your help for the code and the circuit, I wanted to add two more sensors extra so what changes should I make in the code so I am all ready with the project.</p><p>Just send me an email or a message.</p>
Sorry for my late reply @AdithyaP1 for having busy weeks. And I don't own ultrasonic sensor needed for that project, and also arduino motor shield as you have. It will be difficult for me to test without those materials needed. But if you have all the same materials, you should be able to construct following that iBle instruction :)<br><br>Otherwise, why don't you try my https://www.instructables.com/id/Motor-Driver-Using-555-Timer-IC/ [DIY motor driver using 555 timer ICs which are easy to get at any local electronic shop].<br>Well, it is not descent motor driver but at least it moves standard DC motors slow :D with Android phone controller.<br><br>Good luck with your project and you can contact me at anytime regarding my iBles ;)
<p>ok </p><p>I will send the photos to you through email.</p>
<p>sorry chienline , the project didn't work out for me.</p><p>I did the exact wiring and uploaded the code properly but doesn't work</p><p>maybye you should come up with another solution</p>
Using the different motor driver might be the problem. I don't own that kind of motor driver in hand so I couldn't test it directly. But I can try my best guiding you through email or google+ if you provide some photos or video and tell me where it stuck. <br><br>Arduino Motor Shield R3 is way simpler and also reserved different pins on Arduino. I have read the dataaheet, but I might have missed something, or in the the code maybe.
But none of the software you provided works means its no longer available in play store
<p>Ups.. maybe limited to certain gadget, that's how PlayStore works. My phone has been rooted and recognized as a tablet :D that could be the problem.</p><p>What about sending me your email via PM and I will send you the apps in this project ;)</p>
prithvik02@gmail.com
<p>so you might have to make changes in the code</p><p>check out this software called terateam</p>
What is terateam? Googling that term comes out &quot;tera term&quot; as result. It is a terminal emulator like telnet. Do you mean that you want to control your panzer from PC? From a terminal emulator? I never try that before but there must be some good tutorial on the net :)<br><br>I love BlueCam 2 for its simplicity and ability to control and view my panzer cam :)
<p>Bluecam 2 is now no longer available</p>
Is it? I can still open the link above. Try this link<br>https://play.google.com/store/apps/details?id=camcontroll2_0.main&amp;hl=en
<p>Thanks chienline </p>
<p>I recently bought the official arduino motor shield R3. Will the wiring be the same if not could you please send me the wiring and the code too.</p>
<p>This is the wiring to for your Arduino Motor Shield R3.</p><p>The code has been sent via Private Message.</p><p>Hope it works ^_^</p>
<p>I will try to check it for you. I see that arduino motor shield R3 use the similar chip but it reserved different pins, so there must be changes on the code. I will post back here soon I figure it out.</p>
can you send the program in (ino) file ....
You can copy from Step #9 of this instructable, then paste into your Arduino IDE. I was out town and temporary no access to my files on my desktop.
I am using this motor driver can you help in wiring and power supply with arduino and the programing in order to make this panzer .......pls help I am making this for my school exhibition .........
<p>Your motor shield wiring should be no different with mine. You can use this diagram I attach. If your panzer give an awkward movement, such as the left wheels and right wheels are not sync, you can interchange the motor wiring. You see that we never mention positive or negative on motor terminals, so moving forward or backward depends on the position of your motor on the board. </p><p>On your board there are green terminals named M1_OUT and M2_OUT, each has two terminals so let's called them M1A and M1B (motor-1), M2A and M2B (motor-2).</p><p>Firstly, try to move the panzer forward, both wheels should move forward. If one of the wheels, lets say Motor-1 move to different position, then you can switch cables M1A and M1B, then try to move the panzer again to see if you have solved the moving forward problem.</p><p>Secondly, try to move the panzer left, if your panzer moves to the right instead then you need to switch the cables M1A to M2A, M1B to M2B. Then you need to redo the first step (move panzer forward) to until the panzer do move forward.</p><p>Then you are done :) </p>
Okay, I will draw a wiring comparison for you and post it back here. I think I need some time, 24 hours top. I'll do my best in my spare time :)<br>And I think the code need no changes :)
could not find the bluecam 2 pls help and comment fast .....!!!!!!:)<br>
The should remain there, just click on the name.<br>Well, here it is : https://play.google.com/store/apps/details?id=camcontroll2_0.main&amp;hl=en
<p>thanks chienline </p>
<p>can we combine obstacle avoiding along with the bluetooth by adding an ultrasonic distance sensor. </p>
I have never try an ultrasonic distance sensor yet.<br>Assuming you have a function that return the distance of the nearest object (in my flash read about ultrasonic distance sensor, it is sending a ping, then convert the returning ping into distance using the formula of speed of sound).<br>Then you call this function right before you call the movement functions. If the returning distance is less than your before_impact_distance, let's say 3 cm is the minimum distance from the obstacle object, then do not move.<br>ex:<br><br>if (dataIn == 'F'){ //if incoming data is a F, move forward <br> if (getFrontDistance() &gt; before_impact_distance){<br> moveForward(); <br> delay(delayTime); <br> }<br>} <br><br>if getFrontDistance &lt;= before_impact_distance then the function moveForward() is not called and the car doesn't move.<br>so You need at least 2 sensors, front and rear :)
<p>If you are building this project and you don't have a motor driver in hand, here is an alternative for you to continue this project. All you need is <a href="https://www.instructables.com/id/Motor-Driver-Using-555-Timer-IC/" rel="nofollow">Four 555 Timer ICs and some cables</a>. Check it out.</p>
https://funds.gofundme.com/mobile/dashboard?url=josephlee2223
Thank you for this link. I will take a deeper look into it later. I have done all this projects for learning, for fun, on my spare time. And then sharing them to all DIYers and entering the contests is another additional fun, winning or not. So about funding, I will reconsider it because I might not be around for a long time when I am busy with my business and family. And I think it is not fair if someone funds me to see my next projects but I disappear because I have no time for it :P
That would be awesome and much appreciated
Is there an iOS app that you can recommend for controlling the tank?
Check out this cool rover by Brookstone :<br>http://m.brookstone.com/rover-20-app-controlled-spy-tank
There must be. I am no fan of Apple and I don't own iPhone. Brookstone has benn selling their cool phone controlled rovers since a few years ago. I love it at first sight, that's why I learn how to build one based on Android phone since then. Thanks to ASCAS who enlighten me with his iBle ^_^ to build one at low cost.
<p>This project can be used for science exploration too. We can move slowly to watch animals' behavior closer. But I guess I need more lubricants on the gears to reduce its sound so we can move closer silently to the objects :)</p><p>I need votes ... (^_^ )v Thanks in advance.</p>

About This Instructable

16,432views

274favorites

License:

Bio: Just an ordinary person who loves #thinking and #tinkering
More by chienline:Dice Tower From a Box Plus Dice(s) Box of Connectivity V2.0 Ring Toss Game (From a Box) 
Add instructable to: