yes, this is something I hope future Raspberry PI's will have a lot of people want this tutorial for the PI well you can use external ADC should probably make a video on that
@@NerdCaveYT you are absolutely right, there are actually ZERO tutorial on how to connect a 5pins 5.5v joystick on the rapsberry4b via a 1X115 ADC board and the code that goes with it. Had to find out myself. I also discovered that i2c BUS 1 didnt work properly on 4b with ADCs, it s preferable to use BUS 0, moist of the time, bus1 would simply never find the ADC (through i2dcDetect -y 1). Took me hours before trying bus 0 (on pins 27 28). And managed to get a joystick to controll the mouse. peace
instead of setting values what you did at 5:43 .. you can write something like this. . round((yValue / 65535)*100) ... round((xValue / 65535)*100) ... This can give you percentage for a little more close to understandable value.
@@gggg-bk7md that should be possible saw someone do it on Arduino and explain which each pin does and how to connect it, it will be easy to rewrite in CircuitPython then on the Pico
Awesome! Saw your post on reddit OP 😁 Question: What would happen if you put the joy stick in between 2 direction? Would it lit both LED or you need another line for that?
It will both be on since the two if statements would be true and thus both will be one if you want to put an extra LED between the two direction you can make another if statement that will trigger if both is true and then you make the other normal direction to be 0.
I would probably use an old arcade joystick module with some arcade buttons to give that authentic feel, this would actually be a nice project to do, but I would use CircuitPython since it allows the Pico to be used as an HID device. This is a good question I will make something next week
@@NerdCaveYT Thank you for the quick response! If it helps you any way. The idea behind it is due to me having a project to modify a keypad. Like in this video. ruclips.net/video/0aBWoCRPxiU/видео.html The use was as a smooth secondary joystick in a simulators for all kinds of things that need to turn (like, turrets, missiles, devices...) next to the airplane (controlled via a proper joystick) but also softer character controls (slow walking, walking, jogging, runnning,...) . Unfortunately I could not get the same hardware components as the man here. So I figured out that what he did was setting up a small "joystick" while ignoring the old lackluster hardware via some programmable USB board. Your tutorials so far are good. It showed me that my soldering was ok and the components work without an issue (cables are still movable from pin to pin). I will see where the journey with programmable devices will bring me. Maybe I will make my own HOTAS system or something fancy like this: store.azeron.eu/
well I would say for like old school arcade games it will work great but for fps shooters the values fluctuate a lot so will have to add filters to circuit and little bit better coding then it should work.
Hey boet. Nice video. I wanted to ask if you know of any HID library to get these to work as joysticks for a PC, kind of making your own controller thing.
Hello thank you, CircuitPython has a great HID library: docs.circuitpython.org/projects/hid/en/4.0.1/_modules/adafruit_hid/gamepad.html I used it for a Macro Keyboard and Midi before, I assume you will want the joystick to send certain values that part you might to code like something similar I did in my last value to see the value of the joystick position since those modules fluctuate a lot when they are connected to the ADC channel. If you need more help got a discord channel not much going on there now: discord.gg/A4zegrBp
You will need to use circuitpython HID library on my channel I did convert joystick to mouse, so instead of using mouse HID library you can use the keyboard, are you building a gamepad?
Hi, unfortunately don't think I can provide link because I bought it from a shop in China through a local e-commerce site Taobao. I live here in China, but you can find many of these on aliexpress or amazon. Search "Dual-axis XY Joystick Module KY-023" or just Arduino Dual-axis XY Joystick Module
u can use a pico as hid right? if so, then can you make the joystick control the mouse cursor? and even better, can you make it into an actual controller? like using the axis to as controller axis please make a tutorial on this, please
You can do this, it was something I was looking into doing. At this moment all my stuff is packed away and really hope in two weeks can move and start my videos again
@@NerdCaveYT If you have the time and managed to get some time, would you please do the tutorials? I want to create a controller with the raspberry Pi pico but don't know how to haha. Thanks for your videos!
@@hola_chelo I will was looking at making controllers and one for clone hero, I have few visa related documents but hope to have my apartment ready and everything sorted by the 7th things are a bit different where I am people not used to seeing a foreigner in my area.
@NerdCave that'd be awesome, no worries, there's no rush mate, hope all goes well for you. I just wanted to know if you were going to do it at all so I will turn on notifications! cheers!
Hi, if you just search KY-023 you will find it either on aliexpress or amazon. I use a Chinese app to buy things since I am currently working here so if I create links to things I bought won't be helpful to anyone.
Sure thing I looked on AliExpress it is this PS2 module one: Dual-axis XY Joystick Module Higher, PS2 Joystick Control Lever Sensor KY-023 a.aliexpress.com/_vtAGvw
Hi, yes circuit python has a great HID library which can do it, I get this question a lot will look at making a video soon once I settle in to new place
Hello, well I am not sure about this one because I have not programmed the raspberry pi 4 if you for example use to joystick with the pico and use the HID library in CircuitPython and connect it to raspberry pi 4 it will work as a mouse
Thank you for your suggestion. I should use elif or else, I am trying to keep the code as simple as possible for beginners. I will make a simple introduction to MicroPython to cover it in more detail which I can then refer to.
Hi, so you can just in code if you pull up for example y goes above a certain threshold then you can just set both y and x to 65000 with an if statement
Hi, in this video there is a variable being changed due to the Analog in, do you mean if you push the joystick forward it will add for example 1 to another variable? I am just not completely sure how you want to control the variable what is should do if you push forward, backward, left or right.
@@NerdCaveYT yeah! That's great. I'm trying to do a game in python dependent on the joystick for a mini arcade cabinet, so it'd control the y-axis of a pong paddle.
So at this moment you have the line yValue = yAxis.read_u16() this will read the "middle" value which will give you a minimum value of 0 to maximum 65,536 depending in which direction you push the joystick. Now in your game you will then set the paddle equal to this yvalue. The only issue is you will need a few if statements like my last example because the value fluctuate in middle if joystick is not pushed.
@@NerdCaveYT can you keep me updated on if this can be done your toutorials have been the best on RUclips for sure! My goal is to have the joystick output for the number pad on a keyboard in the direction it’s pointing then button press for the “5” key can this be done?
@@NerdCaveYT yea so if I could get the code to make the push button be number 5 . Then “up” as number 8 . Left as number 4 . Right as number 6 . Down as number 2 . That would be perfect.
@@NerdCaveYT I am 2 days new into programming a pico . Is there a way to have windows automatically recognize this pico as the keyboard that’s programmed to a joystick or do you Allways have to open thoony and press the play button.
Dude, you rock Pico tutorials, keep up the good work.
Thank you, for the feedback really appreciate it.
I love your pico tutorials series so much .please make awesome projects related to the pico a lot .thank you 👍👍👍
Thank you, cool projects are coming soon.
Great series of videos - super useful, thank you!!
Thank you
Thanks, great video. All clear and understandable 👍👍
Glad it was helpful!
i was like wtf is this ADC sorcery, then found out pico has ADC channels .... good to know
yes, this is something I hope future Raspberry PI's will have a lot of people want this tutorial for the PI well you can use external ADC should probably make a video on that
@@NerdCaveYT you are absolutely right, there are actually ZERO tutorial on how to connect a 5pins 5.5v joystick on the rapsberry4b via a 1X115 ADC board and the code that goes with it. Had to find out myself. I also discovered that i2c BUS 1 didnt work properly on 4b with ADCs, it s preferable to use BUS 0, moist of the time, bus1 would simply never find the ADC (through i2dcDetect -y 1). Took me hours before trying bus 0 (on pins 27 28). And managed to get a joystick to controll the mouse.
peace
Great video. Thanks for sharing.
quite detailed
Thank you, I think this could probably made a bit more stable using capacitors
I’m on a quad pico extender and my analog pins seem to trip out over this. Joystick and sensor values are all over the place. How do I fix this?
Add me to the list of people that would love to see this type of joystick controlling the cursor on a Raspberry Pi.
I was AFK for a long while, where you able to solve it or you still need a video?
instead of setting values what you did at 5:43 .. you can write something like this. .
round((yValue / 65535)*100) ...
round((xValue / 65535)*100) ...
This can give you percentage for a little more close to understandable value.
hi... can this applied to make an atari joystick adapter?? Thanks for your tutorials
Hi so if I understand correct you want to take an Atari joystick connect it to pico to be used as input for pc
@@NerdCaveYT yes... That´s Right...
@@gggg-bk7md that should be possible saw someone do it on Arduino and explain which each pin does and how to connect it, it will be easy to rewrite in CircuitPython then on the Pico
@@NerdCaveYT ok, thanks por your answer... ✌
Awesome! Saw your post on reddit OP 😁
Question:
What would happen if you put the joy stick in between 2 direction? Would it lit both LED or you need another line for that?
It will both be on since the two if statements would be true and thus both will be one if you want to put an extra LED between the two direction you can make another if statement that will trigger if both is true and then you make the other normal direction to be 0.
How would I make this a simple joystick/"controller" on Windows 10?
I would probably use an old arcade joystick module with some arcade buttons to give that authentic feel, this would actually be a nice project to do, but I would use CircuitPython since it allows the Pico to be used as an HID device. This is a good question I will make something next week
@@NerdCaveYT Thank you for the quick response!
If it helps you any way.
The idea behind it is due to me having a project to modify a keypad.
Like in this video. ruclips.net/video/0aBWoCRPxiU/видео.html
The use was as a smooth secondary joystick in a simulators for all kinds of things that need to turn (like, turrets, missiles, devices...) next to the airplane (controlled via a proper joystick) but also softer character controls (slow walking, walking, jogging, runnning,...) .
Unfortunately I could not get the same hardware components as the man here.
So I figured out that what he did was setting up a small "joystick" while ignoring the old lackluster hardware via some programmable USB board.
Your tutorials so far are good. It showed me that my soldering was ok and the components work without an issue (cables are still movable from pin to pin).
I will see where the journey with programmable devices will bring me.
Maybe I will make my own HOTAS system or something fancy like this: store.azeron.eu/
Ok i have all this set up it shows the buttons being pressed in thonny but how do i get this to move a character in a game with wasd
Will have to use circuit python and set up as a joystick, let me have a look at it and make a video lot of people asking about this
could this be used in pc gaming , or is it to complicated, im new to this
well I would say for like old school arcade games it will work great but for fps shooters the values fluctuate a lot so will have to add filters to circuit and little bit better coding then it should work.
Hey boet. Nice video. I wanted to ask if you know of any HID library to get these to work as joysticks for a PC, kind of making your own controller thing.
Hello thank you, CircuitPython has a great HID library: docs.circuitpython.org/projects/hid/en/4.0.1/_modules/adafruit_hid/gamepad.html I used it for a Macro Keyboard and Midi before, I assume you will want the joystick to send certain values that part you might to code like something similar I did in my last value to see the value of the joystick position since those modules fluctuate a lot when they are connected to the ADC channel. If you need more help got a discord channel not much going on there now: discord.gg/A4zegrBp
How to make it correspond with keyboard presses?
You will need to use circuitpython HID library on my channel I did convert joystick to mouse, so instead of using mouse HID library you can use the keyboard, are you building a gamepad?
where have you bought the joystick, please?
Hi, unfortunately don't think I can provide link because I bought it from a shop in China through a local e-commerce site Taobao. I live here in China, but you can find many of these on aliexpress or amazon. Search "Dual-axis XY Joystick Module KY-023" or just Arduino Dual-axis XY Joystick Module
Thank you very much. You are most kind. I have bought it. Btw-keep giving us these amazing videos! Thank you.
u can use a pico as hid right? if so, then can you make the joystick control the mouse cursor? and even better, can you make it into an actual controller? like using the axis to as controller axis
please make a tutorial on this, please
You can do this, it was something I was looking into doing. At this moment all my stuff is packed away and really hope in two weeks can move and start my videos again
@@NerdCaveYT Great! Can't wait!
@@NerdCaveYT If you have the time and managed to get some time, would you please do the tutorials? I want to create a controller with the raspberry Pi pico but don't know how to haha. Thanks for your videos!
@@hola_chelo I will was looking at making controllers and one for clone hero, I have few visa related documents but hope to have my apartment ready and everything sorted by the 7th things are a bit different where I am people not used to seeing a foreigner in my area.
@NerdCave that'd be awesome, no worries, there's no rush mate, hope all goes well for you. I just wanted to know if you were going to do it at all so I will turn on notifications! cheers!
hi what is the joystick model here? do you have a link from where i can buy it? thanks
Hi, if you just search KY-023 you will find it either on aliexpress or amazon. I use a Chinese app to buy things since I am currently working here so if I create links to things I bought won't be helpful to anyone.
Thanks for the video. What joystick are you using? Can you please leave a link to it.
Sure thing I looked on AliExpress it is this PS2 module one: Dual-axis XY Joystick Module Higher, PS2 Joystick Control Lever Sensor KY-023
a.aliexpress.com/_vtAGvw
Thanks for the video!
Is there a way to use the Joystick as a mouse pointer on the computer using MicroPython?
Hi, yes circuit python has a great HID library which can do it, I get this question a lot will look at making a video soon once I settle in to new place
@@NerdCaveYT thanks!
i was hoping to find someone who managed to run HID on MicroPyhon, not circuitpython
Do you know if there is any way to run two analog sticks off the one board?
Hi Callum, so since the Pico only has 3 ADC channels you will have to add external ADC which you can by using something like the ADS1115 16-Bit ADC
Hi, can I use this code with a regular raspberry pi 3?
I just checked the raspberry pi 3 does not have ADC chip but you can use an external ADC such as the MCP3008
can i change the code and make the joystick on raspberry pi 4 as mouse
Hello, well I am not sure about this one because I have not programmed the raspberry pi 4 if you for example use to joystick with the pico and use the HID library in CircuitPython and connect it to raspberry pi 4 it will work as a mouse
@@NerdCaveYT thank you for the answer
Dankie dankie
My plesier
Consider using 'else if' 😀
Thank you for your suggestion. I should use elif or else, I am trying to keep the code as simple as possible for beginners. I will make a simple introduction to MicroPython to cover it in more detail which I can then refer to.
Good video :)
Can someone help me when i pull the joystick up to set the y or x to 65000 then both the y and x value goes up to 65000.
Hi, so you can just in code if you pull up for example y goes above a certain threshold then you can just set both y and x to 65000 with an if statement
@@NerdCaveYT But what should i do to fix it that only y or x goes up to 65000
How to mix that with control motor ?
check my video using the l298n motor driver
@@NerdCaveYT y have a L293D motor driver
can i do this using rpi 4
The rpi4 does not have ADC pin or IC, so an external ADC module or IC will be needed to read analog data
Hey nerdcave!
Could you do a tutorial where instead of lights, it sets a variable in python?
Hi, in this video there is a variable being changed due to the Analog in, do you mean if you push the joystick forward it will add for example 1 to another variable? I am just not completely sure how you want to control the variable what is should do if you push forward, backward, left or right.
@@NerdCaveYT yeah! That's great.
I'm trying to do a game in python dependent on the joystick for a mini arcade cabinet, so it'd control the y-axis of a pong paddle.
So at this moment you have the line yValue = yAxis.read_u16() this will read the "middle" value which will give you a minimum value of 0 to maximum 65,536 depending in which direction you push the joystick. Now in your game you will then set the paddle equal to this yvalue. The only issue is you will need a few if statements like my last example because the value fluctuate in middle if joystick is not pushed.
How i can use this project as a real joystick, on a pc?
Will have to use circuit python and set up as a joystick, let me have a look at it and make a video lot of people asking about this
@@NerdCaveYT can you keep me updated on if this can be done your toutorials have been the best on RUclips for sure! My goal is to have the joystick output for the number pad on a keyboard in the direction it’s pointing then button press for the “5” key can this be done?
@@Elmorji how will the number pad look like? push upwards "1" right "2" etc. ?
@@NerdCaveYT yea so if I could get the code to make the push button be number 5 . Then “up” as number 8 . Left as number 4 . Right as number 6 . Down as number 2 . That would be perfect.
@@NerdCaveYT I am 2 days new into programming a pico . Is there a way to have windows automatically recognize this pico as the keyboard that’s programmed to a joystick or do you Allways have to open thoony and press the play button.
I can use it for raspberry pi 4
Yes you can
Add HID feature, pls 🙏
Will this week quickly make something by HID do you want to use it for mouse or as wasd or arrow movement?
@@NerdCaveYT I'll use it as gamepad controller to PC games