Introduction: Arduino + Game Maker Rover

In this Instructable I will be giving you step-by-step instructions on how to interface The Arduino, A Motor Controller (L293D), and a laptop to make a Wifi controlled rover you can drive around your house or work from anywhere in the world.

I started and made this project for my Gr.11 Computer Engineering class, it took approx. 5.5 hours including design, testing and implementation.

I will Provide all the necessary files to open the program in Game Maker and change it around. However at the end i will provide you will a .exe that will work with no changes.

**Disclamer**
I am NOT responsible for any Damage caused by wrong wireing, unforseen problems, faulty software or damage the Rover does to itself or others.

Step 1: Parts

Bought online
390ohm Resistor x 1
150ohm Resistor x 1
220ohm Resistor x 1
Screw Terminals  x 2
L293D                  x 1
Red Led               x 2 (ebay)
White Ultra Brights x 5 (ebay)

Found
2AA Battery Holder x 2
Mercury Tilt Switch x 1 (out of old thermostat)
Laptop (long Battery Life Preferred)
Bread Board
Arduino (uno)
Misc. Wires
DM74LS245N
Motors (GM2 from Solarbotics )

A great Place to buy these Parts is from Mouser .

Step 2: Get the Software

To make all this run properly you will need a few things.

1) Game Maker PRO 8 (or higher)
You can buy it for about $25 or there are alot of cracked versions if you want to take a risk.

2)Drivers
File - Arduino Drivers
These drivers are needed to make the Arduino UNO work with your computer.
When you connect the Arduino and your computer tries to install drivers from the update manager, direct it to this folder and it will install them.
If that doesnt Work:
Go to
Control Panel >> System >> Device Manager
And Install them from there.
**This number Changes if you plug the Arduino into a different USB Port**

If you are using a different Arduino the Drivers are up to you to find.


3) The Drivers and .dll to make the arduino work with Game Maker
File - usb.dll

4)The dll to let Game Maker interface with your computers Webcam
File - Webcam.DLL

**It is important that all files using the .dll are saved in the same folder with the .dll**

Step 3: Testing Serial Connection to Arduino (Optional)

Go to
Control Panel >> System >> Device Manager >> Ports

Look for the Arduino and right next to it in brackets it should say "COM" and then a number. Remember that Number! (it changes if you plug the Arduino into a different USB

If you have any experience in electronics you can wire a breadboard to test the Arduino connection.
Pins 2-9 on Arduino to pins 9 - 2 on the LS245N
Pins on LS245N 11-18 to LED's
Push buttons wired to Analog pins 1&2 on Arduino


Now Open the Folder Called Test (on this instuctable) and run serialtest3 (in Gamemaker) then Execute it.
Or Run the .exe serialtest3
When it asks for your Com Port enter that Number you were supposed to remember

By Pressing F1 you can read the infomation on the program.
Here is a Quick Summary
Press Enter - Enter a number - Arduino will Display it in Binary on the LED's
Press the Buttons - Little Red Dot Moves

If The Program comes up with errors try restarting your computer.


Attachments

Step 4: Building the Circut - Connecting the Motor Controller

For this project I inserted a microcontoller () between the Arduino and the Rest of the circuit in case something goes wrong.

Simply follow the schematic posted and everything will work.
I Posted a EAGLE Schematic aswell as a PDF of the Schematic

Some notes on the schematic:
   Power and Ground come from the Arduino for the circuit.
   Pins 2 - 9 are connected to pins 9 - 2 on the Arduino.
   V2+ on the L293D is the separate power for the motors, so you can put            your appropriate voltage to them. 
   I used 2 2xAA battery holders to supply the correct voltage to the motors.
   A DIP Socket is Recommended if you are soldering the board.

If you have any questions Please Post them in the Comments Or PM me

Step 5: Building the Circut - Wiring the Rest

Head Lights
The head lights should be wired separably from the board so that they can be mounted facing forward. I did not do this because didn't have time to.
There are 4 ports on the chip used to control the LED's so not to overload one port. I wired one LED per port however you could wire as many as you would like without overloading the circuit.

Wire the LED's to Pins 15 - 18 make sure you use resistors and the polarity is right!

Mercury Tilt Switch
I used a Mercury Tilt Switch for 2 inputs because in order to get full marks i needed to use the Arduino Inputs. Realistically it is not needed.
The Tilt switch is used to tell you if the robot is going to fall or is on a hill. it controls the status label on the interface.

On a tilt Switch there are 3 wires, 1 needs constant power and the other 2 get connected to the Arduino Analog inputs 0 and 1.
You will need to do some testing to see what wires go were on yours.

Step 6: Base

For the base Cut a Piece of "Hard board" or similar to dimensions that are reasonable or slightly larger the then laptop being used for the Rover.

Line up the motors in there positions underneath the base and mark places to drill holes large enough so you can fit Zip ties though to secure the motors.
Push the Zip ties though and tighten them to secure the motors on place.

For a caster i Duck taped a cut water bottle to the back, however you can use whatever you have handy, or a proper caster.

Drill a separate hole beside each motor to pass the wires though and tape them in place.

Attach the Wheels using the included hardware.

Step 7: Connecting the Hardware to Software

You are finally done the hardware and it is time to make sure it all works.

Place the laptop on the base with the motors and caster already attached.
Secure the circuit to the base/laptop so it wont fall off. i used rubber sticky feet on the bottom.
Plug the Arduino into the Computer using USB.
Plug in the batteries.

The Arduino should have one light that is constantly on, and one flashing.

Both Status LED's should be constantly on.

Step 8: Learn How to Use the Interface

When Running the program, the first screen you have to enter the COM port.
If you need to find it. Check here:
Go to
Control Panel >> System >> Device Manager >> Ports

The Interface file has all the GM Files, and the .exe to run the program.


Controls (On Screen)
Up Arrow - Go Forward
Left Arrow - Rotate Left
Down Arrow - Reverse
Right Arrow - Rotate Right
Lights On - Turns Head Lights On
Lights Off - Turns Head Lights Off
Center - All Stop
Initialize - Tests Rover Functions
Picture - Takes Picture from Webcam (saves to location of program)

Controls (Keyboard)
Up Arrowkey - Go Forward
Left Arrowkey - Rotate Left
Down Arrowkey - Reverse
Right Arrowkey - Rotate Right
F2 - Turns Head Lights On
F3 - Turns Head Lights Off
F6 - All Stop
I - Initialize - Tests Rover Functions

Step 9: Access the Interface From Anywhere

To Access the Rover From anywhere that has a internet connection I used a free Software called Log Me In .

It is a great software that allowes for you to log onto the slave laptop and control the mouse and keyboard allowing for you to drive the Rover.

Simply install the download on the rover laptop then log on from anywhere with Wifi.

Only Problem is the webcam Doesn't Refresh on the slave computer Fast Enough and takes some getting used to.

Step 10: Conclution

This was a really great starter robot to learn off of, the Arduino is s great board to use and has proven to be very flexible and expandable.

I only wish i had more time to implement the robot and show it off a bit more ;)

If you have any questions just post in the comments. 

Microcontroller Contest

Participated in the
Microcontroller Contest