Giter VIP home page Giter VIP logo

hiduino's Introduction

HIDUINO

The HIDUINO project provides firmwares, documentation, and example code for building a class-compliant USB-MIDI device from an Arduino UNO or Mega 2560. HIDUINO does not use middleware software to convert serial messages through a MIDI loopback port (like LoopBe1 on Windows or IAC on OSX). Instead, HIDUINO provides a true USB-MIDI device for plug-and-play compatibility on Windows, OSX, and Linux - just like a commercial MIDI controller.

HIDUINO takes advantage of Arduino boards where a second AVR chip is used as the USB controller, so it won't work with single chip variants (e.g. Leonardo), nor older boards that use an FTDI chip as USB controller (e.g. Duemilanove). Many cheap Arduino knockoffs that pretend to be an Uno or Mega also might not work, since they tend to use the (slighly) cheaper FTDI chips.

HIDUINO is based on the LUFA framework by Dean Camera. HIDUINO was previously developed for robotic instruments and new musical interfaces @ the California Institute of the Arts.

The project name refers to a time when it was intended to contain many different USB-HID device types (joystick, mouse, keyboard, etc). The name "mididuino" is in use by an existing project, though it would be a more fitting title for this project.

Some good examples of HIDUINO in action:

mHzKontrol NotomotoN Diaktoros

Requirements

The full list of requirements is listed on the wiki. At a bare minimum, you'll need:

MIDI Library

Since HIDUINO doesn't come with code for consuming or producing MIDI data in sketches themselves, a separate Arduino library must be used to encode/decode the MIDI format inbetween the HIDUINO firmware and the sketch. Notably, the standard Arduino midi library has not been updated to use the most recent "properties" file format, but details on this can be found on the wiki.

Quickstart

The Github wiki contains a host of information on working with HIDUINO. HIDUINO can be flashed onto the ATmega (8u2/16u2) chip on the UNO and Mega2560. Sketches cannot be bootloaded onto an Arduino while a HIDUINO firmware is loaded on the 8u2, so users can expect to switch between the default usbserial and HIDUINO firmwares regularly during development. The flashing process can be accomplished using an ISP (recommended) or through the DFU bootloader.

If using the ISP method, an easier way of development is to flash the USB controller chip with HIDUINO just once. Then, in the Arduino IDE, select "Upload Using Programmer" and connect the ISP to the header block near the main chip. This means the Arduino sketch can be flashed from the IDE without commandline interaction via an ISP or DFU. While HIDUINO is loaded onto the USB controller, do not attempt Serial communication via Serial.print()/println(): this will interrupt MIDI serial stream on the USB controller.

Flashing the arduino_midi firmware located in the compiled_firmwares directory: Note Remove the slashes in a program like Notepad if you are on Windows.

avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:arduino_midi.hex \
-U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

The latest revisions (3+) of the Mega and UNO (and Due) use the Atmega 16u2 chip, so note the name changes of the default usbserial firmware below. On older revisions, the 8u2 chip is used. 8u2 firmwares are also included in the Compiled Firmware directory. The only important distinction between them is the product string that appears when an Arduino connects to a computer. avrdude will give a generic error if you try to flash an 8u2 chip with a 16u2 firmware and vice-versa. The at90usb82 chip profile is used for the following commands as it resembles both 16u2 and 8u2 -- one less thing to remember to change.

Flashing usbserial onto an UNO using an avrispmkii:

avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:usbserial_uno_16u2.hex \
-U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

Flashing usbserial onto a Mega2560 using an avrispmkii:

avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:usbserial_mega_16u2.hex \
-U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

Flashing usbserial onto a Due using an avrispmkii:

avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:usbserial_due_16u2.hex \
-U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

A Note About Compiling

Compiling the firmware from scratch lets you change the name of the USB device (default HIDUINO).

Similar Projects

  • HID - MIDI-capable HID implementation for 32u4-based-Arduino boards (Leonardo) or Uno/Mega with custom bootloader
  • arcore - Similar to HID but only for USB-MIDI on Leonardo
  • mocoLUFA - Combined midi/usb-serial firmware

License

HIDUINO is released under the MIT license. HIDUINO inherits from the MIT license set by LUFA. A commercial license of LUFA is available for close-sourced products that do not wish to maintain MIT's attribution clause.

hiduino's People

Contributors

ddiakopoulos avatar diegoherranz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hiduino's Issues

SysEx support

I think there was a development branch or folder including SysEx support. I can't find it anymore. Has it been merged to main branch? Which is the SysEx support status for v2.0? Any plans?

