Using an Arduino you can read the values of a joystick.
I want to use a gyroscope mpu in my Xbox one controller since i already have them, i saw a hack for for xbox 360 controller however i can't figure out how to do it with the new version or other gamepads.
Is it possible to connect arduino pins to a joystick already soldered in a gamepad and write/send values into its board?
Even better if it could still be possible to use the joystick still as a normal input.
Do you mean if someone were to remove the Arduino, or that both the Arduino and the original joystick should function at the same time, in which case I ask who wins when they disagree?
Leaving that aside for now, it is possible perhaps likely that the joysticks are configured as voltage dividers and read by the board electronics using analog to digital conversion.
Adding a real digital to analog converter to the Arduino should therefore make it possible to open the connection to the joypot wiper, and inject the Arduino converted voltage at that point.
You can get adequate a/d chips or those chips on inexpensive modules. I wouldn't use Arduino ersatz PWM analog output.
I have done this with cheap r/c controllers. Key will be probing to find the minimum and maximum voltage as the joystick travels to its extremes. It mightn't be 0 and the board Vcc, probably close and certainly within.
Once you are sure that's what's going on in there.
Nintendo is super easy if you don't mind using Nintendo instead of Xbox. Works for (at least what I have used) NES, SNES, N64 controllers.
Libraries are on Github
I actually found a pwm that forgot i had and was thinking:
If I use the green cable wiring schematic "data/clock" only from the pwm to the gamepad corresponding potentiometer pin, i could use then a analogWrite() right?
(I assume i wouldn't need to use the ground and vcc)
The reason of that, is because I already burned one Xbox controller doing some wiring and by accident due to lack of isolation and being the first time i've done it and turn it on to see feedbacks, end up being a scrap salvage at the very least
Please look into how analogWrite() works. It does not produce a DC voltage between 0 and Vcc all by itself, it is just a PWM signal whose duty cycle is proportional to the value you write.
This is unlikely to be directly usable as a voltage delivered to a microprocessor or analaog to digital converter by a potentiometer.
Additional circuitry will be needed, that will be analog circuitry and might be simple and might work but would be a certain kind of fun.
A different kind of fun would be to use a real digital to analog converter, which will output a DC level. You still may find that some additional circuitry is needed, but you'd start from being way closer to succeeding.
Given your follow-up posts, it isn't entirely clear exactly what you are attempting. My interpretation of your top post is that you essentially want to inject control signals into an existing controller, said signals being calculated by the Arduino board which has for inputs a potentiometer style joystick.
This
If I use the green cable wiring schematic "data/clock…
is just wrong. @hallowed31 has suggested using the digital connection scheme. There is no point to using one of the two digital signals going into the Xbox, or whatever system , data and clock, as an analog input.
All the analog stuff is very much done with by the time the cable connects to the Xbox.