TLDR : Using an Arduino for the first time in order to replace an old joystick with an Xbox one controller, using Arduino and RS 485 communication protocol, need some advices from experienced Arduino users.
For context, I'm an engineer using an Arduino for the first time in a professional project. I know how to code but I don't have much experience in electronics, a little help from experienced Arduino user would be wonderful
I would like to replace an old joystick used for our robots with an Xbox One controller by using an Arduino and the RS 485 communication protocol (by looking at the electric scheme of the joystick, I found that they use this protocol).
Here is how I see this project :
Step 1 : Observing the output waveform of the joystick using an oscillator to set a datasheet of correlations between the inputs of the user and the output of the joystick. If i'm not mistaking, I sould observe a waveform like this one for each input possible :
By the end of this step, I should have something like this :
Joystick to the left = 0011 0011
Joystick to the right = 0011 1100
etc
Step 2 : Using an Arduino Uno with an USB Host Shield + the controller library in order to use the Xbox controller as an input for my programm
Step 3 : Using an RS 485 shield as output for my programm. By combining Step 1 and Step 2, I sould be able to recreate the same output as the old joystick, such as :
Xbox controller left stick to the left = 0011 0011
By connecting the output of the RS 485 shield to my robot, the robot should work perfectly fine since its input hasn't changed.
What do you guys think ? Am I missing some important steps in the process ?
If not, would anyone explain me how to give this waveform as output for the RS 485 shield ? I tried to find a similar topic but couldn't find anything
I hope that this post was clear, I tried to do my best
Professional project and Xbox controller is quite a contradiction in my opinion.
You add a complexity to the project which is completely unnecessary. Use any digital joystick and wire the 4 axis directly to the Arduino. That way you eliminate the USB part.
That simply a serial transmission, one start bit, 8 data bits and a stop bit. Seems that 0x33 means left, 0x3C means right.
The waveform you have captured looks like a standard UART data frame with 1 start bit, 8 data bits and 1 stop bit. Do you have any timing information for the waveform. That way we can work out a baud rate.
Professional project and Xbox controller is quite a contradiction in my opinion.
Not really, it wasn't very clear in my first post but the old divice isn't just a joystick, it also has buttons, potentiometer etc... It's really complex for no reason, it's heavy and uneasy to use. Where as an Xbox controller would be far more adapted to pilot the robot (and it has been asked by our techniciens for years)
That simply a serial transmission, one start bit, 8 data bits and a stop bit. Seems that 0x33 means left, 0x3C means right.
Oh ok, but in the RS 485's documentation, I only see transmission of string like :
Yes, ditch the XBox controller and use a simple 4 way switch joystick. Hobby Components here in the UK have this for about 10 GBP.:
Yes sorry, my first post wasn't clear but the old controller is not just a joystick. A single 4 way joystick would not be enough
Not already, but I will be able to determine it after the first step (at least I hope so). But for what I understand about the documentation of the library of the RS 485 shield, it seams to be quite easy to change the baud rate, as you only need to write :
RS485.begin(9600) (9600 is the baud rate in this example)