Thanks!

USB Serial and HIDUINO at the same time

Hello!

Would it be possible?

I would love to, for example, have switch, that the Atmega looks at, at startup, and runs one or the other.

What do you think?

How to use multiple HIDUINO devices in windows 7 with Ableton live?

Hello,
I have successfully been using the HIDUINO setup now and have 3 devices all with different names that all show up in device manager with that new name. The problem is, in Windows 7, in Ableton Live, the devices are not different, they all have the name of one of the devices with #1, #2, etc. appended on the end. Is there a way to have each device have a unique identifier embedded somehow?
Thanks
Tristan

About MIDI-via-USB input/output latency on Arduino board ?

@ddiakopoulos

First of all many thanks for this project and your excellent explanations. I am particularly interested for making a custom MIDI controller sending MIDI CC through multiples pedals (sending continuous CC (not switch on/off) based on Arduino Board and your project. The goal would be to gain advantage of the high band pass of USB (compared to classic u.a.r.t 31.25 Kbaud rate). Please, note that I have not yet buy any Arduino hardware, So I would like to ask you in the case you already did the following experimentation:

1)Did you try a latency MIDI input/output measurement on a single 3 byte MIDI messages (i.e a note on) ?.
This measurement is simple to do from the host computer side making use of the arduino MIDI-via-USB device:

  • On the Arduino MIDI-via-USB device the program (so called sketch) need to do a loop between MIDI in to MIDI out.
  • On the Host computer, the program must send a note On, an wait for the received note on and do the time measurement between sending and receiving.

2)Also on Arduino board UNO or Mega 2560, I wonder if the second AVR chip (used as the USB controller) is really full USB 2.0 (or 1.0) speed compliant . Please have you any opinion or on this matter ?.
Thanks again.

Hiduino changing midi message?

Hello,

First of all thank you all the devs (hiduino, LUFA) for your awesome arduino contributions.

Here's my problem:

I used this tutorial to make my midi controller: http://www.instructables.com/id/Arcade-Button-MIDI-Controller/

The software that I have loaded up on the Arduino is here: http://www.instructables.com/files/orig/F31/XWO4/GXL5XQYD/F31XWO4GXL5XQYD.zip

When I enable debug (so I can see human readable serial debug messages) it shows all of my buttons and potentiometers working correctly with push down / up, and pot ranges between 0-127.

If I use a Serial - > USB converter and a Virtual Midi device, I can open programs like MIDI OX, Ableton, and Mixxx with successful mappings for every part of the controller.

Whenever I flash the Hiduino, though, the arduino is recognized by the system as a Midi compliant USB device, but the MIDI message is being altered. Instead of everything being on channel 1, each button is a signal almost on it's own channel. I am sure the message is getting offset somehow with Hiduino, but I do not know what to do about it. (for example if I hit the 5th button on my controller 3 times it will show in MIDI OX as getting a midi message for channel 4, then the 4th time I hit it will show a midi message on channel 5, then it will repeat the pattern)

If you have any information that might help me fix this I would greatly appreciate it.

Thanks

Midi Note 'locks'

I can't even get the Basic Midi_input example to work. I added to turn the led on and off, regarding the noteon or off function. But as soon as I send a note, TX and RX are getting crazy and the led stays lit...

Mega2560 is not recognised as USB-MIDI device

Hello,

I compiled the arduino_midi again with my name"carlos-midi' and flashed with a Mega2560 using atmel studio on Win7 64 bit.

1
2
3
4
5
6
7

All went smoothly, but still get Mega2560 when plugin.

I hereby attached the process in order:

  1. Plugin avrispmkII
  2. preparing atmel studio
  3. setting fuse
  4. setting lock bit
  5. flash and verify
  6. plugin USB
  7. Arduino Mega 2560 in Device manager

I would need your help to develop a usable usb-midi device with Arduino, but now I get stuck at the first stage, what should I do?

Thanks a lot,

Carlos

Schematic for flashing chip not on an arduino?

Hello,

I have successfully programmed an arduino uno with these hex files. on a 16u2 based uno. I have gone out and purchased a couple 16u2 chips, and had wired them up based on the datasheet. I even tried to wire them up based on the Arduino schematic. I unfortunately unable to get them to accept programming. I was hoping maybe you've tried this and may have a schematic that works Thoughts?

Device not recognized after changing device name

I can compile the unmodified source code correctly and everything works fine. But when I changed the device name in the code, I still compiled correctly, and the device name I changed was successfully displayed in the control panel, but it could not be recognized in the FL Studio software. I want to know how I should change the device name correctly.

