Это видео недоступно.
Сожалеем об этом.
Raspberry Pi Pico Keyboard and Gamepad HID with an NES Controller!
HTML-код
- Опубликовано: 17 авг 2024
- I thought it would be fun to showcase the HID abilities of the Raspberry Pi Pico. And what better way to do that than make a USB to NES adapter with one?
CircuitPython for Raspberry Pi Pico:
circuitpython....
CircuitPython Library collection:
circuitpython....
NES2USB Source Code:
github.com/pri...
Pick up your board here!
www.raspberryp...
Interested in Print N Play Merch? Check it out here!
www.redbubble....
-- Like what I'm doing here? Want early access to content, models, and more? Check me out on Patreon !
www.patreon.com/jcprintnplay
-- Follow me on the Intrawebs! --
Twitter - @jcprintnplay
Instagram - @jcprintnplay
Facebook - / jcprintnplay
Thingiverse - www.thingivers...
Reddit - / printnplayyt
Print n Play In Detail -
/ @printnplayindetail2415
Print n Play Shortz -
/ @printnplayshortz9489
Music from incompetech.co...
"Getting it Done" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
creativecommons...
"Newer Wave" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
creativecommons...
#RaspberryPi #Pico #CircuitPython
Yes!!! The keyboard mapping is **exactly** what I was hoping for!
Glad it was helpful!
Love this, building my own retropie handheld and the teensy lc is hard to find nowadays
HID option on the pico make it great. I wish the standard micropython had better support than the circuitpython version. I'm sure more support and libraries will come to the pico.
Absolutely. I'm sure it just a matter of time.
Actually really really cool! can't wait to see more
Such a great video James! I actually feel like I can do this now.
standby dopamine hit!
Awesome job thanks.
Thanks Susan!
've already installed CircuitPython on my Raspberry Pico. I'm encountering an error where Thonny can't find the digitalio module. It also happens with the board module. I've tried using Visual Studio Code (VSC) as well, but it didn't work either.
Helpme
when executing the code I get this error: ModuleNotFoundError: No module named 'digitalio'
Exactly what I was looking for. Thanks!
awesome guide helped me figure a few things out
MacGyver: Give me a N64 controller, Nes Controller, and a Raspberry Pico. lol
Fantastic :) can’t wait to give this a try :)
Nice project. I may try this myself. Also, bit off topic, a thought crossed my mind of would it be possible to enhance an actual NES console with a Raspberry Pi Pico though the expansion port for a plug and play upgrade? If so, maybe it could be used for homebrew developers to rid of problems like sprite flicker and slowdown on actual hardware. Mind you the games would have to have a patch library to take advantage of the enhancements. With the added horsepower, it may be possible to port Shovel Knight little to no compromise outside of widescreen support.
Cool implementation.
This has been a super frustrating experience for me. It seems that none of the later CircuitPython libraries contain the Gamepad class. I found some source code from an older library and added that into my adafruit_hid folder. That solved the compilation problem I was seeing in Repl. Okay, I thought, maybe I need to downgrade. I'm not bleeding edge, but I do have latest which is 7.x. Maybe they took the library out of 7 for whatever reason? Okay, so I downgrade to 6.3 which is the last version 6 that was released before 7 was released, so it should be latest and greatest with all bug fixes and everything for version 6. The UF2 installed just fine, but again, the Gamepad class is missing from the 6.x library files. I had to go pull them from the S3 bucket, since they aren't available on the download site any longer. Still the class is missing! I tried adding the class manually, and like before it compiled just fine, but my computer is not recognizing it as a gamepad. Is this a linux only HID device? I'm fairly certain that there are HID reports on Windows. When I plug in my joystick I see it as a game controller. I'm not seen the Pico as a game controller. I'm seeing it as a keyboard (and looking at the device list just about every HID device the pico supports), but no gamepad descriptor anywhere. I'm trying to use the Pico so I can use a game controller built for the Pi on my computer. I want to use it with MAME. It's just an old school joystick with microswitches, and a bunch of arcade buttons. It's the Pimoroni Arcade box if you are familiar with it. I can make this work in 2 seconds with my Teensy, but I'm stubborn and I want to make use of these new fangled RP2040s ;). I have a Pico, an Adafruit Feather (which is essentially a Pico), and a Nano. I struggled with Platform IO to get the HID drivers to work correctly, and I found some promising stuff in Python, but alas, no luck for me yet. I'm half tempted to just wire up my Teensy and be done with it, but I see videos like this and other people have shown similar results, so I know it's possible.
Haha, right after I wrote that wall of text, I deleted the old USB record, unplugged, and plugged the device back in and it worked. I was reading somewhere that sometimes on Windows the old record can be sticky, so you sometimes have to just delete the entire device and re-install it. That worked for me. I am now seeing a gamepad.
Haha glad you made progress! If you are interested, here is a usb game pad built with a Pico on the latest version of circuit python. ruclips.net/video/__QZQEOG6tA/видео.html
excuse me how to fix missing gamepad library problem?
Found out last week I get to wait another month or more for my Pico board! Ohh well. Keep the printers melting!
Aww man, that sucks! Well, you will have a long list of things to do with it by the time you get it!
I feel your pain. I finally got mine a couple of days ago after ordering it in February
Wishing I still had some of my old controllers... but I wonder if I should consider a custom keyboard?
I have parts on order to do just that!
Hi, love your videos mate! I'm not sure if this is a silly request but i'd love to see a video on using an sd card with the pico. I'm currently building a self watering garden and want to create csv files for making graphs but cannot find anything online!
It's on my list! Just waiting for some SD card adapters to arrive!
@@PrintNPlay legend
As promised!
ruclips.net/video/yN1M8ZCN3x8/видео.html
Nice video, but is it possible to have a gamepad and keyboard at the same time?
How about doing same for using a USB mouse with an Atari ST or Commodore Amiga? MANY people would love a cheap alt to those crazy overpriced adapters ($20-30) that ONLY work on USB mice that use the PS2 protocol over USB....
Amazing job. Keep up the good work. I am working on a project and need your expert opinion on that. I am trying to use pico/raspberry pi zero (w) with a barcode scanner to build a stand-only system that can be linked with the app using a smartphone. I am not sure whether I can use raspberry pi pico for that or not? Can you please share your thoughts on that.
As it stands, the pico lacks wireless or Bluetooth connectivity. You would have to buy one of the upcoming boards that offers more wireless communication, or code to connect to a separate wifi or Bluetooth adapter. The zero w would offer the functionality out of the box.
What types of barcodes do you want to scan?
@@PrintNPlay I am planning to scan barcodes of retail items in my store. My plan is to use raspberry pi zero with a basic barcode reader and register the transactions on the web/mobile phone.
You can get an OTG adapter and use a generic USB 2D barcode scanner to read barcode ascii as a keyboard on most phones (Android at least)
Exactly what I was thinking. Could probably also use the camera on the phone to capture the barcode.
New Sub!! Dryden, MI
Excellent Job! I was looking into this yesterday & now this popped up as a Suggestion... Creepy
In the Early 2000s, I figured out with some Help Online how to Wire OEM controllers to the Parallel Port on a Win 9x Machine. In Particular up to 5 NES controllers: Using a DirectX 5 Driver.
Would this work on a Nintendo Switch?
how much of this information is applicable to an atari controller and can i use a normal raspberry pi to do that?
It's somewhat transferable. Atari controllers just have all their buttons as contacts in the connector, so you'd have to connect those individually and check them individually. There are libraries that work on the Raspberry Pi to allow you to use the GPIO as a gamepad.
@@PrintNPlay i see, thank you.
What would be the easiest way to connect the nes controller wires to a pico on a breadboard? I don't have a soldering kit so I can't solder it. Could I strip the wires and then plug it in to a breadboard directly?
I think the connections would be a little spotty in this case, but it might work. If you have some male jumper cables, you could cut them, and then twist them together with the wires from the NES controller connector, then wrap them in tape. If you have female jumper cables, you could do the same thing but connect them directly to the Pi. Let me know if any of those work for you
hello. can this be done with raspberry pi pico?
sorry... i mean using two atari joysticks...
You could definitely build an Atari to usb adapter. Atari controllers are actually more simplistic. They're essentially 5 buttons, 1 for each direction, and one for the button. So you would connect each to a GPIO pin on the Pico, as well as ground. Then you can just check the Pi s to see if the button is pressed.
Is there any benefit / disadvantage to use a pico over an arduino for this type of implementation - in particular in regards to latency, presenting multiple gamepads, and other devices like arcade spinners etc?
If we get down to the technicalities, the polling speed in circuit python for the Pico isn't as fast as other languages. I'd have to double check the numbers, but we could be talking with a 1 - 2ms versus, say, an Arduino micro implementation.
In execution, it seemed to be as responsive as any of the other usb devices I've used over the years. Multiple devices shouldn't cause any issues, the USB bus would be the limiting factor at that point and I don't think the Pico is giving it an amount of overhead that would cause issues.
All of this is, of course, to the best of my knowledge :)
I think the pico is over kill, a stm32 bluepill and arduino nano can do the same thing.
Is it possible to connect multiple gamepads (at least 2) with 1 Raspberry Pi Pico?
I haven't tested it myself yet, but you can, in theory, create multiple usb game pad devices on one Pico. In a similar way to it being a keyboard, mouse, and game pad. It's a little more involved than that but I can try to put together a quick tutorial if you like
Thats would be great! My idea is make a NES controller hub for PC with two ports at least.
That's something that's been in my list for a while! I am hoping to do with connection for NES and SNES, since the communication methods for the two controller types are essentially identical. I'm a little swamped at the moment, but I'll try and get it done asap.
hey can i use respberry pi pico as a usb to ttl converter for upgrade other device firmware
First off, AWESOME video my dude!
I want to make a portable retropie handheld and I wanted to use this pico to be its buttons. How can I hook this up to a pi 4 use the pico as the butttons and joysticks. Could you tell me how?
It will work with retropie as is, just shows up as a game pad
Forgive my ignorance, but is the pico connected to the raspberry pi/computer/etc via usb?
Yes it is
@@PrintNPlay thanks!
Hi, got a little problem. I tried and did the same moves as you and it turned out that... my raspberry pi couldn't find adafruit_hid.gamepad. Can someone help me please ?
thanks for your answer... would the code be the same as the one used in this tutorial?
The code would be a fair bit different, since the input method between an Atari joystick and nes controller are different. I can build an example in my spare time if you wish
@@PrintNPlay I'd appreciate it a lot. I'm starting a basic Python course and I'm not ready to write the code yet.
Thanks!!
I will immediately buy a Raspi Pico to remember my childhood playing Atari. YES, I'm a "little" older than you... ;-)
@@gggg-bk7md haha! Perhaps not as much as you think! But I'd be glad to help you do that. Give me a little time to gather the parts I need.
@@PrintNPlay LOL... Thanks!!
All the time you need...
tried this with the SNES 2 player console port, matching the Clock, latch, 5v, Ground, and Data.. hoping they'd be enough alike....spoiler alert, it didnt work... the red light lit up tho... Also by the way, where would I start if i was trying to make this into a "dedicated adapter"?
I end here searching for a Snes software for the pico to use with Snes Controllers...... I cant find anything (only for arduino)
@@goyetus honestly it shouldn't be that difficult and that project might be easily translated to the Pico. I'm not very good with software I'm more of a hardware guy. I'm actually learning to breadboard some hardware out right now using the SNES.
would you like to adapt the code for snes and being for two controls ?
What is your favorite nes game?
I would say Mario 3... It's so solid!
hola... es posible utilizar 2 controles NES con esa Raspi Pico?? Excelente Video!!!
I am trying to do this with a Xbox duke controller. Im not sure how to wire the USB wires to the pico. The wires are similar to yours in the video but still unsure. I want to make it bluetooth. I already have the Bluetooth part working
So, if we're looking at the original Duke controller from the original Xbox, the controller is essentially a USB game pad, with the proprietary Xbox connector at the end.
Connecting it to the Pico in the same fashion as the NES controller isn't possible, as they communicate differently. The Pico is capable as acting as a USB host and talking to the controller, but I haven't played with that at all yet.
I guess the first step would be to convert the Xbox controller into a USB controller, then look at how the Pico can communicate with USB devices when acting as the host.
If I find anything that will help, I'll add another comment here.
Print n play
this is sicccccck! is it possible to do this with other console pads? ...up to ps2/n64?
I believe so. The actual communication between different controllers is different, but I believe it's possible for the Pico to talk to pretty much all of them. Some might need a low level converter to switch from 5v to 3.3v input/output. Other than that, it's just knowing how they various devices communicate.
@@PrintNPlay thank you so much, i love your vids... if I find code online somewhere I'll defo give it a go... i'm a novice
Cool concept or use nes controller with USB adapter to pc instead?
Can absolutely use a pre-built adapter. But this gives you control over how it works. You can add turbo, build in the ability to use macro keys, use keyboard emulation to allow you to use it in old computer emulators that used keyboard input instead of joystick. And it also demonstrates how NES / SNES controllers were able to accomplish inputs while using so few wires!
Plus, now if you want to build a Pico project and use an NES controller with it, now you know how to!
Awesome video but I have a question. Could I use 2 Picos for 2 controllers on the same PC for 2 player games??
Yes, but keyboards are not handled like that by the OS. Gamepad mode no problem no matter how many you connect. For keyboards the OS does not differentiate from which one the input came so you would have to do different mappings.
@@fgregerfeaxcwfeffece ah I gotcha! Thanks for the reply
can you do this with a ps/2 keyboard?
Should be possible, but I haven't tried yet.
the file is missing adafruit_hid.gamepad, pleas help
Snes controller?
hi... ill try your code.. line to line... but Thonny show this error warning.. "Traceback (ultima llamada reciente):
Archivo "", línea 5, en
ImportError: ningún módulo se llama 'adafruit_hid.gamepad'
Did you save the boot.py to the Pico and unplug it / plug it back in?
im using CircuitPython 6.2.0 and lib Bundle 6.x (Adafruit)
Oh, my bad, I thought you were replying to the other video!
It's possible that they dropped the game pad support files from the bundle. Let me check it out tomorrow and see if I can see where things went wrong!
@@PrintNPlay same problem. Gamepad is not found ...... im unable to fix it
I dont have a Controller any alternative pls?
Absolutely. Do you have any buttons and a breadboard?
@@PrintNPlay 2 buttons and a breadboard
So you can replace the code where I check the controller for button presses by just connecting your buttons up to pins on the gpio of the pico. You will probably want more than two buttons, though
@@PrintNPlay I did not get you can you send your email I will give my number there and you can message me for help
I'm afraid I can't do phone calls or text messaging for support.
USB adapter? But I thought this could emulate NES and play full resolution Doom. Unless... no, those other couple videos couldn't be fake? Huh? No!
i wonder how 2 player gamepad works
Amazing!11111
Kid n Play