loading

In this Instructable we're going to build a MouseBot.

The MouseBot is a small wireless arduino robot that you can control with a computer. It doesn't require a Wi-Fi module. Instead it uses an android phone to connect itself to the internet. The android phone also provides the operator with a video feed from the robots point of view.

I made this robot because I wanted to give myself a method to manoeuvre an environment from the ease of my keyboard.

What I really like about this project is you don't need many special parts besides and Arduino and motors. There is no need for bluetooth modules or Wi-Fi modules. The other required components, like a phone, wire, 9v battery, are generally things people have lying around.

*For this robot to work the Android phone and computer MUST be connected to the same Wi-Fi network.

Step 1: How It Works

So let us understand how the system works.

The robot's "remote control" is a webpage hosted on the computer. On this web page, the user can click buttons that make the robot go forwards, backwards, and turn left and right.

When the user clicks a button, the webpage writes a command to a txt file that is also hosted on the server. This txt file is called keyLog.txt.

There is a phone mounted on the robot. A program on the phone is continuously GETing the contents of keyLog.txt and then forwarding the data, over a usb cable, to an arduino.

The arduino has a simple sketch that controls the drive motors connected to it.

-if w is inputed

go forwards

-else if s is inputed

go backwards

-else if a is inputed

turn left

-else if d is inputed

turn right

*All of the code for this project has already been made. You will just be required to modify ip addresses.

Step 2: Materials

Robot

  • arduino uno
  • android phone
  • wire
  • switch
  • 9v battery
  • 9v battery pack (i scrapped together a battery pack by taking apart a dead 9v battery)
  • usb OTG Cable(You need this to connect your phone to the arduino. You can pick this up at any electronics shop for a few bucks)
  • 2 continuous rotation servos(This is for the drive train. Any small motors that you can control with PWM will do)
  • 2 small wheels
  • castor wheel
  • android phone
  • computer