This is what I have changed:

Descriptors.c
line 263
const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"arduino_midi");

Changed to

Descriptors.c
line 263
const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"My MIDI Controller");

Problem when flashing up a compiled from scratch hiduino .hex file.

Hello.

I wanted to compile hiduino from scratch to change the name my device. The compilation seems to run well but after flashing up the firmware on my mega 2560 Ableton Live can't recognize it.
It must certainly come from the compilation because it works well with the pre-compiled .hex file.
I use Lufa 130303 and the current version of hiduino. Did I forget something when compiling or does the problem come from Lufa or the hiduino scratch?

Thank's. You did an awesome job by the way, it's been really usefull to me.

PS : Sorry if my English is bad.

ProgramChange bug with Arduino MIDI Library Version 3.2

I'm using the Arduino MIDI Library Version 3.2 and it works fine with ControlChange but when i try seining and receiving ProgramChange I get very strange and erratic results. It only happens when I flash the 8U2 with HIDUINO, if I flash MOCO/LUFA, the code works fine.

This is how i read out the ProgramChange:

 byte currentPreset;
...

if (MIDI.read()) {

    switch(MIDI.getType()) {

    case ProgramChange: 
      currentPreset = MIDI.getData1();
      break;

And sending it back like this:

 MIDI.sendProgramChange(currentPreset, 16);

Hiduino Midi In Don't work with Arduino Mega 2560

Dear ddiakopoulos,
I have another serious problem with your software hiduino. First i'm using Arduino Mega 2560 and if i program it to send the Midi -Out..Works ok...But i have problems, don't work nothing , when i try to use it as midi in...I don't be able to receive midi in... For example if i program to push a button and send via usb Midi out to reason software or logic studio works fine....But if i play a music from reason to receive midi notes and i program the example led blink don't receive the hiduino midi notes..don't work...In fact i would like to light on my custom leds in my project application with the midi in signals....Can you help me please??? What's wrong with me?? Do you have some simple Midi In example working??Please??Thanks A lot Lestroso.

Can't flash Arduino Mega 2560

Hi.
I apologize if this is a newbie question but I tried to figure out and search everywhere to find an answer to solve this problem. I'm trying to use my Arduino Mega 2560 as midi controller using Control Surface Master. However I could not get to flash my Arduino Mega 2560 using avrdude on Mac OS Mojave. I always get stuck and get this error: stk500v2_command(): command failed
I'm using this commands to do so: avrdude -p at90usb82 -F -P /myusbport -c avrispmkii -U flash:w:arduino_midi.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

After hitting enter I get this:

**avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: Expected signature for AT90USB82 is 1E 93 82
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: stk500v2_command(): command failed

avrdude done. Thank you.**

What am I doing wrong? I follower step by step Hiduino's documentation. Installed latest Crosspack and running IDE 1.8.13

Flashing issue

I have flashed the Atmega 16u on my Arduino MEGA using a Sparkfun USB Tiny programmer and when plugged in to either my MAC or PC does not recognize as MIDI device. The programmer is working fine uploading Arduino sketches and I receive no errors using avrdude. Any help??

Using Multiple Hiduino Device (Compiled with Name Change)

I have 4 Hiduino programmed Arduino's as midi controller converters. I have used the compiling descriptions (from Issue #15) and I am able to get each Hiduino to show up as it's own device. But since I am using more than 1 Arduino, I would like to know what needs to be changed in Descriptors.c and other places to have these be completely independent devices. Because, my program seems to keep cycling through each Arduino looking for "something". There doesn't seem to be an issue when I connect only 2 Hiduino's.

Here is what I changed in Descriptors.c:

Line 56 - .VendorID = 0x03EB,
Each Arduino has the above code, unchanged
Line 57 - .ProductID = 0x2049,
I have given each Arduino a different number above.

Line 262 - 267 - USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(6), .Type = DTYPE_String},

.UnicodeString          = L"ES8100"

};

I've changed the above to be the same for all 4 Arduino's

Line 273 - 278 -USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(12), .Type = DTYPE_String},

.UnicodeString          = L"Controller 4"

};

I've changed the above to have 4 different controller numbers

Compile latest version against LUFA

Has anyone been able to compile the latest version of Hiduino here with LUFA? I've seen that we have recently updated (v2.0?) but I am struggling to compile from scratch to customize the devices names! Help please!

Command in docs fails to re flash original firmware

