Analog Joystick on RetroPie Using an I2C Module (Guide)
-
I can't seem to get the pi to define js0 in /dev/input/
When I run joystick.py, I'm receiving this error:
Traceback (most recent call last):
File "joystick.py", line 58, in <module>
an0 = int(open('/sys/class/hwmon/hwmon0/device/in4_input').read())
IOError: [Errno 121] Remote I/O errorMy first thought was I wired the ADS1015 incorrectly, but I'm able to pick up the signal when I run Adafruit's troubleshooting python script so I know it's connected properly.
Any thoughts?
Thanks, Jon
-
Did you add the overlays to the overlays folder on the SD card, and the overlay to config.txt?
-
@jthunt13
Also, if you did do that already, what GPIO pins are you soldering the I2C pins to? -
It was the I2C GPIO connections, I initially had them running to GPIO 2 (SDA) and GPIO 3 (SCL). I have since switched them to physical pins 27 and 28, respectively. Looks like I'm able to pickup on the joystick voltages now. Thanks for providing this write-up, saved me a lot of headache.
-
@jthunt13
No problem. This can be modified to use any of the I2C pins (I2C-0, I2C-1, or I2C-2), and each set of them is available in a couple locations. I went a little off the beaten path by using I2C-0 because it was needed for my project.Edit:
Also, I went with the overlays to reduce CPU usage substantially. There's a lot of room for improvement by using built-in joystick drivers, but that's over my head at the moment. -
Hi Adam,
Im having a very similar issue with Remote I/O Error. I can confirm that the I2c module is correctly wired as i can receive analog data readings from i2c-1 using Adafruits' python library (https://github.com/adafruit/Adafruit_Python_ADS1x15). I used i2c-1 to make sure i had it wired properly, then reinstalled Retropie, copied over files as indicated (config.txt + folders to /boot), switched the i2c pins back to i2c-0 and ran the instructions above but still getting the error. Not sure what im missing?? Do you think it could be the latest version of Retropie given this post is almost 6 months old?
Cheers Anthony -
Shouldn't be the updates causing it. I'm using the same method on 4.4 without issue. Most likely it's an issue with the connection to the I2C-0 bus, or the bus not being enabled,
It's time for me to update this anyway, so I'll go ahead and add I2C-1 compatibility over the next couple days.
-
@adamspc Thank you. I did manage to get it working in the end, but unfortunately i had to revert back to the baked-in ADS1115/ADS1015 overlays to get the inputs to read correctly. For anyone who is having the same issues its worth having a read of this article: http://www.jumpnowtek.com/rpi/Using-ads1115-ADCs-with-Raspberry-Pis.html
-
I found this rather confusing and hard to follow. Couldnt find boot/uinput directory for a start, lots of missing prerequisites not listed in steps. I would have preferred numbered step by step instruction that clearly state what each step is as I couldnt achieve anything. Mind you I also wanted to use GPIO pins for buttons and not spend another $20 on a multiplexer board. Any insight would be great to help me understand what needs to be done to set this up tho.
-
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.