RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Help needed for a Handheld Project

    Scheduled Pinned Locked Moved Projects and Themes
    controllerteensypcbbuttonswires
    18 Posts 2 Posters 6.2k 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.
    • JiehfengJ
      Jiehfeng
      last edited by Jiehfeng

      I'm stuck at setting a controller part. Not a USB gamepad but directly wiring buttons and analog sticks.
      Note I have no experience in electronics, only software, but willing to learn! ^_^

      What I bought:
      -2800mAH Battery with 5V output (2 USB Ports, 1 for display and pi, 1 for Teensy-LC)
      -Teensy-LC
      -Wii U Analog Sticks
      -Red, Black, White, Green and Yellow Wires
      -Momentary Push Button Switches
      -"PCB Universal Board"

      So basically I want to know how to use the PCB.
      I know how to solder, so how do I connect the buttons and other things to the PCB, and then the PCB to the raspberry pi 3? How does the PCB actually work?

      Then I want to know how to wire to the Teensy-LC and then to the Pi, I'll ask about software later.
      Also, I need to know how to solder buttons to the Pi.

      mooseprM 1 Reply Last reply Reply Quote 0
      • mooseprM
        moosepr @Jiehfeng
        last edited by moosepr

        @Jiehfeng the PCB you have got will let you make your own 'tracks' between components. You can either bridge the solder from one component to the other, or solder wires across.

        The teensy will actually connect to the pi via USB. The code you put on it basically converts it into a USB controller, and the pins become the input for the controller. I have never used one myself, but I'm sure there are plenty of guides online

        want to get a tft into your project, look no further than here https://retropie.org.uk/forum/topic/7464/ili9341-tft-screen-guide

        JiehfengJ 1 Reply Last reply Reply Quote 1
        • JiehfengJ
          Jiehfeng @moosepr
          last edited by

          @moosepr said in Help needed for a Handheld Project:

          @Jiehfeng the PCB you have got will let you make your own 'tracks' between components. You can either bridge the solder from one component to the other, or solder wires across.

          The teensy will actually connect to the pi via USB. The code you put on it basically converts it into a USB controller, and the pins become the input for the controller. I have never used one myself, but I'm sure there are plenty of guides online

          I'm sorry I don't completely understand the PCB part.
          Ah I see, as for guides, I did extensive google searching but found none. If there were a few, they were either vague or too complicated for me.

          mooseprM 1 Reply Last reply Reply Quote 0
          • mooseprM
            moosepr @Jiehfeng
            last edited by

            @Jiehfeng your teensy will have lots of pins, some can work in digital mode for detecting buttons, some can read the analog value from the joysticks. Just did a quick Google and found these

            https://www.pjrc.com/teensy/td_joystick.html
            https://learn.adafruit.com/usb-snes-gamepad/programming-the-teensy

            Not sure if these will help

            I found this for the PCB if you scroll down a bit the are some example pictures

            http://electronics.stackexchange.com/questions/55236/how-to-make-traces-on-an-universal-pcb

            want to get a tft into your project, look no further than here https://retropie.org.uk/forum/topic/7464/ili9341-tft-screen-guide

            JiehfengJ 1 Reply Last reply Reply Quote 1
            • JiehfengJ
              Jiehfeng @moosepr
              last edited by

              @moosepr My bad, I didn't know you were talking about programming it, but thank you for the tutorials, I'll be using those.

              So how do I connect w/e to the Pi? Let's say a button for example, it has 4 metal pins. If I'm correct, you push it down on 4 holes on the PCB anywhere, and solder the bottom of it. From there where do I connect it to the raspberry pi? The wires soldered again from the bottom?
              Are PCB's just basic boards you solder stuff onto or is there much more to it? I'm guessing all the holes aren't connected and separate like a breadboard? So it's basically a mounting board?

              mooseprM 1 Reply Last reply Reply Quote 0
              • mooseprM
                moosepr @Jiehfeng
                last edited by

                @Jiehfeng the board you have is just a mounting board in essence, but you can link bits together to make circuits. You can make custom boards that link things, but that is getting more complicated

                The buttons trend to have 4 pins, but normally they will be in pairs, so they will technically be linked together. You could test the behavior with a battery, led, and some wire to see which pins are linked all the time, and which link when you press the button

                You normally connect one side of all the buttons to ground and the other side to the I/O pins of the teensy. Your program on the teensy will allow you to set which pin triggers which output

                want to get a tft into your project, look no further than here https://retropie.org.uk/forum/topic/7464/ili9341-tft-screen-guide

                JiehfengJ 1 Reply Last reply Reply Quote 1
                • JiehfengJ
                  Jiehfeng @moosepr
                  last edited by

                  @moosepr Brilliant, thank you so much. So basically, in my handheld I'll be cutting squares from the PCB to mount buttons on them. Then connect all the ground pins with wires all going into one wire connected to the ground?
                  How do I connect the analog stick? In the OP I got a Wii U analog stick which already seems to have a PCB. It has 4 pins, I'm thinking it uses Red, Black, Yellow, and White wires, how do I connect those?

                  alt text

                  mooseprM 2 Replies Last reply Reply Quote 0
                  • mooseprM
                    moosepr @Jiehfeng
                    last edited by

                    @Jiehfeng your analog stick seems to have 5 pins. They normally work like variable resistors, which have 3 pins. One will be connected to +ve, one to -ve, and the this is connected somewhere in between. Your teensy will measure the voltage from the middle pin, which will change depending on it angle of the stick.

                    https://www.arduino.cc/en/Tutorial/AnalogInput

                    You will basically have 1 analog input for each stick direction.

                    want to get a tft into your project, look no further than here https://retropie.org.uk/forum/topic/7464/ili9341-tft-screen-guide

                    1 Reply Last reply Reply Quote 1
                    • mooseprM
                      moosepr @Jiehfeng
                      last edited by

                      @Jiehfeng

                      stix

                      want to get a tft into your project, look no further than here https://retropie.org.uk/forum/topic/7464/ili9341-tft-screen-guide

                      JiehfengJ 1 Reply Last reply Reply Quote 1
                      • JiehfengJ
                        Jiehfeng @moosepr
                        last edited by

                        @moosepr What is +ve or -ve? Or where is that?

                        alt text

                        So to put it in perspective, what colour wires do I wire exactly from the 5 pins to the Teensy LC? (kinda noob so don't understand yet)

                        JiehfengJ 1 Reply Last reply Reply Quote 0
                        • JiehfengJ
                          Jiehfeng @Jiehfeng
                          last edited by

                          @Jiehfeng That arduino tutorial has many different parts I don't have, so I don't really know how to understand it with my own parts.

                          mooseprM 1 Reply Last reply Reply Quote 0
                          • mooseprM
                            moosepr @Jiehfeng
                            last edited by

                            @Jiehfeng ah sorry, on the sticks, +ve is the pwr and -ve is the gnd. Connecting to the teensy you will want to connect the pwr pin on the stick to the 3.3v on the teensy, and gnd to gnd.

                            you will then want to connect the dir pins (dirH and dirV), into analog pins on the teensy (they are the a0-a9 pins). and for a final bonus, you could attach the click pin from the sticks into any of the digital pins (the grey ones on the diagram) you could always assign them to start/select so you dont need the extra buttons

                            your code on the teensy will then read the voltage from the analog pins, which will range from 0 to 3.3v over the range of movement of the stick

                            want to get a tft into your project, look no further than here https://retropie.org.uk/forum/topic/7464/ili9341-tft-screen-guide

                            JiehfengJ 1 Reply Last reply Reply Quote 1
                            • JiehfengJ
                              Jiehfeng @moosepr
                              last edited by Jiehfeng

                              @moosepr Thanks a bunch, that's 90% of the info I need to finish my project. The other 10% is the wires. I understand completely where the pins connect to the teensy, but what colour wires for what pins?

                              GND - Black
                              PWR - Red
                              Dir H - Yellow?
                              Dir V - Green?
                              Click - White?

                              Do buttons use red or white wire?

                              mooseprM 1 Reply Last reply Reply Quote 0
                              • mooseprM
                                moosepr @Jiehfeng
                                last edited by moosepr

                                @Jiehfeng technically speaking, the colour of the wires is irrelevant. as long as you know what colour does what, your golden. Most people do tend to stick with red for power, and black for ground, but nothing is set in stone

                                want to get a tft into your project, look no further than here https://retropie.org.uk/forum/topic/7464/ili9341-tft-screen-guide

                                1 Reply Last reply Reply Quote 1
                                • JiehfengJ
                                  Jiehfeng
                                  last edited by

                                  Hey, I just got the Teensy LC with a few momentary push button switches. I put a button onto the PCB and soldered it on, then put a red wire to the top left pin and the black wire to the bottom left pin (soldered), and connected the black to the GND on the Teensy and the red to the 0 digital pin.
                                  But for some reason my button isn't working? I tried the basic example and button example on teensyduino but the button won't respond.

                                  mooseprM 1 Reply Last reply Reply Quote 0
                                  • mooseprM
                                    moosepr @Jiehfeng
                                    last edited by

                                    @Jiehfeng do you have access to a multimeter?

                                    On the push buttons, there are normally 4 pins, but some are connected and some switch.

                                    linky

                                    If you look at the bottom right part of the image, the top 2 pins are always connected together, and the bottom pins are connected together, then all 4 are connected together when the button is pressed

                                    want to get a tft into your project, look no further than here https://retropie.org.uk/forum/topic/7464/ili9341-tft-screen-guide

                                    JiehfengJ 1 Reply Last reply Reply Quote 0
                                    • JiehfengJ
                                      Jiehfeng @moosepr
                                      last edited by

                                      @moosepr No sadly not.
                                      I'll try switching the wires up to every possible pin and see if it works. The switch is SPST btw.

                                      JiehfengJ 1 Reply Last reply Reply Quote 0
                                      • JiehfengJ
                                        Jiehfeng @Jiehfeng
                                        last edited by

                                        @Jiehfeng Just tried with another button, works fine. I guess that button was faulty. Thanks again. :)

                                        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.