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).
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.
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
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.
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.
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)
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!