PDA

View Full Version : [Question(s)] Robot Remote Control Ideas



kankatee
11-14-2008, 01:15 PM
I would like to convert a PS2 or XBox controller into an RF/IR remote for my latest robot. I however have no experience in hacking either of those controllers. Can anyone give me some suggestions on getting started, pinout schematics, things I may need, etc.

I thought a PICAXE would be the perfect little chip to use for the controller, given it's tiny size and my experience in programming them.

Any feedback would be helpful.

elios
11-14-2008, 02:55 PM
Hi there, I have done a bit of PICAXE programming as well. I havent done anything with PS2 or xbox controllers so i cant help you there. But RF or IR transmitting and receiving are pretty straight forward.

Adrennalyn: can you explain where the Pots are and which pin is the variable?

Before anything else, what PICAXE chip are you going to use? 28X? 08M?

kankatee
11-15-2008, 02:11 PM
Yeah, no issues with RF. Very straight forward and similar to a BS2.

I am using a PICAXE-08M.

Adrenalynn
11-15-2008, 02:51 PM
The protocol is pretty complex. You're probably best served searching around and looking for a library for your chip.

Arduino library info: http://pspunch.com/pd/article/arduino_lib_gpsx_en.html

elios
11-15-2008, 11:57 PM
thanks, Addy. I think you can also Program picaxe with C++ or something. wouldnt it just be easier to make your own gamepad with some pots, then proggy it into the picaxe?

kankatee
11-17-2008, 10:30 AM
Thanks for the replies. elios- Yeah, sounds like it would be. I suppose when I said "convert", I really meant salvage the exterior of an existing controller by using its buttons, etc and just replace the innards with a picaxe and my own IR setup.

elios
11-18-2008, 10:47 PM
kwel. i am currently hacking a joystick for picaxe control, and it is suprisingly easy

kankatee
11-19-2008, 08:25 AM
Elios- excellent. Anything you can share that might assist me? Are you coding the picaxe in pbasic or c++ as you mentioned above? What or controller/joystick are you using?

elios
11-20-2008, 12:34 AM
hi Kankatee, im using a very old serial joystick which i have desoldered all wires out of then rewired it for my use. I will be using the standard picaxe coding, .bas files, using readadc prompts and if statements. i will try to then send the data via RF.

So i will keep you tuned.

Adrenalynn
11-20-2008, 03:18 AM
Which Picaxe are you using?

elios
11-20-2008, 12:43 PM
i am not sure yet. either a 08M or a 21A. most prolly the 08m. I have tested all the connections and i have it working on a multimeter.
before shot: showing pots.

Adrenalynn
11-20-2008, 12:49 PM
I'm curious how you'd get an 08 to work? About 60 lines of code, only about 1200 baud communication, 4Mhz, 8bit sample... How will you interface that to wireless? How will you sample your pots fast enough? How will you get enough resolution on the 8bit ADC? How will you fit your code in?

jes1510
11-20-2008, 01:10 PM
Take a look at the Arduino. It should handle what you are wanting to do fairly easily. Plus it uses a form of C.

Adrenalynn
11-20-2008, 01:43 PM
Some of the really big PicAxe's would do well too. And certainly it's hard to go wrong with an Arduino. Where I was going there really was to get him to start considering some of the design criteria. For me, these things never go well if I leap off into the unknown without thinking through the path to my landing. The little PicAxes just aren't fast enough to do software serial over high-speed serial links these days. The really little ones don't have the memory or pins.

jes1510
11-20-2008, 01:55 PM
Some of the really big PicAxe's would do well too. And certainly it's hard to go wrong with an Arduino. Where I was going there really was to get him to start considering some of the design criteria. For me, these things never go well if I leap off into the unknown without thinking through the path to my landing. The little PicAxes just aren't fast enough to do software serial over high-speed serial links these days. The really little ones don't have the memory or pins.

True indeed.

elios
11-21-2008, 06:37 PM
dont underestimate the power of the 08m!!!!!!!!! we have managed to run something like 20 LEDs individually controlled on it!!!!!!!!! it should be easy enough. you need one pin for the buttons then the two ADC pins for the pots, then 1 pin for RF transmitter

