Arduino > Xbee > Xbee > Arduino?

Hello,
I'm trying to make a remote controlled tank. I have a pair of xbees, a xbee usb board, 2 arduino boards, and a motor driver. I can get the tank to go autonomous without a problem. I was wondering if someone could point me in the direction of remote control from a computer.
I found the wonderful "iphone controlled tank" project. It uses the nifty TouchOSC program to communicate with the pc, which sends command to a xbeeusbboard > xbee > xbee > arduino. I was wanting to create something similar.

I don't have an iphone, just an android phone, so TouchOSC is out. I really just need a nudge in the right direction for getting serial commands from my keyboard, game controller, or other input to send to my arduino. So could someone offer a stepping stone? =)

Next, I would like to ask if it is possible for a game controller to interface directly to an arduino with an xbee attached, and cut out the computer entirely. I round up some analog controls and create my own controller, but I was wondering if anyone had any experience interfacing directly to a usb game controller through cut wires and a proto board? Is the power requirements too great, or would that depend on the controller?

Any suggestions would be greatly appreciated. Thanks for your time.

I've got a friend who has an Iphone that can control my pan/tilt web cam below. If an android phone can see the video and control the cam, then the setup would probably be fairly simple if you have a windows computer.

http://web.comporium.net/~shb/wc2000-PT-script.htm

I really just need a nudge in the right direction for getting serial commands from my keyboard, game controller, or other input to send to my arduino.

Open the Serial Monitor from the Arduino IDE. Type some stuff. Press the send button. Presto, the data entered is sent to the serial port, to be broadcast by the XBee.

Any application that can talk to the serial port could be used, or you could develop one using C, C++, C#, Visual Basic, etc. Processing also can be used to create applications and send data to the serial port. Lots of examples there.

Thank you! I found a simple sketch on the Processing web page that pretty much answered my question. I had looked through it earlier, guess I just missed it.
Now I'm looking for a way to have Processing read a controller input! I google it and it assumes I'm wanting to process gamepad input.

Would using a gamepad be possible to send commands to processing? I looked through the keyboard examples which seems to have a standard library built in, but I haven't found any useful information for a usb gamepad for input.

Now I'm looking for a way to have Processing read a controller input!

A microcontroller? As in an Arduino? There is a library called Firmata that you can download that contains a Processing module and an Arduino sketch that you upload.

The Arduino then becomes a Processing peripheral, just like the mouse and keyboard.

Alternatively, you can send serial data to the Arduino like "Tell me analog pin 4's value", and have the Arduino read, parse, and implement that command, which would involve returning data via the serial port. (For ease of parsing, you might want a simpler command, like "R A 4", but that's up to you.)

My apologies, I was refering to a usb gamepad controller. Having the Processing application read the gamepad inputs from the pc, then send serial commands to the arduino (or xbee) based on the input from the gamepad. Guess I might need to try a Processing forum. =)

Oh, and thanks for the awesome tip on on Firmata, I could think of a lot of uses for such an interface.

Hi Lloyd,

If I understand correctly, you want to control your tank with a gamepad controller connected directly to the Arduino so that you don't have to use the computer? and you would use the buttons on this gamepad controller to send instructions to the other arduino via xbee.

these 3 following links explain how to control the arduino using a playstation 2 wireless controller

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1203744779

this last link explains how to control your Arduino using a NES controller:

you can also buy the joystick shield kit on Sparkfun.com (which is a shield for Arduino):

I may have gotten it wrong, if it's the case I'm sorry
But if it's what you wanted , have fun! :slight_smile:

Hi

I am looking at doing a similar thing using arduion and processing any chance you could post the processing link you found.

thanks

@retxed68 - Fantastic! Exactly what I was looking for.

@Penfold - http://www.processing.org/learning/library/simplewrite.html
This is just a simple processing example to send serial commands. It gives you a general idea of the process involved.

I am still looking for a way to use a usb gamepad connected to a computer which then interfaces to a Processing application to send serial commands to the xbee > xbee > arduino.

I have a usb explorer for xbee I can interface with a Processing application. I thought it would be nice to have an application that could send and recieve information from my rc tank. If I can't find a way to link a usb gamepad directly to the processing app to directly control the tank, I may move on to create a dirty gui to control the tank. I would also like to be able to report the status of any sensors i attach to it (photocell, ultrasonic, motion, and whatever else I can cram in there!) through the gui also. I hope this isn't wishful thinking, but if I manage to get something put together, I will be sure to upload the source to the Exhibition section.

Thanks again for getting my brain on the right track.

Lloyd,

What you can do is connect the wireless playstation 2 controller directly to the Arduino next to the tank (you just need to solder the receiver), then you could connect one xbee on the Arduino too and one xbee on the computer.

This xbee link will send information to the computer and you'll display them on the screen with an application created by processing.

That way, your tank would always be controlled wirelessly by your controller (even when your computer is shut down) and send info by xbee.

If you want to display the information, just connect an xbee on the computer and launch the application and voila! It could almost be plug and play! (with a little work :slight_smile: )

You don't need an arduino on the computer side, you can do it with just an xbee.

im trying something like that. i have 2 arduino 2 xbee moduals 2 xbee shields and a joystick shield 2 servos
now im trying to control 2 servos (pan and tilt) can any one give ideas or even better code
please help
thanks
P.S. im new at this