Making a little "lots of joysticks" device

Here is the schematic of the situation:


HIGH (5V) goes to RV2, RV4, RV3, RV1 and LOW.

Even if the potentiometers are not fully adjusted, those of the unconnected groups influence the measurements of the connected group. A diode is required between each wiper and its analog pin.

Hi,
You have 2 joysticks. two outputs for each joystick.
You will have 4 outputs, so need 4 analog inputs to read each joystick.

What does 1 and 0 connect to?

This is what I think you need to look at?

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

This is a reply to post #8 and #15...

Double pole double throw relay to isolate the two banks.(What I would do).

Yes but it's more expensive and less reliable than a 4067 (original request was for 9 joysticks/18 pots, 16 thru 4067, the remaining 2 directly to the Arduino)

reply to #18 mikedb - thanks!

my plan is 7 joysticks now.

so i probably just Serial.print an id for which joystick&axis
(0..13) then

scale analog values into 0..127 with dead zones near 0,64,127
and only send if different than last time.

Ever done the linux pc side? Can you point me to an api to find, open, read this usb serial thingo? I can probably find it.

This arduino forum is great! people comin' up with things to help you with that you didn't even ask for heheh :slight_smile: I appreciate the enthusiasm.

I use the Arduino ide to do serial prints in Ubuntu and also platformIO.

Use Arduino ide to create the code for you Arduino board and then you get the serial print monitor as a bonus.

Anything other than a 16-channel muxer seems like trying to cut down a tree with a hammer.


One board turns one analogue input into 16 channels.
Keeps the wiring near the pots and away from the Arduino too...
Adding a second board to a second analogue input is just one more line of code.
Code can be simple.
Leo..

// 74HC4067 mux board with 16 x 10k pot, connected to VCC/GND/MUX inputs
// optional 16*100n ceramic cap between mux inputs and mux ground
const byte controlPin[] {4, 5, 6, 7}; // control pins s0-s3
const byte muxCommon = A0;
byte potvalue[16]; // holds 16 pot values 0-255

void setup() {
  Serial.begin(9600);
  for (byte i = 0; i < 4; i++) pinMode(controlPin[i], OUTPUT);
}

void loop() {
  // read the pots
  for (byte i = 0; i < 16; i++) { // 16 channels
    for (byte s = 0; s < 4; s++) digitalWrite (controlPin[s], bitRead(i, s));
    potvalue[i] = analogRead(muxCommon) >> 2; // dummy read, if needed
    potvalue[i] = analogRead(muxCommon) >> 2; // 0-15 and convert 10 to 8-bit
  }
  // print
  for (byte i = 0; i < 16; i++) {
    Serial.print(potvalue[i]);
    Serial.print(",");
  }
  Serial.println();
  delay(250);
}

Yes, you are correct. The diodes would be necessary. Thanks for the explanation.

i appreciate yall's advice !

I think I'm goin for 7 joysticks and stickin with this every (and using every analog port it's got).
Got some standoffs and teeny screws to mount these things.
And my code will just be ugly cuz i need all those dang pins :slight_smile:

I'll just send serial to my kubuntu pc over usb port like regular.
So my kubuntu c++ will need to find the right /dev/tty* to open and read.
prob just write ascii lines like
0x7F
0y40
6x00
6x03
as things move so
joystick# then x or y then 0-127 in hex cuz why not
(midi wants things in that range)
I'll post back when I get this closer to done.

now to install this ide - that's been a little painful in the past...

gol dang it! it was workin yesterday but not today.
I noticed a lot of
avrdude: jtagmkII_getsync(); sign-on command: status -1

yesterday, too. but the code i sent did actually get sent and ran. (There were no joysticks or breadboard yesterday.)

I'll check the pins again, but I'm suuuuure they're right.

But today when I send the thing all I get is that error a bunch of times then it gives up.

Anybody ran into this? Probably not cuz you're not stuck with an Every :slight_smile:

That thing is so small tho. It proved itself yesterday if I can just get my dang code to it again...

int p [14];

void setup () 
{  for (int i = 0;  i < 14;  i++)  p [i] = 9999;
   Serial.begin (9600);
}

void loop () 
{ int  i, v [14];
  char s [80];
   for (i = 0;  i < 8;  i++) v [i  ] = analogRead (A0+i);
   for (i = 0;  i < 6;  i++) v [i+8] = analogRead (A8+i);
   for (i = 0;  i < 14;  i++)  if (v [i] != p [i]) {
      Serial.println (sprintf (s, "%d=%d", i, v [i]));
      p [i] = v [i];
   }
   delay (100);
}

So it looks like you have not taken my advice given Post #9, or even looked at the code examples.

i'll fall back to another arduino later in my search. can't hurt to try out an Every. it met spec yesterday. just gotta figure out what's different about today. I'll try removing arduino studio and starting fresh tomorrow. Bet that'll fix it. If not I'll buy ooone last every. then fall back to a larger board with a usb chip that'll do a full class compliant midi controller on linux.

the code posted was for using a multiplexer. nice. but you folks are not following my specs very closely :slight_smile: not that that's terrible or anything. it's great!

but i think i've mentioned several times 7 joysticks should do it. And the Every has 14 analog inputs. And I can code my linux pc c++ midi sequencer to read the serial input from this Every just fine.

If you know from experience that 14 inputs into the chip can't work, please say so. But it seems like it'll work so far.

Stop calling it a dumb Every. That is an insult to Arduino, if you do I again I will report you to the moderators.

my apologies about callin it dumb. i do love the form factor (which is why I'm willing to stick with it).

BUT i have read in a lot of posts here, reddit, stackoverflow, etc with people having issues with the arduino nano every. OH! i still haven't tried grounding reset and, ehh, there was one last thing to try I found. other things haven't worked:
press reset twice, close the serial console, change the serial console's baud rate, send an empty sketch (sketch? i don't like calling normal things by new names - that's silly. I was goonna say the d word:)

but I did punt last night n bought one last every and an arduino due. The due can even be a proper class compliant (no driver) midi controller. it has slightly higher resolution analog and 16 of em, too. i think I'm stickin with 7 joysticks, though - a row of 2 then 3 then 2 looks nice and makes them all reachable.

seems weird to buy a whole arm board for something like this. maybe it's not a full scale cpu like what i usually think of with "arm" - somethin that could run android.

it frustrates me that i have to actually build somethin like this. i would thiiiink you could actually make money sellin something like this on etsy but i'm no biz person.

ok! on with the show - my website needs work and i want to get back to coding my softsynth ASAP.

argh the arduino due can do 12 analog - you sure can't trust those google summaries. the chip is apparently capable of 16 but at -least- one is reserved. if I mess with the libraries there's a possibility of maybe 2-3 more. again, we'll seeee.

The Mega has 16 analogue inputs, and has a better A/D.

I think you should just choose a small board with Midi capabilities and add one or two 16-channel 74HC4067 muxers to it. That will give the smallest footprint and the easiest wiring.
Leo..

Is there an advantage to using a multiplexer if the board has enough inputs?

The multiplexer probably has a better wiring layout than the "scattered everywhere" board pins.

I don't get the 2nd every and due till tomorrow. I'm not sure the midi controller will buy me, personally, anything. I write a midi sequencer - reading serial over usb is a snap on linux :slight_smile:
It would be useful for someone with a DAW though.
But I highly doubt I'll start an etsy store and try to sell this contraption heheh.

Haven't tried this yet - but it could be an issue with every and linux kernel. This thread explains it pretty well:

You've certainly found your way to the correct understanding of the Linux/NanoEvery issue.

Have your tried the serial monitor work around for generating the 1200 bps signal with Linux.