Adrenalynn
11-21-2008, 06:47 PM
What kind of RF transmitter? And don't I count three pots, not two?

elios
11-21-2008, 10:25 PM
yes, there are three pots in photo. bearing in mind that that is a before shot of the joystick. i have scrapped third pot as i cant be stffed using it. I am using three buttons and the X/Y pots.

elios
11-21-2008, 10:27 PM
a standard RF transmitter that runs off the PICAXE's power supply. http://acronum.com/nz-en/RF%20modules.php i sell them here

kankatee
11-22-2008, 09:50 AM
Hmm. Nice work. I think I'm going to have to snag a few of the above...

elios
11-22-2008, 03:45 PM
kwel. where are you exactly (country) because freight can be quite a problem in NZ, (different post shops charge you different :-( )

Adrenalynn
11-22-2008, 03:57 PM
Yeah, if you're not in NZ, just buy 'em from SparkFun. Cheaper to start with and cheaper shipping.

You will have to write your own error handling, connection handling, etc. If you don't, they won't work 90+% of the time. I have half a dozen of the same modules here...

Or you can save all that and go XBee which does all that for you at 20x the bitrate and several hundred times the distance (and with anti-interference)

elios
11-22-2008, 05:27 PM
okay. they have to be specific, from memory or they wont pick up on the serial comms from the picaxe, from memory

kankatee
11-23-2008, 11:46 AM
So I need some assistance troubleshooting this...

I know, this is as easy as it gets, but I am totally new to the PICAXE and am having a hard time understanding it's behavior. Here is the code:

main:
do

if pin3 = 1 then
high 2
pause 1000
low 2
pause 1000
end if

loop

I have a small switch on pin3. The odd behavior I get is this:
1) the LED on pin2 intermittently goes on and off
2) when I hit the switch on pin3, the LED on pin2 illuminates, but intermittently

kankatee
11-23-2008, 11:52 AM
Forgot, I am using a PICAXE-08M.

elios
11-23-2008, 01:11 PM
okay. try this

Main:
if pin3 = 1 then goto LEDon
pause 1000
goto main

LEDon:
High 2
wait 1
low 2
goto main

that should work if your using the PICAXE proggy editor

kankatee
11-23-2008, 03:10 PM
Elios- Thanks for the response.

Seems to work except the LED seems to stay lit(or pin3=high) for longer then the 1 sec specified. Does pin3 not return low immediately?

jes1510
11-23-2008, 03:23 PM
Main:
if pin3 = 1 then goto LEDon
goto main

LEDon:
High 2
wait 1
low 2
goto main

try removing the pause 1000 as shown above.

kankatee
11-23-2008, 03:30 PM
Yeah, PAUSE 1000 was just removed. Same thing, LED stay lit for ~2-3 seconds.

kankatee
11-23-2008, 04:05 PM
Ok, sorta solved..

I hooked up my PICAXE-14M, applied the same code from Elios (except using pin0 and pin5) and everything functions fine. Everything else is exactly the same. Seems odd I would have a bunk chip from SparkFun. Any thoughts?

elios
11-23-2008, 08:42 PM
Jes: the pause 1000 is the same as wait 1, and if it was running through the goto command, then you shouldn't have to worry about the pause, as it comes after in sequence of things.

Kankatee: nope, depends whether or not you have fried it, because PICAXE chips have zener diodes on each of the pins, execpt the +ve and -ve. i had one where i had fried one of the diodes and the adc went hay-wire and i couldnt get the chip looping without a debug

LinuxGuy
11-24-2008, 12:00 AM
Take a look at the Arduino. It should handle what you are wanting to do fairly easily. Plus it uses a form of C.
The Arduino uses real C/C++. It's really the libraries that make the Arduino what it is. :)

8-Dale

kankatee
11-24-2008, 04:07 PM
Thanks all, great replies. I'll chalk this up as lost time on a fried chip. At least it was only $3.95 and not $50 like the BS2s I'm accustom to.