Trying to flash the "usbserial_mega_16u2.hex" in Compiled Firmware back on to the 16U2 on an R3 Mega fails with the given command:

avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:usbserial_mega_16u2.hex \
-U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

yields

...
avrdude: ERROR: address 0x3010 out of range at line 254 of usbserial_mega_16u2.hex
...

changing the chip profile in the command to the actual chip ( -p atmega16u2) works fine.

Flip: Address is out of range

@ddiakopoulos Hello,
We're currently having trouble with the usbserial_mega_16U2.hex for the Arduino Uno Rev3.
Flip tells us this error :

Class com.atmelflipGui.FileMenuHandler
The Address is out of range

The reason could be that our arduino may not have enough space to put this 20ko file in, because flip says "12 ko" max for our mega16u2. We can't change the maximum size authorized in flip unfortunately (even by changing min and maxin the buffers). We tried different sizes of hex to input, and it appears that our maximum is 16ko...
Are we doing it right??

PS: we tried some other hex (LUFA mocco), and the arduino is constantly sending midi to the music program we use (FYI Ableton).

USBtiny programmer cannot find arduino_midi.hex file

Newbie alert. I'm trying to flash an UNO r.3 with hiduino. I keep getting an error message in terminal that it cannot find the arduino_midi.hex file
I'm on a MacBookPro if that matters
Is there somewhere specific I am supposed to place the Hiduino folder containing the firmware upon download?
This is line I am using to flash.
avrdude -p at90usb162 -P usb -c USBtiny -U flash:w:arduino_midi.hex -v -F

There may be other issues as well. I don't really know how to decipher the Terminal message. I've included the entire message below.
Thanks in advance for help. I'm new to all this.

avrdude: Version 6.0.1, compiled on Dec 16 2013 at 17:26:24
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

     System wide configuration file is "/usr/local/CrossPack-AVR-20131216/etc/avrdude.conf"
     User configuration file is "/Users/terrydame/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : usb
     Using Programmer              : USBtiny

avrdude: usbdev_open(): Found USBtinyISP, bus:device: 001:008-1781-0c9f-ff-00
AVR Part : AT90USB162
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC6
RESET disposition : possible i/o
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no        512    4    128  9000  9000 0x00 0x00
       flash         65     6   128    0 yes     16384  128    128  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : USBtiny
     Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/

avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9489
avrdude: Expected signature for AT90USB162 is 1E 94 82
avrdude: safemode: lfuse reads as EF
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: Using SCK period of 10 usec
avrdude: reading input file "arduino_midi.hex"
avrdude: error opening arduino_midi.hex: No such file or directory
avrdude: input file arduino_midi.hex auto detected as invalid format
avrdude: can't open input file arduino_midi.hex: No such file or directory
avrdude: read from file 'arduino_midi.hex' failed

avrdude: safemode: lfuse reads as EF
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4
avrdude: safemode: Fuses OK (H:F4, E:D9, L:EF)

avrdude done. Thank you.

Terrys-MBP-9:~ terrydame$

USB Host?

Hi,
I'm attempting to build a wireless MIDI link. I have the wireless part down, and I can send MIDI out on the receiver, but I'm looking for a way to input USB MIDI to the transmitter.
Essentially, I have an EWI USB, which is a class compliant USB MIDI device, and I want to read the MIDI out from it on the Arduino. The problem is twofold. I need to power the EWI somehow, and I need some kind of MIDI host.
Is this possible with HIDUINO, or should I be looking elsewhere.
I did see this post, which discussed using a bought converter to create serial MIDI, which I could read, but the device is designed to be plugged into a computer, so I'm not sure about that.
Would the USB Host shield be my best bet her?. The MIDI documentation seems rather sparse for that.
Is there any way to do what I want with this firmware?
Thanks for you help,
Daniel

Falsh sucess but no MIDI device!?!

I have flashed the Atmega 16u on my Arduino MEGA using a Sparkfun USB Tiny programmer and when plugged in to either my MAC or PC does not recognize as MIDI device. The programmer is working fine uploading Arduino sketches and I receive no errors using avrdude. Any help??

Device not recognized when using Ardiuno Nano (clone)

After banging my head against the wall for the past couple of days I've decided to ask this and hope someone has a solution (if there is one at all).

So I want to use an Arduino Nano as my midi device.
I have a few of these so I also use it as an ISP programmer. They are all clones with CH340 instead of the FTDI one (should this affect anything?).

I've flashed HIDUINO_MIDI.hex using avrdude using the following command:
avrdude -p ATMEGA328P -F -P COM5 -c avrisp -b 19200 -U flash:w:HIDUINO_MIDI.hex \ -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

