Instructables

How to build an Arduino WiFi 4x4 with Android Controller

RC cars can be WiFi Cars...?

RC cars are cool, but cheap RC cars have limited range and can only be controlled with the particular controller that was included with the car.

I purchased a RC jeep, complete with 4 wheel drive, flexible suspension, and off-road tires for about 30 bucks. Not long after playing with the car I determined that I could improve it by using WiFi and Android. So I wasted little time, and completely remove the circuit board that make up the cars electronic system. Using the existing electronics I determined the voltages and devised a motor control system that could be operated by the Arduino using a custom shield that I developed. The motor control system does not implement any PWM to control the speed. The car is design to crawl over obstacles, with very low gearing as a result it is very slow.  This meant that just having the motors turn on and off would work just fine. The circuit I designed will however support PWM by using the enable pins. 

 I have been using the Arduino microcontroller in projects for a few months. I also purchased the asynclabs (http://asynclabs.com/) WiFi Sheild for the Arduino Duemilanoe to experiment with WiFI and microcontrollers . It comes with a package installs into the Arduino IDE. Building off of the “SocketServer” example I was able to build sketch that lets me control the motors and steering over WiFi.

I then used Visual Studio to put together a quick windows form application that connects to the car server and issues commands to control the motors, steering and lights. Then got bit with the android bug, after building a couple test apps I finally managed to get a working version that uses the orientation sensor to determine the desired car function.
Here is the step by step,
 
 
Remove these adsRemove these ads by Signing Up

Step 2: Design Motor Control Circuit...

Picture of Design Motor Control Circuit...
CarControllerMotorControlerBoard.png
Using Eagle,

I put together this circuit to function as a motor controller and power regulator for the arduino board.

It allows use of the standard 7.2V battery pack to power the drive motors, steering motors and the arduino.

This circuit uses the sn754410 dual h-bridge chip to switch the drive motors and steering motors. The control lines for the motor controller are pinned out for direct soldering to the end of a RJ45 cable that plugs into the shield. This allows for easy removal of the Arduino and WiFi Sheild.

Eagle Files are included here.
 

Step 3: Design Arduino Shield Circuit...

Picture of Design Arduino Shield Circuit...
CarControllerArduinoSheildBoard.png
Shields UP...

Using SparkFun’s Eagle part library I designed a Arduino shield that will pass the pins to the WiFi shield and connect to the motor controller shield via the RJ45 Connector and 2 screw terminals.

The pin-out off the RJ45 connection is very important. If you get the wires crossed it will cause unexpected results later. This is difficult to troubleshoot, I won’t get those hours back, Anyway onward to PCB etching.

Step 4: PCB Etching

Picture of PCB Etching
This has been covered many times, I learned by following the many "ibles" here.

http://www.instructables.com/pages/search/search.jsp?cx=partner-pub-1783560022203827:npr2q7v5m6t&cof=FORID:11&ie=ISO-8859-1&q=etch+pcb

I use the toner transfer method, and it works well for me. but use the method that gives you the best results, Practice makes perfect.


Step 5: Test fit boards in car.

Use Velcro to attach your card stack to the RC car. I was lucky and had a large flat rear deck covered by the roll-bar to hide the electronics under.

I do not have any pictures of the motor control board, I was getting excited and forgot to take pictures as I was putting it together. It does however mount to the original electronics standoffs and clear the housing.

 

See the pictures for details.

Step 6: Programming...


Disclaimer!!!!

I am not a programmer. I know enough to be dangerous and have figured out a lot by looking at code examples on the web.  This code may not be pretty or the most efficient, but I was able to get it to work. If anybody has any suggestions just leave a comment or message.

The Car

The Arduino IDE is quick and easy to pick up. I was able to put together this CarServer based on the SocketServer Example that came with my AsynLabs WifiSheild. 

You will have to input your wireless connection information in the Arduino sketch. 

When the car is powered on give it 15-45 seconds to establish a connection with the router. The red LED on the WiFi shield will power on when a connection has been established.


The Windows  Controller

I put together my first controller using C# and MS Visual Studio 2008. I ended up with a nice little windows form that makes controlling the car with the arrow keys possible. 

Then I had an IDEA.... see step 7...

Step 7: Android...

Picture of Android...
CarControllerAndroid.PNG
Why not have my phone control the car?

I thought to myself about a week after getting my shiny new DroidX. I began researching and ended up using the android SDK and eclipse to put together a similar app, that will control the car using the orientation sensor. 

Hacking my way through the code, looking at many examples took quite some time but, I eventually ended up with this.

insert the IP and port you specified in the arduino code hit connect and you are off. Hold the phone in the horizontal position. Then lean it away from you to go forward and backwards to go...eh...... backwards. 

use the phone like a steering wheel to go left and right.

//// Warning ////
This is my first large android application.. It still has some bugs but is mostly functional. Still any advice or issues feel free to comment or message me.
///// End of Warning////

Step 8: Rule the backyard with your WiFi 4x4 !!!

Reflection

I had an excellent time building this project. I gained a lot of knowledge, and picked up some new skills. and now I have a 4x4 that can be operated from my phone. 

Some Additional Thoughts,

I really need a Camera to mount inside the cab behind the windshield, POV 4x4 crawling the backyard would be awesome. It would have to be low power, and transmit wireless video by itself. (I don't think the arduino has the power to stream video). Any thoughts on a Camera that could be used?

Thank you for reading my Instructable.
Good Luck,

Here are some shots of WiFi 4x4 in action.



Laser Cutter, 

Wow, I have to say that is an amazing prize for any contest. It would most likely go into services making custom cases for my electronic projects. Good luck to all in the Contest.

Brandon
ashaikh145 days ago

kindly share the arduino sketch so that I can be able to write a code

moegamatn3 months ago

This is so brilliant.

I desperately need to try this.

Luvly :)

Moegamat

yup

Frans044 months ago

Are you able to control the WIFI car from anywhere or just in your Home-network(LAN)?

MichaK Frans041 month ago

nope

MrSTUDofRC9 months ago

How many farads are C1 and C2?

bkimmons (author)  MrSTUDofRC7 months ago

They were small 10uf, just enough to smooth the 5v to the Arduino.

MrSTUDofRC9 months ago

And what are the resistor values?

bkimmons (author)  MrSTUDofRC7 months ago

There is only one, for the Temp Sensor. It was used with a trim pot and then calibrated to the correct temp in software. I am afraid I don't remember the value.

rnituc7 months ago

i will try to combine this project with this project

http://www.instructables.com/id/Android-controlled...

i use arduino due, arduino wi-fi shield, and as motor shield i will use l293d hbridge

i might need some help programming arduino and android but shortly i will come back as it is work in progress

bkimmons (author)  rnituc7 months ago

I am looking at using the BeagleBoneBlack to replace the Arduino and provide video streaming capabilities.

randalcr7 months ago

I get a "uip_conn undeclared" error when I hit the verify button. Is there something I need to modify in the sketch or is that something it needs to actually run on the arduino?

lukeD10 months ago
do you have a good (cheap) alternative for the asynclabs module? the site doenst exist anymore and i cant find the asynclabs online.
mrhacker1 year ago
Great instruct able. For the camera, you can get another android phone or tablet and mount it on the car. Download an app called ip camera on the phone and set it up. Then download ip camera viewer on your other Android or get a laptop and type in the ip in your Web browser and you have a video feed! Depending on the phone and your wifi it might be a bit delayed. I tried it with an evo 4g and a galaxy s3 and worked perfectly for this airsoft truck I have
Mr.Bukhari1 year ago
hey nice project, whats the total cost if i ask u to make it for me???
donmatito1 year ago
I like that. I'm going to try it!
Actually sorry for that foolish question. I realized everything now.
But now I have another two questions.

1-In the 3rd step in circuit i can see a output which is named as a AUX. What is the use of it?
2- Another thing is what are the resistor values and for what u have used the temperature sensors in that circuit.

Actually I appreciate your work and thanks for the early reply. If u can attach the full list of components u needed for ur project it is gud for others too. Specially if u can mention about Wi-FI shield ur using.
Thank You........
Thanks for this really cool stuff.
I can see that you have connected one RJ45 pin to the wifi shield. But can i know to where do u have connected the other end of the RJ45 connector.
That's the part i got confused with.
Thank You.
bkimmons (author)  WarGodfather1 year ago
In step 2 you should see a section of tabs labeled "to Arduino" The RJ45 cable is pinned out to these pads to control the H-Bridge for the motors and steering.
bakarony2 years ago
sir... i also try to make this one for my school project but i have some trouble. and can i ask about the motor shield? where we can find the motor shield. we need to buy it or we just get it from the RC Car that we dismantle? if we need to buy it i can't find it on my country (indonesia). any way can you help me..
bkimmons (author)  bakarony2 years ago
bakarony,

I built my own motor controller in step 2. It is just an Hbridge driver that is controlled by the arduino.

It is possible to use the motor control circuit that came with the car but it would require some investigating of the actual board you have. I found it simpler to build by own.

Brandon
sir.. have you try to use arduino motor shield??

ok sir if we need to make the motor shield. so i need to find someone who can do the board print..

Herman
bkimmons (author)  bakarony2 years ago
It should be possible to make it work with the Arduino motor shield, You would just have to make sure that your motor control outputs don't conflict with the WiFi modules required pins.

As far as printing the board.... I was able to use the toner transfer method. however it is a fairly simple board and could be hand soldered with wires on a prototyping board.

Good Luck.
coder5123 years ago
I wana build this without using Arduino.
Just wana build it using Wifi Server and Client Dongle.
bkimmons (author)  coder5122 years ago
oldsmarracin is correct, you need the Arduino to run the car, as it operates the socket server and controls the motor control board.

the arduino is what control the car with out that the car wont move
rawand2 years ago
Amazing!!!! its awesome
valimdj3 years ago
does it work with this wifi too ? APC220

http://www.dfrobot.com/index.php?route=product/product&product_id=57

javi_vite3 years ago
really nice idea man!!! i love 4x4 rc and android in the same pack so to say hahahaaha, im a do my own 4x4 android judt to test and show off to my litle cousins :D lol
Chowmix123 years ago
Check out Cellbots. Its an opensource project on using bluetooth and other means to connect an android phone to be either the brain or controller of robots.. maybe somewhat of interesting. They were actually looking for someone to help them with WIFI direct.
Do you know where I can get that WiFi module but without the Arduino shield? Async Labs doesn't provide a datasheet or even a part number in their store page or wiki, unless I missed it.
Never mind, it turns out to be a Microchip product.

I don't use Arduino so I'd like to have it without a shield, here is the link for anybody in my situation

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en548014
RedMeanie3 years ago
Wow! I wish I had the time to do this! Very Good Instructable. Great Work!

If you could set up a video server app could this be remotely operated like the mars rover? Some software that might suffice, and could possibly be tweaked for this would be the app that the little Iphone/Ipod remote quadricopter thingy uses.

If that software could be hacked to function through the net, I would "Make" time to build it.

Anyways, Great Job and Thanks For Sharing!