3

My high school is entering an ROV competition and for next year's competition we want to try and set it up so that we can control it using a PS4 controller. I have done research and found this shield for Arduino and this library that allows you to connect it to an Arduino. I plan to then connect the Arduino to a computer via USB and then send each button press to a Processing program via serial. Would it then be possible to send this from Processing to another Arduino out of the laptop? I'm just wondering how feasible this project is.

We initially had just a single Arduino at the top with the Ethernet shield and took inputs from standard joystick potentiometers. We want to add in using the PS4 controller this year for easier control. We found the USB Host Shield that gives us that capability, but uses the same pins as the Ethernet shield. So we added another Arduino, connecting the laptop as the bridge also allows to have a GUI. The Ethernet is wired, by the way. We need the laptop, it's not just for a bridge.

2

this is possible, but the processig bridge can add a lot of delay if not correctly handled, also wifi has a low range, almost 100m by default hardware.

zigbee module has better range (xbee pro are up to 1km) and are microcontroller friendly, you use the as you are using a serial, they will hide their complexity once you set them up, and this can be done by PC.

That mens less code, that mena less error and more ram/flash/cpu so you can do a smarter robot :)

zigbee use the serial protocol to communicate, exactly as you do with the pc. Also arduino can use, with the library SoftSerial, any pin as Serial. So you can keep the HardwareSerial to communicate with pc, and any 2 free pin to communicate with the xbee. So you can use the arduino stand alone, only with the controller, and when needed connect the pc. Then arduino can act as a bridge between xbee and pc, so pc can excange data with the rover. But even without pc your project will be fun. The same apply for bluetoot or 400/800mhz rxtx module, but not for wifi shield

  • One Arduino needs to talk to the computer and the other at the same time. That's not practical with the way it's set up on most boards. The OP would need another UART connection, even so the Xbee and the USB to UART chip use the same pins on all standard boards. – Anonymous Penguin Apr 8 '14 at 1:01
  • As far as i understand the op use the pc as bridge, so if arduino is indipendant, pc is not needed animore. Also the controller will be more portable – Lesto Apr 8 '14 at 7:15
  • We initially had just a single Arduino at the top with the Ethernet shield and took inputs from standard joystick potentiometers. We want to add in using the PS4 controller this year for easier control. We found the USB Host Shield that gives us that capability, but uses the same pins as the Ethernet shield. So we added another Arduino, connecting the laptop as the bridge also allows to have a GUI. The Ethernet is wired, by the way – kkrenzke Apr 9 '14 at 21:35
  • 1
    Xbee uses serial pin, and using the official SoftSerial lib you can use any pin as serial rx/tx. No double arduino, no pc, but hooking up a pc, and using arduino as a bridge between pc and xbee, is a way better. – Lesto Apr 9 '14 at 22:27
  • The Xbee still isn't ideal. Yes, with software serial you can use two different serial ports, but most Xbee shields are hard wired for the two pins used by USB, causing a conflict. Also, SoftSerial isn't ideal or simultaneous: the OP should use AltSoftSerial. Hmmm... I guess you could hard wire it to the board and use AltSoftSerial. Can you please edit your answer? – Anonymous Penguin Apr 9 '14 at 23:46
1

This project is very simple. As I understand it, this is your setup:

+–––––––––––––––––––––––––––––––––––––––––+             
|                                         |             
|  Arduino 1-––––––––––-PS4 Controller    |             
|  |                 (W. Shield attached) |             
|  |USB                                   |             
|  |                                      |             
|  Computer                               |             
|  |                                      |             
|  |[Wireless]                            |             
|  |                                      |             
|  Arduino 2                              |             
|                                         |             
+–––––––––––––––––––––––––––––––––––––––––+             

Made with ASCIIFlow

If you have a very small range (I'd say 10-20 feet max), I recommend using Bluetooth. The HC 06 Bluetooth module looks like a good choice. There's also a less powerful HC05 if I remember correctly. I had one once but accidentally destroyed it before I could connect with a bad soldering job :). The one linked on Amazon luckily comes with a "backplane" already soldered so you just need to attach 5V, GND, and the TX/RX pins to the Arduino, accordingly. Then, you can select the BT module (wherever it appears on your OS; search online for this) and then you can connect to it and add the password 1234. After that, it should function like a normal COM port.

You would connect this to the HC06 to Arduino 2, and wirelessly the HC06 to the computer. The computer would then be connected to Arduino 1, who would receive the PS4 signals, with the shield. You would use Processing to receive the PS4 signals and to send data to the second Arduino board. I'm not an expert on Processing, but I found this serial library.

I do not recommend using Xbee because one Arduino needs to talk to the computer and the other at the same time. That's not practical with the way it's set up on most boards. The OP would need another UART connection, even so the Xbee and the USB to UART chip use the same pins on all standard boards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.