Phone Apps

  • IP Webcam (We use this app to send video feed from the robot to the computer)
  • Protocoder (We run our program on this app. It's not on Play Store so you have to download it off of here)

Computer Software

Step 3: Build the Robot

Let us put together the robot now. We'll do the wiring in the next step.

The structure of your robot can vary, so feel free to be creative with it! The positioning of most of your components doesn't matter. Just make sure to have a castor wheel attached to one end of your robot and 2 drive train motors attached to the other end.

Grab a piece of wood or plexi, and mount your arduino, breadboard, drive train motors. I ended up Velcroing my arduino and hot glueing my servos and breadboard. I also glued a castor wheel to the other end of my robot.

Hot glue your wheels to your servo. Try to get your wheels as centred as possible.

Connect your battery pack to your breadboard. I soldered a little switch between my positive lead and the breadboard.

Plug your OTG cable into your USB AB cable and then plug in your USB AB Cable into your arduino.

I wrapped my cable up with tape and then I attached it to the robot with an elastic.

Step 4: Make a Phone Holder

You're going to want add something to your robot that holds your phone in place.

You'll also want to make it easy for you to attach and remove your phone.

I glued two sets of bricks to hold my phone in place.

I also plugged in a 9v into the battery pack and tied it to the bricks with an elastic.

Step 5: Wiring the Robot

Wire it up

*Signal wire on the left motor should be connect to port5 and signal wire on right motor should be connected to port9

Step 6: Upload Arduino Code

Congratulations! You have finished the physical portion of this robot. All that's left is uploading the code.

Upload this sketch onto your arduino.

After you upload the code, you now have a robot that you can drive around while tethered to the computer.

Step 7: Test Your Robot

Before we make the robot wireless, let us drive it around while wired.

Connect your arduino to a computer with a USB AB cable. Then open the arduino Serial Monitor.

Now enter the commands w, a, s, d, and spacebar. The robot should move forwards, backwards, turn left, turn right, and stop.

If the servos don't spin at all, check the battery voltage. Make sure that the servo's black wire is connected to the arduino's ground and the battery's ground. Ensure that the signal wires are connected to the correct pins on the arduino.

If the controls are inverted you may have to invert values in the arduino code.

If you have any problems that you can't solve, comment below.

The arduino serial terminal doesn't provide the best interface to drive your robot around. I recommend you install PuTTY and use that serial monitor to play with the robot.

http://www.chiark.greenend.org.uk/~sgtatham/putty/...

Step 8: Install MAMP

You need some sort of server software that can host a webpage. (MAMP, WAMP, Uniserver, etc)

I have found that MAMP is the easiest server software to use.

https://www.mamp.info/en/downloads/

Step 9: Make the Remote Control (Webpage)

Now we need to make a remote control that can drive the robot wirelessly.

Our remote control is going to be a webpage hosted on our server. The user can go onto this webpage and click buttons that control the robot.

When the user presses a button the webpage writes a command to a text file, also hosted on the server, called keyLog.txt. Since your phone is connected to the internet, it can read the contents of keyLog.txt and forward the command(contents) to the arduino.

Attached is the code and markup for the webpage. We need to make one change.

Open the file index.html and find the line: iframe src="http://192.111.1.111:8080/"

You must change the ip address to your phones ip address. So if your phone's ip address is 192.333.3.333 this line of code would now be: iframe src="http://192.333.3.333:8080/"

You can figure out your phone's ip address by installing IP Webcam. The app automatically gives you your ip address after you open it.

https://play.google.com/store/apps/details?id=com....

Step 10: Save the Remote Control (Webpage)

Go to program files, open MAMP, and then open a folder called htdocs.

You must save all of the files, from the last step, in this location. Make sure index.html has been edited first.

Now start a Mamp server and type localhost into your web browser. You should be greeted with the pictured page. If localhost isn't loading try checking Mamp's port number

Click on the left side buttons. Then type localhost/keyLog.txt into a new tab. Make sure the contents of keyLog.txt changes as you click on different buttons.

If you open IP webcam on your phone and start a server, a video feed should pop up on the webpage. If a video feed doesn't pop up make sure the IP address and port number that the app gives is the same one in index.html

*The right side buttons don't do anything yet. They're just there in case you want to add more functionality to the robot.

Step 11: Install Protocoder on Your Phone

Congratulations! You now have a remote control and a robot that you can drive around. Now we just need to connect the two by adding a program to your phone.

Protocoder is the app that runs our program on the phone.

You can download it, on your phone, here:

http://www.protocoder.org/

Step 12: Edit Phone Code

Here is the code that GETs the file keyLog.txt from your computer and forwards it to the arduino.

You have to make one edit.

Find the line: network.httpGet("http://192.111.1.111/keyLog.txt", function(status, response) {

Change the ip address to your computer's ip address

So if your computer's ip address is 192.333.3.333 the line would now be: network.httpGet("http://192.333.3.333/keyLog.txt", function(status, response) {

You can find your computer's ip address by opening CMD and typing ipconfig

After you have edited the phone code, make a new project in Protocoder and paste the edited code.

Step 13: Drive the Robot!

There is procedure to getting the robot up and running.

Run IP Webcam on your phone

Start a Mamp server and open up the webpage.

Attach your phone to the robot and run the protocoder program

Finally, turn your bot on and drive it using the webpage.

Step 14: Future

Eventually I want to turn this robot into Skype on Wheels. I want to give two people the ability to talk and interact with each other using this robot.

If you guys do end making a MouseBot, post a video in the comments. I would love to see them.

I added some extra buttons to the remote control page, so take a shot at adding some extra functions to your robot.

In the end, just make sure to have fun!

<p>im getting an error in protocoder &quot;cannot find function startardunio in object&quot; check out the screenshot image attachment </p><p>what shuld i do please help me.. or u can please mail me mrnlmachaiah@gmail.com</p><p>please help me this is my final year project and im stuck..</p>
<p>I need to see the code you're working with</p>
<p>how to increase the time duration of the servo running .. it only runs for few milli secs please reply at mrnlmachaiah@gmail.com or here</p>
<p>The code is set up to have the servos run until you press stop.</p><p>Check differences between your code and project code. </p><p>Otherwise it must be a hardware problem. Test your servos by running them from serial terminal</p>
<p>i tested from serial terminal it only runs for some milli secs only and stops</p>
<p>thankyou .. :)</p>
<p><strong>please help me..</strong></p><p>im getting an error in protocoder &quot;cannot find function startardunio in object&quot;</p><p>what shuld i do please help me.. or u can please mail me mrnlmachaiah@gmail.com</p><p>please help me this is my final year project and im stuck</p>
awesome dude
I gonna make it for my science day
awesome
<p>ok thanks </p>
<p>Hello its good project</p><p>but i cant not download file index.html and test2.php</p><p>help me plzzz)</p>
<p>In step 8, I've added txt copies of both files. Those should download fine.</p>
<p>Great to do such an easy way for controlling robot without modules (Y) <br></p><p>very Good Job (clapping) </p>
<p>I think it's missing the index file</p><p>Looking forward to complete the project!</p>
<p>Hmm, I had some difficulty downloading the index.html file as well. I resaved it as a .txt file and that seems to have done the trick.</p><p>Thanks for the heads up!</p>
<p>Thank you, much appreciated!</p>
<p>Very nice!</p>
<p>thanks!</p>

About This Instructable

3,012views

47favorites

License:

Bio: me@swal.xyz
More by Call Me Swal:CNC Made From Garbage Working Spider-Man Web Shooter Make a TumblyBOT: Flipping Spinning Tumbling Robot 
Add instructable to: