RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Analog Joystick on RetroPie Using an I2C Module (Guide)

    Scheduled Pinned Locked Moved Help and Support
    othermodpspijoystickanaloganalog joystick
    11 Posts 4 Posters 5.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jthunt13
      last edited by

      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 error

      My 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

      adamspcA 2 Replies Last reply Reply Quote 0
      • adamspcA
        adamspc @jthunt13
        last edited by

        @jthunt13

        Did you add the overlays to the overlays folder on the SD card, and the overlay to config.txt?

        https://www.othermod.com

        1 Reply Last reply Reply Quote 0
        • adamspcA
          adamspc @jthunt13
          last edited by adamspc

          @jthunt13
          Also, if you did do that already, what GPIO pins are you soldering the I2C pins to?

          https://www.othermod.com

          1 Reply Last reply Reply Quote 0
          • J
            jthunt13
            last edited by

            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.

            adamspcA 1 Reply Last reply Reply Quote 0
            • adamspcA
              adamspc @jthunt13
              last edited by adamspc

              @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.

              https://www.othermod.com

              1 Reply Last reply Reply Quote 0
              • J
                JediDork
                last edited by

                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

                adamspcA 1 Reply Last reply Reply Quote 0
                • adamspcA
                  adamspc @JediDork
                  last edited by

                  @jedidork

                  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.

                  https://www.othermod.com

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    JediDork @adamspc
                    last edited by JediDork

                    @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

                    1 Reply Last reply Reply Quote 0
                    • F
                      FirestormTimob
                      last edited by

                      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.

                      adamspcA 1 Reply Last reply Reply Quote 0
                      • adamspcA
                        adamspc @FirestormTimob
                        last edited by

                        @FirestormTimob

                        https://www.othermod.com

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        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.