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

    ADS1115 Analog Sticks with uinput

    Scheduled Pinned Locked Moved Help and Support
    helpads1115uinputcontrollersraspberry pi 3b
    17 Posts 2 Posters 1.7k 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.
    • O
      obmai89
      last edited by

      Hey guys, I have 2 analog sticks connected to a ads1115 which is connected to my rpi3. I got them working properly, did some adafruit example scripts and they seem to work just fine. But I cannot figure out what to do in order to get them working on retropie using uinput. I have my ads1115 connected to I2C1 (physical pins 3 and 5). Thanks in advance!

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        Are you emulating a full gamepad via uinput or just the sticks ? In order to be able to configure them in EmulationStation, you'll need a full gamepad.
        If they show up only as sticks, then you may be able to configure them in individual emulators (advmame, mame, etc.) - but you can do so from within the emulator itself, using the emulator's configuration menu.

        O 1 Reply Last reply Reply Quote 1
        • O
          obmai89 @mitu
          last edited by

          @mitu Hello, Sorry for the late answer I have not been home this day. I am trying to actually understand how to emulate a full gamepad, I have buttons and these analog sticks that I wanna make recognizable as a gamepad. I have no idea how to actually make them recognizable, though. I used GPIOnext in order to make my buttons recognizable as a actual gamepad, but the analog sticks I cannot figure out how to make usable. (cliche but excuse me for my english, currently pretty late.. I am serious about this and not just some random idiot not knowing what he's doing, I can follow any instructions I am given so yeah, please help if possible and thank you in advance :).)

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            My guess is that you need an single uinput script that processes the inputs from both the buttons and analog sticks and combines them into a single gamepad. GPIOnext translates GPIO inputs to keystrokes, so it doesn't handle the ads1115 analog inputs.
            You can find something similar here.

            O 1 Reply Last reply Reply Quote 1
            • O
              obmai89 @mitu
              last edited by

              @mitu thank you! I'll take a look later, I'm also certain changing up the script is possible so I can add another analog stick input

              O 1 Reply Last reply Reply Quote 0
              • O
                obmai89 @obmai89
                last edited by

                @obmai89 Do you think it is possible to use the pins 3 and 5 (I2C1) instead of having to reconnect them to the 2 middle pins? Is there any difference between I2C1 and I2C?

                mituM 1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator @obmai89
                  last edited by

                  @obmai89 said in ADS1115 Analog Sticks with uinput:

                  Do you think it is possible to use the pins 3 and 5 (I2C1) instead of having to reconnect them to the 2 middle pins?

                  No idea to be honest.

                  O 2 Replies Last reply Reply Quote 1
                  • O
                    obmai89 @mitu
                    last edited by

                    @mitu Alright, I'll just connect it to the middle i2c pins. Dude thank you so so so much for actually answering my post, this is what I was looking for and this is basically the last step to finishing my project. THANK YOU!

                    O 1 Reply Last reply Reply Quote 0
                    • O
                      obmai89 @mitu
                      last edited by

                      @mitu Hey again, I followed all instructions and ran the script. When running it I get the error: ModuleNotFoundError: No module named 'uinput'

                      This shouldn't happen, as I did pip3 install python-uinput just like the github page said.

                      mituM 1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator @obmai89
                        last edited by

                        @obmai89 said in ADS1115 Analog Sticks with uinput:

                        When running it I get the error: ModuleNotFoundError: No module named 'uinput'

                        Are you running the script with python3 <scriptname> ?

                        O 2 Replies Last reply Reply Quote 0
                        • O
                          obmai89 @obmai89
                          last edited by obmai89

                          I ran it on python3 i got the uinput error, then i ran it on python. The uinput error is now gone but I get this:
                          Traceback (most recent call last):
                          File "gpio_js_driver_super_game_pi.py", line 21, in <module>
                          adc = ADS1x15(i2c=ADS1115)
                          TypeError: 'module' object is not callable

                          1 Reply Last reply Reply Quote 0
                          • O
                            obmai89 @mitu
                            last edited by

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            • O
                              obmai89 @mitu
                              last edited by

                              @mitu Ah sorry mate, I am new to this forum and I keep on sending messages before finishing them up, hence the reason for the edit and the deleted message... I wanted to say now I got another module missing error on python3, I will fix it first then Ill come back if I hit a roadblock...

                              O 1 Reply Last reply Reply Quote 0
                              • O
                                obmai89 @obmai89
                                last edited by obmai89

                                @mitu Here I am again, after managing to remove all module not found errors (for now) I get this new one:

                                Traceback (most recent call last):
                                File "gpio_js_driver_super_game_pi.py", line 21, in <module>
                                adc = ADS1x15(ic=ADS1115)
                                TypeError: 'module' object is not callable

                                this is what I get after doing sudo python3 <script>.

                                edit: Apologies for the messy convo so far, as I said I am new to this forums and still getting the hang of it :). Hope I didn't give a bad impression.

                                mituM 1 Reply Last reply Reply Quote 0
                                • mituM
                                  mitu Global Moderator @obmai89
                                  last edited by

                                  @obmai89 Not sure where the error comes from - but didn't you already have code that was working already ? Replace the analog sticks handling in the sample script I linked with your code and re-use just the button part for emitting gamepad button events.

                                  O 1 Reply Last reply Reply Quote 0
                                  • O
                                    obmai89 @mitu
                                    last edited by

                                    @mitu Hey, I managed to fix it. I do get another issue now though,
                                    AttributeError: 'ADS1115' object has no attribute 'readADCSingleEnded'

                                    Got any ideas how to fix it?

                                    1 Reply Last reply Reply Quote 0
                                    • mituM
                                      mitu Global Moderator
                                      last edited by

                                      Sorry, no idea.

                                      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.