I get a:
verification error, first mismatch at byte 0x000
0xf4 != 0x04
verification error: content mismatch

I don't know if that's such a tragedy but I've tried continuing nevertheless...
edit: At this stage, when using Windows, the device appears as USB-serial CH340.
I've uploaded, using my arduino programmer, one basic MIDI project - but the device is not recognized, nor sending any midi signals (although it does flash rx when it should).

I've also tried flashing 'usbserial_uno_16u2.hex' but still the same.

One last thing, I've seen somewhere that arduino nano might have a problem with midi over usb because of how its built. If that's any true, which other smaller version of arduino can I use? I have to fit it into a very small package so Uno is out of the question...

Thanks,
Iftach

Hidduino input interrupts send rutine

I`ve got the folloewing problem: I've builted a controller to controll native instruments traktor and it works pretty well but when i try to use led outputs from traktor my controller starts to send the note on and note off command twice

Here's my code

key_in = analogRead(0); // read the value from the sensor
key = get_key_1(key_in); // convert into key press
if (key != oldkey) // if keypress is detected
{
delay(100); // wait for debounce time
key_in = analogRead(0); // read the value from the sensor
key = get_key_1(key_in); // convert into key press
if (key != oldkey)
{

  if (key >= 0)
  {
  MIDI.sendNoteOn(key,127,2); 
  onx = 1;
  }
  else
  {
    if (onx == 1) 
    {
      MIDI.sendNoteOff(oldkey,0,2);
      onx = 0;

    }
  }
  oldkey = key;
}

}

int get_key_1(unsigned int input)
{ int k;
for (k = 0; k < 4; k++)
{
if (input < key_val_1[k])
{ return k; }

if (1023 == key_val_1[k])
{ return 1023; }
}
if (k >= 4)
k = -1; // No valid key pressed
return k;
}

Arduino UNO with Mega16u2, not recognized as Midi device! Lufa sources?

Hello everyone!

I started to learn how to turn my Arduino into a native Midi device with the Hiduino project,

I'm using an Arduino Uno Rev 3 with a 16u2 and a 328p microchip, and an AVR ISP mk2 programmer
after a few tries, I managed to flash my Mega16u2 with avrdude on Windows XP with that command:

avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:arduino_midi.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

it worked grate with no error, but... it's not recognised as a Midi Controller when I plug it with Ableton Live or other software!

I tried it on Windows, Mac, and Linux and the result is the same: nothing happened and the device is not recognised

So I started to explore the MOCO/Lufa and LUFA project

with the mocolufa 'MIDI.hex', and the 'dualMOCO.hex' files, I tried that command:

avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:MIDI.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

and

avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:dualMOCO.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

And ... it worked successfully!

My Arduino is now recognised as a Midi Device, on every platform I tried! even the dual mode with dualMOCO is OK!

my project was to learn also how to compile my own .hex file,
I managed to do that with the MocoLufa Source Code, using WinAVR and the 'make all' command

I noticed that the Lufa source is: LUFA-101122 (for simpleMocoLufa) and LUFA-100807 (for dualMOCO)

Hiduino is using a LUFA-140928 source (latest one!?)

So my question is:

why the .hex files made from a LUFA-140928 source code doesn't fit with my Arduino Uno and Atmel16u2 , while an old LUFA-101122 or LUFA-100807 source based code will work very well on the same architecture with the same tools etc etc??

thank you for your answers!

A.S

Links:

Hiduino:
https://github.com/ddiakopoulos/hiduino

Moco Lufa simple midi mode:
http://morecatlab.akiba.coocan.jp/morecat_lab/MocoLUFA.html

Moco Lufa dualmode:
http://morecatlab.akiba.coocan.jp/lab/index.php/aruino/midi-firmware-for-arduino-uno-moco/?lang=en

Lufa Library with all the old release include LUFA-101122 and LUFA-100807 (useful for compiling respectively mocolufa and dualmoco sources) :
http://www.fourwalledcubicle.com/LUFA.php

Is it possible to use Hiduino (MIDI) through Xbee?

Hello,
We are planning to control flame throwers through Ableton Live and Arduino and considering Hiduino as a perfect fit! But I would like to know if it is possible to use Hiduino to recieve MIDI messages from Ableton Live through Xbee?

Any idea?

Best regards,

Xavier

'MIDI' was not declared in this scope - unresolved!

Hi!
I see that someone else wrote with this problem a while ago and closed the issue after you suggested a particular MIDI library. But the problem is not that the library is not loaded; the problem is that it is not declared in the scope in which it is used, in the first example. I get this error for both MIDI.begin in setup(), and MIDI.sendNoteOn in loop().
I installed the exact MIDI library you recommend, but apparently it's the way the first example is written. Could you take a look? My C is a little rusty, but I will look it up when I get a chance.
I'm trying with Arduino 1.6.6 on Win 7 (I tried also with Arduino 1.0.5).

Thanks.
Chuckk

Flashing ft232rl firmware

Hi,

I am trying to assemble a head tracker which consists of a sensor BNO055, a Arduino Pro Mini for data processing and a Arduino USB2 Serial conversor. Instead of the Arduino USB2 Serial conversor they use in the original project (https://git.iem.at/DIY/MrHeadTracker/wikis/mrht-bno055) I had to but a FTDI board ft232rl. I would like to know if there is any way to flash its firmware with an .hex file provided in the repository of the original project or if it behaves completely different from the arduino usb. If it's not possible, I would like to know if would exist the possibility of flashing the pro mini which already has the sketch for data processing uploaded in it.

Thank you very much.

Enzo Bom.

Error compiling

Hi
Thanks for your work.

WARNING - beginner , i have NO prior knowledge with LUFA

I have multiple units, and want to change the name.
I have tried to compile from instructions in #15, and from src.
But it dosnt work for me.
from #15 , with LUFA_PATH = . i get - Path not found
If i use absolute paths?, i get makefile:631: *** multiple targetpatterns. stop.
i dont know how to use relative path, when . dosn't work

With src files and abs. path i get
avr-size not reconized a internal og external command

I use make from Atmel\Studio\7.0\shellutils, i have also installed
http://mingw-w64.org/doku.php/download

Any help apriciated

32u2 serial to usb chip

Hello, I happen to order an Arduino clone board, but it uses a 32u2 chip as a serial to usb converter instead of 16u2 or 8u2. My question is - can i use the precompiled firmwares from 16u2 or do I have to compile extra firmware?

If so what MCU do I use in the makefile? I tried to put

MCU = at90usb82 or
MCU = atmega32u2

bu the compilation fails.

Thank you for any informations.

Can't make using WinAVR-20100110

I put "HIDUINO_MIDI" under the "projects" folder under "LUFA-120730"
use cmd like below and it stop but other default projects can be "make"

C:\LUFA-120730\Projects\HIDUINO_MIDI>make all
grep: Version.h: No such file or directory
../../LUFA/makefile:30: ../../LUFA/Build/lufa.sources.in: No such file or direct
ory
make: *** No rule to make target `../../LUFA/Build/lufa.sources.in'. Stop.

