DIY PC GAMEPAD WITH ARDUINO

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 101

  • @DavidBeukes
    @DavidBeukes 6 років тому +6

    First video of yours I've seen. I really appreciated the code-along-with-me explanation of what you were doing. Also, your explanation of bitwise operations and using a single integer to represent any combination of buttons was superb.

    • @engineerish
      @engineerish  6 років тому +1

      David Beukes thank you! Glad you liked it 🙌

  • @ABSP5766
    @ABSP5766 4 роки тому +4

    Finally an arduino project that is not only cool but also useful! !!! Thank you. I will definitely try this.

  • @stormix_co
    @stormix_co 6 років тому +12

    Great one day project! Will try it soon!

    • @vuk_ustipak
      @vuk_ustipak 3 роки тому +1

      How did it go?

    • @stormix_co
      @stormix_co 3 роки тому

      @@vuk_ustipak pretty well actually

  • @Portaboy-lc7ni
    @Portaboy-lc7ni 5 років тому +1

    i wired the buttons and joystick to the correct pins, used the right capacators for other stuff on the board but all i get in the serial monitor is an infinate stream of backwards question marks from the arduino. i have checked and double checked, there are no coding/spelling/wiring problems, please help

    • @engineerish
      @engineerish  5 років тому

      Portaboy7921 hade you set the baud rate to 115200 in the serial monitor?

  • @tekanova7480
    @tekanova7480 Рік тому

    Once uploaded to board, will the joystick show up on the the windows USB controllers calibration window.
    win11 H

  • @androPoint
    @androPoint 9 місяців тому

    Aaaal fiiiin encuentro un video con todo lo necesario para usar el joystick shield como Gamepad!!!! Me he roto la cabeza tratando de lograr usarlo como un periférico pero no encontraba la manera y nunca se me ocurrió hacer un programa en Python (no se usarlo la verdad😅😅😅😅) you are brilliant!!!

    • @androPoint
      @androPoint 9 місяців тому

      Hi i'm tried the coding of arduino and worked just fine but the code of python it won't work. It release the mesage:
      Exception has occurred: ModuleNotFoundError
      No module named 'imp'
      File "\Funduino-JoyStick\Funduino-JoyStick.py", line 1, in
      import serial
      ModuleNotFoundError: No module named 'imp'
      i already instaled the serial and pyautogui libraries. i'm using the Visual Studio Code with the version 3.12 of python on windows 10. it's like it doesn't understand that it has to import the libraries and only read "imp" (that's what i understand of the error message).
      I have the program sublime text but i don know how to run it in tha program. if you can give me a hand to make it work i wil be really grateful. sorry for the writing i'm not use to write in english, hope its understand

  • @furank_i
    @furank_i 5 років тому +1

    wouldnt it have been easier to use the keyboard library and let the arduino work as a keyboard?

    • @engineerish
      @engineerish  5 років тому

      Franklin Rosales sure that’s another way of doing it - this gave me the ability to reprogram it in python rather than fiddling with arduino code

  • @ballamoto
    @ballamoto 3 роки тому

    Right, after many hours (damn Python 3 updates throwing the coding off!) I have got my joystick working - my only problem is that it I cannot hold down the joystick. It only registers each direction input once. The readout on the Serial port is fine, the numbers are staying high if the joystick is pressed. But the python code seems to only allow a single press. It looks like this happens in the video at 11:22. Can you help?

    • @ballamoto
      @ballamoto 3 роки тому +2

      Fixed, I just removed the line: "if key not in keysDown:". Otherwise once the key has been pressed and is added to KeysDown, the "pyautogui.keyDown(key)" will not run again, and the button will not be pressed again. I'll leave this here in case anyone has the same issue.

  • @loop5720
    @loop5720 5 років тому

    Can you make a project like this but make a case of it? Like put the Arduino inside a 3d printed case or make it out of a different material...

  • @seifmustafa2004
    @seifmustafa2004 5 років тому +2

    Great job, might this work if I connected my atemga 328 with an ft232rl as a usb adaptor(as the chip doesn't have a usb built-in)??

  • @MemeReacts12
    @MemeReacts12 8 місяців тому

    sir pls help me i have uploaded all your code and also it is not showing any error but i cannot use my funduino joystick shield, pls help

  • @IcanCwhatUsay
    @IcanCwhatUsay 4 роки тому +2

    for the first line I'm getting this error:
    arduino = serial.Serial('/dev/cu.usbmodem1461', 115200, timeout=.1)
    AttributeError: module 'serial' has no attribute 'Serial'
    Any idea why?
    For those looking for the answer to this question, the solution was to change the line from the above to the following:
    arduino = serial.Serial(port = 'COM3', baudrate = 115200, timeout = 0.1)

    • @matiassilvera7011
      @matiassilvera7011 2 роки тому

      Hi, how did you find the answer? it doesnt work for me

    • @IcanCwhatUsay
      @IcanCwhatUsay 2 роки тому

      @@matiassilvera7011 I don’t recall. Probably brute force plug and chug. Sorry.

    • @chandanianjalika6798
      @chandanianjalika6798 Рік тому

      @@matiassilvera7011 check your port name

  • @BroChris225
    @BroChris225 6 років тому +1

    My son really wants to start doing exactly this kind of thing. He's been getting into python, but we've never done anything with an Arduino. If we were to try to follow along with this video, could you give me links to things I would need to have?

    • @engineerish
      @engineerish  6 років тому +1

      Chris Huff Awesome! Sure thing - if you already have python up and running, what you’ll need to do is to download the Arduino IDE from their website www.arduino.cc . Get an Arduino Uno microcontroller and the joystick shield (perhaps you have an electronics store around your area that sells them both). That’s it! If you’d like to see the source code I wrote, both the arduino and python code is available on github github.com/mattiasjahnke/arduino-projects/tree/master/arduino-pc-joystick

    • @BroChris225
      @BroChris225 6 років тому +1

      @@engineerish Thanks!

  • @GamerKnight19
    @GamerKnight19 3 роки тому

    Would pressing B+F be the same as C+E since they both equal 6??

  • @beelz1042
    @beelz1042 4 роки тому

    Are there like different types of arduinos ? Cause I never used one before and I want to try it , but idk what I need , should I like just look for an arduino ? Or is there a specific type that I need for this. And also , how to setup the buttons and joysticks and stuff on the arduino ?

    • @engineerish
      @engineerish  4 роки тому

      Yeah there are different kinds of Arduinos. This particular one is called ”Arduino UNO”, a very common type. The buttons/joystick are attached to a module called a ”shield” (which you buy fully assembled, all u need to do is to stick it on top of the UNO)

  • @maxsandoval4246
    @maxsandoval4246 3 роки тому

    Great VIdeo
    Is there a Way to use it connecting a HC-05 or something like that?
    Thank you

  • @bartyhall7878
    @bartyhall7878 4 роки тому

    So I uploaded the Arduino code onto my board but I do not understand how to put the python on. When I copied the code you wrote onto python, it said that there were a ton of errors. Can someone explain

  • @sudhaj3762
    @sudhaj3762 6 років тому +1

    bro i didn't understand about changing the port name

  • @theninjaitsu
    @theninjaitsu 5 років тому +1

    Awesome video and really helpful! But could you explain what you did in 8:38 - 8:50?

    • @engineerish
      @engineerish  5 років тому +4

      Ninjaitsu thanks! What I’m doing there is parsing the data coming off the serial. I’m starting to look for an S, so that a I know I’m in the beginning of a message. Then I read another string until I find a comma and make that in to an integer - that will be my dx. Then the same thing for dy. Did that explain it?

  • @terrylarry5658
    @terrylarry5658 2 роки тому +1

    Im working with python 3.9.13, not sure which version of your python and serial is working on but
    i kept getting the error "ValueError: invalid literal for int() with base 10"
    after some research i figure out they might have change the output value to binary instead of just string, which may explains the reason why its impossible to convert to int or float
    Since the video had been made a long time now I don't think you would be replying to my comment anytime soon, however this is just to warn any python3.9 or future watcher about this issue. Unfortunately I still wasnt able to find the solution to this yet. I will be appreciated if anyone can give any possible solution to this one, thank you

    • @terrylarry5658
      @terrylarry5658 2 роки тому +1

      Update(solved) : just add a b behind the ',' , it works like a charmed
      The value is red as binary, so it must be read in b form

  • @embaracuya
    @embaracuya 5 років тому

    Can you explain what steps you do before the import serial to be able to work your Arduino on Sublime Text? Im trying to copy what you are doing but I cant import the Arduino environment into Sublime Text.

    • @engineerish
      @engineerish  5 років тому

      Nicolas Franco In sublime I’m programming a python script. The python script ”talks” to the Arduino by connecting to the serial port (on which Arduino is connected and will write). So there’s nothing Arduino going on within sublime text, pure python

  • @princechannel2154
    @princechannel2154 5 років тому +1

    When i reached the analog reading its appeared wasn't declared
    If i ears it it will work
    Can u help me

    • @engineerish
      @engineerish  5 років тому

      PRINCEof ARAB hi, what’s not declared? arduino.read()?

    • @princechannel2154
      @princechannel2154 5 років тому

      @@engineerish yes when I reached. The x analogReading (x_pin)
      Error wasn't declared
      I'm using arduino the latest
      It might be the program it self
      But. The port and everything is ok
      If i erase the x analogReading it will work

    • @princechannel2154
      @princechannel2154 5 років тому

      Can i ask if u put ur own sketches so. I. Will just copy paste Hehehehe
      I will appreciate that from u
      That will help me to much
      Coz i spent 20 hours just to figure it out then i gave up
      I became a zombie now

    • @engineerish
      @engineerish  5 років тому

      PRINCEof ARAB don’t quite understand what’s not declared.. the function call or the variable? Source code is available (I guess that’s what you’re referring to) so copy and paste all you want ;)

    • @princechannel2154
      @princechannel2154 5 років тому

      Please sir you gave the code source
      But not your own code

  • @Fabiuja
    @Fabiuja 5 років тому +1

    Is there a way to use it with smartphones?

    • @beelz1042
      @beelz1042 4 роки тому

      I don't think so , cause the pyautogui library doesn't work for mobile

  • @jns1807
    @jns1807 5 років тому

    python code not working at me. no errors, but simply not working. please answer quick, need this for my informatics project in school. (sry for bad english im from Germany)

    • @engineerish
      @engineerish  5 років тому

      Johannes Krempels most likely it’s the port name that needs to be changed

    • @jns1807
      @jns1807 5 років тому

      I changed the Port already, still doesnt work

    • @engineerish
      @engineerish  5 років тому

      So try figuring out where the problem is; if you print to the console (in the python script) do you receive data from the arduino? If you run the serial monitor in the arduino ide, do you see any output?

    • @jns1807
      @jns1807 5 років тому

      engineerish in the arduino ide the serial Monitor Works Great, but in the Python console i dont see anything.

    • @engineerish
      @engineerish  5 років тому

      Ok, so it sounds like the python code can’t connect to the serial port. 1) make sure again you have the right port name. 2) make sure you are not running the serial monitor at the same time (because then the port will be busy) 3) try getting a simpler example to work (follow a tutorial or something and get a proof of concept up and running) and see if there’s any learnings you can draw from that. Given that so many people run in to this problem, I should probably add some error handling and troubleshooting to the script

  • @curlybighead1111
    @curlybighead1111 5 років тому

    Hey I tried to get it to work, but my macbook isn't picking up on the inputs from the joystick shield. I copied the code from the link to the source code

    • @curlybighead1111
      @curlybighead1111 5 років тому

      Sorry it does recognise there are inputs on the arduino side of things, but nothing happens when I try to use it when I run the python script

    • @engineerish
      @engineerish  5 років тому

      @@curlybighead1111 On the line with '/dev/cu.usbmodem1461' - make sure that that serial port corresponds with your Arduino. You can see what yours is called by going in to the Arduino IDE -> Tools -> Port

    • @curlybighead1111
      @curlybighead1111 5 років тому

      @@engineerish I checked that and the port I have put down is the one I am using. What else could it be?

    • @engineerish
      @engineerish  5 років тому +1

      curlybighead do you see data in the serial monitor in the arduino ide? Close down the serial monitor (since otherwize it will be hogging the serial port) and run the python script - try to just dump the data from the stream to the console in python - it should be the exact same thing as the serial monitor in the IDE

  • @arjaya.escarieses3366
    @arjaya.escarieses3366 4 роки тому

    Can you teach me how to connect it to the games?

    • @jasoncharleshale
      @jasoncharleshale 3 роки тому

      I'm wondering the same thing, I'm thinking of running the python script when launching EmulationStation to map the buttons to the keyboard then use those in the RetroPi controller configuration

  • @rajvirkaur1457
    @rajvirkaur1457 4 роки тому

    can I play modren combat 5 with it

  • @yang.chengze2008
    @yang.chengze2008 4 роки тому

    Will windows 10 wordk as well?

    • @engineerish
      @engineerish  4 роки тому

      Should work, haven’t tried it. You’ll need to modify some of the code ofc

    • @yang.chengze2008
      @yang.chengze2008 4 роки тому

      @@engineerish thanks!

  • @IcanCwhatUsay
    @IcanCwhatUsay 4 роки тому +1

    7:11 - Could you explain or translate that please? or at least direct me to what to google so I can find out what that means?

    • @engineerish
      @engineerish  4 роки тому +1

      Absolutely - I suggest you google "bitwize operations" (and the "

  • @mbcraftnl2557
    @mbcraftnl2557 6 років тому

    i have trouble with the part with getting the button states it gives me a error

    • @engineerish
      @engineerish  6 років тому

      MBCraftnl what’s the error?

  • @IcanCwhatUsay
    @IcanCwhatUsay 4 роки тому

    What does the [:-1] and [:-2] do?

    • @engineerish
      @engineerish  4 роки тому +1

      The remove the last ([:-1]) and the two last ([:-2]) characters from a string in Python. stackoverflow.com/questions/15478127/remove-final-character-from-string

  • @Harsh-xo8gb
    @Harsh-xo8gb 6 років тому

    I don't know why but when I run the python script I don't get any results. I already uploaded the arduino code. Please reply fast. I think the python code is not working

    • @engineerish
      @engineerish  6 років тому

      Make sure the string on line "arduino = serial.Serial('/dev/cu.usbmodem1461', 115200, timeout=.1)" is the correct name for your Arduino serial

    • @Harsh-xo8gb
      @Harsh-xo8gb 6 років тому

      I checked it changed the port to COM9 as I am using windows

  • @mohamedaminesaidane7512
    @mohamedaminesaidane7512 Рік тому

    how can i run it on ubuntu ??

  • @danielezambelli9745
    @danielezambelli9745 2 роки тому

    Does it work even on Android?

  • @thorbjrnhellehaven5766
    @thorbjrnhellehaven5766 5 років тому

    If you have an arduino with AT16U2 for USB, I would rather make it act as a USB-keyboard/mouse/gamepad

    • @engineerish
      @engineerish  5 років тому +2

      Thorbjørn Hellehaven sure - that’s a way to do it. My way of looking at it is that this makes customization and mapping of keys a lot easier. Being able to quickly change a python script rather than having to reprogram the usb, upload c code and reprogram again. But either way would do it!

  • @borjaapaolazaemparanza6246
    @borjaapaolazaemparanza6246 5 років тому

    Congrats for your video, its really helpfull! I am thinking of applying this to control Recalbox on Raspberry Pi through bluetooth (HC05), but was unable to find the format I should be passing the data. Do you know if the bit operation you described would work?

    • @engineerish
      @engineerish  5 років тому

      Thanks! Cool! The format I used in this video was just a protocol I came up with during development - in order to get it to work with Recalbox, you'd probably have to adhere to their protocol. Good luck!

  • @sep9303
    @sep9303 5 років тому

    Bro, mine doesn't work. I took the code from the description. I am 12 years old.

    • @engineerish
      @engineerish  5 років тому

      MNSR 1234 going to need a little more describtion than that in order to help out ;)

    • @sep9303
      @sep9303 5 років тому

      @@engineerish please help

  • @rajvirkaur1457
    @rajvirkaur1457 4 роки тому

    and please also make a video on making ps 4 controller

  • @juancamilocarmonasanchez3286
    @juancamilocarmonasanchez3286 5 років тому

    Does it work with arduino leonardo?

    • @engineerish
      @engineerish  5 років тому

      juan camilo carmona sanchez I don’t know if this shield is compatible with the leonardo, check with your retailer

    • @Inanchi05
      @Inanchi05 4 роки тому

      Think so they are pretty simular

  • @themr_pop3494
    @themr_pop3494 6 років тому

    what program you are using to code in python ?

  • @danielibrahim5532
    @danielibrahim5532 5 років тому

    help me I want a copy of the code please

  • @bartyhall7878
    @bartyhall7878 4 роки тому

    and how do you find out the port name

    • @SmaRderk
      @SmaRderk 2 роки тому

      arduino tools bar port

  • @phuongpt1204
    @phuongpt1204 3 місяці тому

    Is that real

  • @mrfox3739
    @mrfox3739 4 роки тому

    Cannot get python to work ; (

  • @sudhaj3762
    @sudhaj3762 6 років тому

    will it work Just with joystick

    • @engineerish
      @engineerish  6 років тому +1

      Electro Hithesh yeah no problem! You can use the same code and just have a single joystick connected to the Arduino

    • @sudhaj3762
      @sudhaj3762 6 років тому

      engineerish does it run for gta sanandres

  • @ademcakmakkaya2481
    @ademcakmakkaya2481 4 роки тому

    hi Great one day project

  • @arjaya.escarieses3366
    @arjaya.escarieses3366 4 роки тому

    What materials did you use?

  • @PhotonicallyProjectedAtoms
    @PhotonicallyProjectedAtoms 3 роки тому

    Your not an actor this isnt a show just give us the info with out all the theatrics please for God's sake

  • @aleksajandric4487
    @aleksajandric4487 3 роки тому

    gy