PS2 Controller + Arduino Control System

Control Boards, Controllers, Tethers, Ect.
njs552
Posts: 61
Joined: Jun 10th, 2013, 6:22 pm
Location: Sacramento, CA

PS2 Controller + Arduino Control System

Post by njs552 »

Hello!

Here is my prototype control system hardware design:

Surface Control:
-PS2 Controller
-Arduino Uno
-MAX488E - convert arduino serial(rs-232) to long distance serial(rs-422/485)

Tether:
300ft Cat5e Stranded
300ft 12 or 14 AWG speaker wire

In the ROV Pressure Vessel:
-Arduino Pro Mini
-MAX488E
-3x Hobbyking 30A car ESC
-2x DC to DC power converters
-1x Dual SSR Relay
-NTSC Camera with Pan/Tilt

What do you guys think? Are there things I should change/add?

Thanks!
njs552
Posts: 61
Joined: Jun 10th, 2013, 6:22 pm
Location: Sacramento, CA

Re: PS2 Controller + Arduino Control System

Post by njs552 »

Here is a video of some of the things above in a test setup.



Thanks!

EDIT: Test software is available via direct download: https://www.dropbox.com/s/8l44buf1he2j0 ... 20v1.0.zip
njs552
Posts: 61
Joined: Jun 10th, 2013, 6:22 pm
Location: Sacramento, CA

Re: PS2 Controller + Arduino Control System

Post by njs552 »

Here is the next step in testing my control system.

In the video below my control system from before is connected to a single motor to test the motor and ESC.



Here is the motor/ESC/hardware from the video:
Motor: http://hobbyking.com/hobbyking/store/__ ... _140w.html
ESC: http://hobbyking.com/hobbyking/store/__ ... verse.html
Prop Adapter: http://hobbyking.com/hobbyking/store/__ ... _Pack.html
Propeller: http://hobbyking.com/hobbyking/store/__ ... x9mm_.html


Thanks,
njs552
dna1990
Posts: 48
Joined: Mar 14th, 2013, 6:36 pm

Re: PS2 Controller + Arduino Control System

Post by dna1990 »

Nice work. and the code you posted is a great help. I have studied and benefitted from KR2's code and post a lot as well.


Just got around to experimenting with a PS2 and Arduino today with the Bill Porter lib.

Got everything to work and report back all the buttons and variables. But the analog sticks seems to have a very short effective range.

From the center, it stays at 128 for an acceptable dead zone. But the ramp to 0 or 255 from there is only the next few degrees of stick movement, after which is constant 0 or 255. This occurs on both sticks and in both directions.

Is this a function of the controller or the library? These are surplus PS2 controllers, but appear original, not OEM looking.


If it were the other way, I could easily use some math to set a sensitivity and dead zones to my liking. But reporting back full range numbers at only about half stick does not give enough raw data resolution to work with.
njs552
Posts: 61
Joined: Jun 10th, 2013, 6:22 pm
Location: Sacramento, CA

Re: PS2 Controller + Arduino Control System

Post by njs552 »

Thanks! Here is the current code from the video above: https://www.dropbox.com/s/661y8ne95o8us ... ftware.zip

My neutral is 128(same as yours) but I added ~20 on either side for a deadzone, 110-150, so outside of that range are the usable values. I have noticed(and you can probably see in the video), that there is a point at which the values stop increasing at the very top and bottom of the range of motion.

Here is a video of my setup and its range of motion:


Does your PS2 controller act similarly to what mine did in the video? I bought mine on Amazon, and it is nothing special. We are using the same library, so I am not sure what the problem could be.

Thanks,
Nick
dna1990
Posts: 48
Joined: Mar 14th, 2013, 6:36 pm

Re: PS2 Controller + Arduino Control System

Post by dna1990 »

Just judging by the video, I would say you have more sensitivity and smoothness than ours. Although I see yours too seems to max out about 2/3 of the joystick travel. That would still be annoying.

One plan was to have a mode in which you press one of the triggers - so it cuts all your throttle numbers by half or something. So when trying to precisely maneuver, etc. That can still be done, but it seems less useful in a shortened joystick travel.

I did have the team confirm, and we DO have a generic controller. I may spring for a real Sony one - and see if any better. Other posts suggest our generic has 5bit resolution, where your real Sony one has 8bit. That would explain perhaps the smoothness of your acceleration.

They did some very early experiments when learning the Arduino with a separate joystick unit. Straight analog. The joystick travel was perfect on that unit, not so in these where I assume something is lost in the analog/digital world. Form a quick glance, this is not something the library seems to mask/convert, so it is coming from the firmware like that.
njs552
Posts: 61
Joined: Jun 10th, 2013, 6:22 pm
Location: Sacramento, CA

Re: PS2 Controller + Arduino Control System

Post by njs552 »

Yeah. It is too bad that we don't have the full range, but I am pretty sure that it is a hardware/firmware limitation with the potentiometers and/or A/D conversion.

I am not sure exactly how much if at all the 3 "gears" will actually help in the water, but at least it is a option.

I also have this generic controller from amazon as well: http://www.amazon.com/gp/product/B001MW ... UTF8&psc=1

Here is a video comparison between the Sony and generic brand:


It is clear that there is a difference between the two brands of joysticks, and the 3bit difference sounds about right. It is too bad, but it also could be worse. I think it is acceptable for what we are doing.

I have also played with the X/Y joystick units, and they do have full travel - if possible, a custom built joystick with those would be the best. It could be done easily with a 3d printer and some custom PCB's.

Thanks,
Nick
dna1990
Posts: 48
Joined: Mar 14th, 2013, 6:36 pm

Re: PS2 Controller + Arduino Control System

Post by dna1990 »

Grabbed a Sony out of the used bin at Gamestop on the way home. Works WAY better. Both in resolution and travel.

But agree, an ROV is not a quad copter or something with sensitive needs. This was more an academic point for my students. Esp now as we can really alter the throttle 'curve' with (dare say it) MATH, to produce various startup and ramps to full throttle or do limits for precision, etc.

One of them has discovered the MAP command in Arduino...but I don't let them use it. Do your own ratios for now, I say.
njs552
Posts: 61
Joined: Jun 10th, 2013, 6:22 pm
Location: Sacramento, CA

Re: PS2 Controller + Arduino Control System

Post by njs552 »

Glad that worked out for you!

Although I am most likely not going to try and alter any motor performance, I admit it would be nice to be able to tailor the ramp up of a motor for better performance.

Don't let them look at my code :) It has map as well as constrain functions... :)

Good luck with your build!
Thanks,
Nick
tcholas
Posts: 21
Joined: Dec 29th, 2013, 2:55 pm

Re: PS2 Controller + Arduino Control System

Post by tcholas »

njs552 wrote:Hello!

Here is my prototype control system hardware design:

Surface Control:
-PS2 Controller
-Arduino Uno
-MAX488E - convert arduino serial(rs-232) to long distance serial(rs-422/485)

Tether:
300ft Cat5e Stranded -Do you tried to use cat6e? Do you know if can cause some problem?[/size]
300ft 12 or 14 AWG speaker wire

In the ROV Pressure Vessel:
-Arduino Pro Mini
-MAX488E
-3x Hobbyking 30A car ESC

-2x DC to DC power converters - What was the input/output voltages and the current? It is necessary one for each motor? Does it has the same effect as the motor driver, like this http://www.aliexpress.com/snapshot/6025021203.html

-1x Dual SSR Relay - What was the input/output voltages and the current you used? It was necessary for what? This should be enough? http://www.aliexpress.com/item/FOTEK-SS ... 38321.html

-NTSC Camera with Pan/Tilt

What do you guys think? Are there things I should change/add?

Thanks!
Post Reply