C:\LUFA-120730\Projects\HIDUINO_MIDI>pause

Flashing efuse verification error...

Hi again,
I'm trying to flash HIDuino to my Arduino Uno (with ATmega328P and ATmega16u2).
I'm using an arduino pro mini as an ISP (if that changes anything..)

Following these commands:

avrdude -p ATmega16U2 -F -P /dev/tty.usbserial-A9SZZT51 -c avrisp -b 19200 -U flash:w:HIDUINO_MIDI.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

The following error appears:
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xF4:
avrdude: load data efuse data from input file 0xF4:
avrdude: input file 0xF4 contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0xfc != 0xf4
avrdude: verification error; content mismatch

avrdude: safemode: efuse changed! Was f4, and is now fc


the other fuses are verified ok, and when I remove -U efuse:w:0xF4:m from the command line there are no errors whatsoever but HIDuino probably isn't flashed right and doesn't work.
note that I get this error after running the command:

avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.

But I accidentally found out that if I connect the arudino nano to the FTDI programmer just a second after running the command, it does get a correct ATmega328P signature and continues (ever if expected a different signature, by the way..)

anyone has an idea how to solve this?
Thanks!

Hiduino recompiler web app

Hello!

@pablofullana has developed an early stage of a tool that I think could help lots of hiduino users.

It is a web app for recompiling and renaming the hiduino firmware, to show up as an HID with any name we want.

Its inputs are "Manufacturer Name", "Device Name" and "Arduino Model" (Uno and Mega2560), and it outputs the hex file as a download.

This is the project rep

It is in absolute alpha version, and I am hosting it in a Ubuntu desktop and publishing it with ngrok, I will leave it like this for a couple of days so you can try it out.

For now it works with one request at a time.

If some of you guys want to help and host it in a server you own and make it more permanent it would be awesome.

