Beginner: How many inputs?

Hi!

I am about to buy my first Arudino to use in my DJ controller project. Until now I've used two gamepad PCB for the brain. The signals from the gamepads is converted to MIDI with a HID-to-MIDI application.

But I want to exchange the gamepad PCB to a Arduino and make it a MIDIuno, or a HIDuino :)

So my first beginner questions is:

  1. Is it possible to have 8 analog inputs (for faders/knobs), and 38 digital inputs (for regular buttons) from 1 pcs of Arduino UNO?

  2. Or do I need a UNO + some extra card?

I'm a beginner to Arduino and electronics, but I now a little bit :)

Thanks!

/ T

Or do I need a UNO + some extra card

Yes an extra card or to be more precise extra components. These are called port expanders. You can use the shift in technique:- http://www.arduino.cc/en/Tutorial/ShiftIn

Alternatively you can use other sorts of chips like in these two projects:- http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html

http://www.thebox.myzen.co.uk/Hardware/Pendulum.html

1) No Arduino has 6 analog inputs and these are multiplexed , so there is only one ADC that is used by all analog pins. 38 inputs is also too much for an UNO (don't know the number of a MEGA)

2) Shields can solve a lot - google for centipede shield and you have 64 digital I/O lines.

Thanks for all your advice!

Ouch. Seems quite advanced to get all those inputs?

But I am able to get 6 analog from one UNO?

What does "so there is only one ADC that is used by all analog pins" mean?

I've read about Mega now... "54 I/O (incl 4 HW UARTs, 14 PWMs, I2C bus), 16 Analog inputs"

Shouldn't the Mega do the job?

What does "so there is only one ADC that is used by all analog pins" mean?

The chip can only read one analogue IP at a time because there is only a single ADC (A to D converter). You get 6 analogue IPs because there's a 6-way switch between the pins and the ADC. For most applications it makes no difference and it's all hidden by the Arduino environment.

Shouldn't the Mega do the job?

Yes, the UNO won't.


Rob

Okey... So when I turn two knobs, only ONE works? Is this the same for the Mega? Sounds really limited?!

Just to confirm, can I have 8 analog inputs, and 38 digital inputs in one device with the Mega?

Thanks for helping me out!

Okey... So when I turn two knobs, only ONE works? Is this the same for the Mega? Sounds really limited?!

Literally this is true, a microprocessor can only ever do one thing at a time, but in practice it's not because things are happening at very fast speeds so it looks like it's all happening at the same time. So don't worry about that, it will work as you expect, turn a knob and the servo will follow, turn two knobs at once and both servos will follow their respective knobs (given the right software of course).

Just to confirm, can I have 8 analog inputs, and 38 digital inputs in one device with the Mega?

The docs state 54 IO pins, so 54 - 8 analogue = 46 left. So yes you will be OK.


Rob

Talking about the Mega:

Just to confirm, can I have 8 analog inputs, and 38 digital inputs in one device with the Mega?

The docs state 54 IO pins, so 54 - 8 analogue = 46 left.

Really? I see 54 digital and 16 analogue pins...

Oops, yes you're right it's 54 + 16, so even better.


Rob

--edit-- Most of the --- analog inputs can be used as digital outputs too.

Thank you to you all!

What would you advice me to do? A USB-midi device. Or a simple HID-device? Is USB-midi possible with Arduino Mega?

One relatively simple solution is to use serial–>midi converter software.
I’ve seen a couple programs that do this.

I dunno about how much latency there is, though.

I have searched for code that can send these gamepad signals in arduino.

But I have not find any.

Can someone please show me a complete code for an arduino with one button that sends HID/gamepad-signals to Mac. Both digital and analog. Please? Just to give me a first direction.

that sends HID/gamepad-signals to Mac

No HID uses USB and that is complex if at all possible.

You want to just use the serial output and then have software in the mac change it to MIDI. http://www.spikenzielabs.com/SpikenzieLabs/Serial_MIDI.html