Help choosing correct Arduino

I Have only dabbled slightly in Arduino a few years back but I have a project I want to make now and would like to know the best Arduino to suit it.

Project will be a box with at least 10 momentary switches on it and I want each switch to represent a keyboard key (up arrow/ down arrow, +/-... that sort of thing) These commands would be sent to the computer over usb cable. I would like a small Arduino with built in usb but don’t know which models would have 10 switch inputs. I want it powered by the same usb cable as it will be plugged into the computer.

While not really a accustomed to Arduino I am an electronic tech (spend 40 years fixing coin op equipment of all types). I would also appreciate a point in the right direction for programming this keyboard input device (assuming its Been done before and maybe someone has a program like this already).

Thanks in advance.

Take a look at the list of boards on this page keyboard emulation

Arduino Micro or PJRC Teensy 2.0 can BE a keyboard using USB HID mode.

You want more buttons than pins, you can wire a matrix or daisy-chain shift registers on the SPI bus. The matrix will need 1 diode per button if you want multiple presses at the same time to read correctly.

we typically recommend an UNO for bench work to test things out
the NANO can be had with a screw terminal board for a more rugged installation

for 10 inputs, the vast majority of Arduino will work

we typically recommend an UNO for bench work to test things out
the NANO can be had with a screw terminal board for a more rugged installation

but can either of them emulate a keyboard ?

To make an Uno or Nano look like a keyboard to a PC takes modifying the board and trickier code.

The Micro and Teensy 2 have a USB-AVR chip that can switch between USB modes with a line of code.

UKHeliBob:
but can either of them emulate a keyboard ?

no, not to output back onto the USB, to send a signal to a device (PC?) as if a keyboard were connected.

I want each switch to represent a keyboard key (up arrow/ down arrow, +/-… that sort of thing) These commands would be sent to the computer over usb cable

The requirement seems to be keyboard emulation

You can make AVR chips do the same using the V-USB library. The Uno and Nano have their own and last I knew you'd have to cut 1 or more traces and do some soldering to get them to do USB HID.

Frank Zhao, a member here (haven't seen on the forum in years) who made USB-HID credit cards using ATtiny85 chips.

Attiny85 has 8 pins, 512 bytes RAM, 8K flash and costs little but you might not get 10 buttons with what pins are left over. NOT a problem since the same code with few small changes (pin numbers for one) should run on a 168P or 328P.

You can program AVR chips with an Arduino, there's tutorials and software for that.

GoForSmoke:
To make an Uno or Nano look like a keyboard to a PC takes modifying the board and trickier code.

The 16U2 in a UNO can be programmed as a HID or other USB "device" to emulate a keyboard. No physical modification but certainly somewhat trickier code. :grinning:

Essentially you use the 328 to read the keys and send serial codes to the 16U2 which it then encodes to the USB system.

That is the specific and pretty much sole advantage of using a UNO over a Nano but for this it must actually be a UNO or UNO "clone" and not a fake UNO as many or most of the "clones" fraudulently claim to be, actually correctly described as Duemilanove clones or variants using a CH340 or similar. If it does not have a 16U2, then it is simply not a UNO at all. :astonished:

Thanks for the clarity Paul, K2Y!

If I wanted to mess with V-USB I think I'd be doing it on a breadboard with stand-alone chip just to keep it simple.

Note that V-USB is not in any way the same as a chip which implements native USB support such as the 16U2 on the UNO or 32U4 on the Leonardo/ Pro Micro. ("U" = USB)

Step back from the problem for a moment.

The stated problem is to make key board.
We assume it is to work as a totally native USB keyboard.

First question is if the Arduino is the best first choice.

Second question is if wired is required

Third is what is the easiest way.

Also with MicroChip 'upgrading' the Atmel line two questions arise.
Will an upgrade remove features?
And will an upgrade add features ?

Lastly in light of the enhanced chips being added to the Arduino line, do any of the new Nano boards make this easier?

Paul__B:
Note that V-USB is not in any way the same as a chip which implements native USB support such as the 16U2 on the UNO or 32U4 on the Leonardo/ Pro Micro. (“U” = USB)

For sure!

V-USB is a work-around made maybe before ATMEL made “U” chips or made hobby-affordable “U” chips.

I would compare to Serial vs SoftwareSerial except the difference is bigger.

Still would Frank Zhao’s business card cost the same to make with a 16U2 instead of ATtiny85? That’s all about the niche!