It could be more beatiful as well, so any CSS jedis out there can help.

Also if you want to contribute just generate a pull and be brave :)

Hope you like it!!

32u4 leonardo

Hi, I'm having trouble getting hiduino to work on my 32u4, i need it to basically act as a usb midi converter, I thought I could just upload the hiduino firmware to it and have it work but I cant get the PC to even respond to it, flashing the leonardo firmware back works fine, and I've mabaged to get it to work no problem on an 8u2 and a 16u2 but not the 32u4.

Is there anything I'm doing wrong? (I'm using an ISP programmer)

MEGA 2560 Rev3 flashing issue

EDIT: I just found your email Dimitri so i'll email you the question. Just figured it wasn't so much related to the firmware itself. Delete this message if you like.ty

I have the mega 2560 Rev3 (authentic) arduino and i'm have problems trying to flash it with a usbtinyISP.

Not sure which one i ended up flashing ( arduino_midi.hex, usbserial_mega_16u2.hex) but it semi-bricked my arduino. Luckily i was able to get it back up and working using the regular .hex file bootloader. Now out of those 2 firmwares, which one are we supposed to install on the arduino? Pretty sure mine is the '16u2' but don't know why there is 2 seperate ones.

Is the usbtinyISP compatible with the Mega 2560 rev 3, did i flash it wrong or do i need something like the USBASP in order to get it to work? I have only 1 arduino so i cant use it as a programmer. I found an article saying it is possible with the usbtinyISP but, i had nothing but problems trying to get it to flash. Please help.ty.

www.codetinkerhack.com/2013/08/enabling-usb-on-arduino-midi-keyboard.html

Memory Error when Running Hiduino in Pro Tools

I have my MEGA2560 configured for Hiduino, and was able to compile it with it's own name. The Hiduino bootloaded Arduino shows up under Devices, and is able to be selected in Pro Tools, and any other software I decide to connect it to.

Right now, Hiduino is not being routed to any software. I can open MIDI-OX or Bome MIDI Translator and route Hiduino in those programs successfully. However, if Pro Tools is open first, I cannot connect Hiduino to MIDI-OX or Bome and receive this error;

"Hiduino: There is not enough memory available for this task. Quit one or more applications to increase available memory, and then try again."

Also, If i connect Hiduino in MIDI-OX or Bome before opening Pro Tools, Pro Tools will not load and crashes (because there isn't enough memory to load??).

I have 64gb of memory in the CPU, more than enough. Pro Tools is using 558,144k of memory. Kind of stumped why this is happening.

arduino_midi not recognized in Windows

I have an arduino mega2560 that I've programmed with hiduino. On the face of it, all works well. On linux kmidimon shows arduino_midi as a device and correctly shows the NoteOn/NoteOff messages I'm sending (this is a Midi output only application).

On Windows, the device shows up in "devices and printers" as an Audio Midi HID device, and Hairless Midi will try to route the output of arduino_midi back to a serial port, showing NoteOn/Note Off mesages if I let it (not that it would be at all useful, but shows that a windows program is able to access the device).

The application I'm trying to use is Hauptwerk. This refuses to recognize the arduino_midi, but shows other USB midi (commercial) devices. I've looked long and hard at device properties, comparing the commercial device and the arduino, and I can't see anything that wouldn't be expected from the two devices not being able to occupy exactly the same spot in the USB hierarchy.

I've been in touch with the Hauptwerk developer, who can't (for fairly obvious reasons) give much practical help debugging the issue. What he did note is that Hauptwerk uses the windows functions midiInGetNumDevs() and midiInGetDevCapsW to enumerate Midi devices present in the system.

Is there any way that you can think of that arduino_midi could be shown as a Midi device in the Windows Control panel and yet not be enumerated by the above two functions ? Other than trying to write a windows app calling those functions, I'm at a loss for ideas. Any ideas helpful. Thanks

Flip: "Address out of range"

I am trying to flash the firmware on my Arduino UNO rev3 using Atmel Flip. Whenever I try and import the .hex file into the program, it throws the error "Address is out of range." I have looked around online and haven't found any solution. Any and all info would be helpful.

Make throws Error 2: clock_div_1 undeclared

Hi! I downloaded the last version yesterday and tried recompiling to rename my device and I had 2 different issues.
I am using windows 7, 64 bit, and "LUFA-140928"

The first one was that I had to erase every other project from the lufa Projects folder, since I was getting an error at Benito.c xD

The second one was with the file "arduino-midi.c"
2015-05-09 10_36_42-new issue ddiakopoulos_hiduino

I got that error on line 74, so I checked and with some search I found this:
http://fab.cba.mit.edu/classes/863.14/people/andrew_mao/week11/

Apparently "clock_div_1" is not defined in avr/power.h for Atmega16u2, so for make to work, and still disable the clock prescaler you need to comment line 74 and add this code:

CLKPR = (1 << CLKPCE);
CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);

