Connecting 10 joysticks to an arduino

hello everyone
I'm relatively new to arduino,
however i wanted to try to connect 10 different regular joysticks to an arduino.
but like connecting just one uses 5 different ports on the arduino.
Is there anything i could try? to like maybe try and split the ports?

Can you describe what you mean by a "regular joystick"?

And I add: what is the real life need of 10 different joysticks connected altogether?
Even an octopus could have some issues by using it... :wink:

1 Like

Welcome to the forum

For the sake of clarity, does each joystick have 2 axes and a pushbutton and does each axis have 2 digital switches or are the joysticks analogue devices ?

Regular joystick KG-023 has two AO's and a switch input. What joystick are you using with 5 outputs? 5 pins is typical with three signals and Vcc/Gnd.
10x joysticks = 20 AI's. Mega 2560 only has 16. So, multiple cpu's OR an analog mux is called for.

Hi, @sulaimanq
Welcome to the forum.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

For example, you can use the MCP23017, or multiples cascaded MCP23017, for to extend the number of inputs on your arduino

Each MCP23017 add 16 new I/O ports on your arduino and you can cascade them, so have 32 additionnals ports with the use of two cascaded MCP3207 for example

But I see than the KG-023 joystick use analogic ports, not numerics ports :frowning: :frowning:
=> you can multiplex signals with one or multiple 74HC4067 for to multiplex signals from yours joysticks before to make the A/N conversion of each port one after the other ?

HI,
I think we need to wait for @sulaimanq to reply with the application before we can offer anymore information.

Tom.. :smiley: :+1: :coffee: :australia:

No, you can't use a digital I/O chip with an analogue joystick.

Two 16-channel 74HC4067 analogue muxer boards can provide up to 32 channels,
using four digital pins and two analogue pins.
Three 8-channel 74HC4051 analogue muxer boards can provide up to 24 channels,
using three digital pins and three analogue pins.
Leo..

Hi,
I'm just wondering how the wiring would be set up?
for more context i'm likely using these joysticks https://a.co/d/chgapMV

The joysticks you linked to need two analogue inputs each.
As I already told you, you can't use the MCP23017 for analogue signals.
Leo..

Begin first with only one joystick

Connect the GND pin of the joystick to the GND pin on your arduino, the 5V pin of the joystick to the 5V pin of your arduino, and for example the switch pin of your joystick to the D7 pin of your Arduino

You can then begin to use something like this very basic code given at The Basics of Arduino: Reading Switch States

const int DIN_PIN = 7;

void setup()
{
    pinMode( DIN_PIN, INPUT );
    Serial.begin( 9600 );
}

void loop()
{

    int value;
    
    value = digitalRead( DIN_PIN );
    Serial.println( value );

    delay( 1000 );
}

After, you can add the wiring of the IRX and IRY pins of your joystick to the A0 and A1 pins of your arduino and read the value of them using valX = analogRead(A0) and valY = analogRead(A1) calls into the loop() call

And after AND ONLY AFTER, you can begin to multiplex signals with for example a 74HC4067 analogue muxer for to multiplex them, cf. one thing after the other, not alls things directly at the begining ...

PS : prefer to use digitalRead() calls for the reading of joysticks switch's ON/OFF states and analogRead() calls for the axis values reading

Hi, @sulaimanq
What is your project that requires 10 joysticks as an Arduino input?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.