Introduction: 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,
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Tools and Parts
This is a general list of the tools and parts that were used to complete this project.
Look at the Eagle Documents for exact specs of the components used.
PCB etching supplies
Copper Clad Boards
AsyncLabs WiFi Sheild
Motor control H-Bridge
Step 2: Design Motor Control Circuit...
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...
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
This has been covered many times, I learned by following the many "ibles" here.
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...
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 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...
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 !!!
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.
Here are some shots of WiFi 4x4 in action.
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.
1 Person Made This Project!
- kymark12 made it!