That works!

Thx for hiduino guys!

Atmega 16u2, Firmware switchable?

I head some trouble with the firmware.
My UNO board has a atmega 16u2 chip and I use the firmware arduino_midi.hex which seems to work fine.

At first I flashed the usbserial_uno_16u2.hex.
After this it was still recognized as a COM device, but I couldn't upload anymore.
In the readme the possibility of switching between HID<>COM mode is being developed for the 16u2.
Is this the firmware? Which Pin is used for switching?

Arduino UNO is not recognised as USB-MIDI device despite successful flashing

I am able to flash my UNO with arduino_midi.hex using the following command:

avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -c arduinoisp -p m328p -v -Uflash:w:arduino_midi.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U lock:w:0x0F:m

However, when I plug in the Arduino UNO via USB it is not recognised as a MIDI device on OSX. Here's a screenshot from System Information which still shows the name of the device as "Communication Device" rather than "HIDUINO":

screen shot 2015-08-13 at 14 27 23

Here's my equipment:

  • Arduino UNO R3
  • Arduino ISP programmer
  • Arduino IDE 1.6.5
  • CrossPack-AVR-20131216
  • MacBook Pro running OSX 10.10.4

The only strange thing I did spot is that the final output of avrdude is this:

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as 4
avrdude: safemode: Fuses OK (H:04, E:D9, L:FF)

The last line reports "H:04 and E:D9" whereas the 2 previous lines report hfuse=D9 and efuse=4 (the other way round).

Is there a way to verify that the flashing operation completed successfully?

Struggling to compile project

Hi Dimitri,
I am having loads of success using HIDUINO with my diy midi foot controller so thanks a bunch for all your hard work! One issue I can't seem to figure out though is compiling the source in order to change the name... I managed to make successfully using the HIDUINO_MIDI project source under the Experimental dir, putting that in the LUFA101122\Projects dir and typing make at cmd (Win 7 x64). It compiles and I get the resulting hiduino_midi.hex file, but when I flash it to the Arduino Due 16u2 I get random messaged (as opposed to working perfectly with your compile hiduino_midi.hex). I'm sure it's just a dumb mistake but can't figure this one, any ideas? Thanks in advance

MIDI.SendSysEx adds last send type to every 3 bytes

Hello,

First of all thanks for the amazing work!

I'm having problems with sending SysEx messages though. I'm trying to send SysEx from the Arduino using hiduino, but for every 3 bytes, the last sent MIDI signal byte gets added.

My code:

include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

void setup() {
MIDI.turnThruOff();
MIDI.begin();
}

void loop() {
MIDI.sendNoteOff(2,5,6);
byte sysex_message [] = { 0x7D,0x01,0x00,0x12,0x7B,0x22,0x7D,0x5D,0x7D};
MIDI.sendSysEx(sizeof(sysex_message)/sizeof(byte), sysex_message, false);
delay(1000);
}

Using MIDIMonitor, I can see this results in this:
7224485941539 From arduino_midi Note Off 6 85 02 05
7224486192131 From arduino_midi SysEx F0 F7
7224486816029 From arduino_midi Note Off 6 85 7D 01
7224487474300 From arduino_midi Note Off 6 85 00 12
7224488106447 From arduino_midi Note Off 6 85 7B 22
7224488737423 From arduino_midi Note Off 6 85 7D 5D
7224489393674 From arduino_midi Invalid 00 F7

If I change MIDI.sendNoteOff(2,5,6) to MIDI.sendNoteOn(2,5,6), the result is this:

7315676492278 From arduino_midi Note On 6 95 02 05
7315676725341 From arduino_midi SysEx F0 F7
7315677367149 From arduino_midi Note On 6 95 7D 01
7315678008872 From arduino_midi Note On 6 95 00 12
7315678647752 From arduino_midi Note On 6 95 7B 22
7315679315940 From arduino_midi Note On 6 95 7D 5D
7315679923905 From arduino_midi Invalid 00 F7

Now I understood that SysEx is not fully supported (receiving is going fine by the way). But is there any known workaround or fix to this problem?

Thanks in advance!

Yours,

Koen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.