페이지 정보작성자 키트 작성일2017-09-11 16:33 조회909회 댓글0건
I was looking for an USB MIDI controller device (or interface) for music applications like piano or organ keyboard or pedalboard. After some research, I wanted to go to a more "homemade" solution. My choice has finally been oriented to a microcontroller board development like the Arduino boards and I choose a Teensy Development Board as it can natively use an USB MIDI library (teensy web site).
It was very useful to make some tests with MIDI softwares and write some MIDI "hello world" software (via some sketches of the arduino IDE). But as I want to keep board "free" and I don't want to sacrifice it in a permanant device, I looked into a cheaper solution.
- make it cheap / low cost
- with the easier architecture possible (only one MCU)
- can communicate through the USB port directly (whithout a MIDI-to-USB conversion step)
- recognise by a Computer as a stand alone MIDI device
- easy to build (at worst, a soldering iron)
- powered by the USB port with no external power source
It looks like an Arduino on a Breadboard based on an Atmega328p MCU (atmel site), communicate directly through the USB port thanks to the V-USB software-only implementation (V-USB site), and cost only about 8€ (10$) to build (for electronical components)Step 1: Architecture / Principe
The device has no aditionnal chip and communicate directly through the USB port.
I use the analogic/digital inputs to generate events. The management of these events and the conversion in the USB MIDI messages are treated by the software embed in the Atmega MCU.
Step 2: My own AVR USB Device
My kit is based on the USnooBie development Kit (USnooBie):
“The USnooBie is a microcontroller kit that does not require any sort of AVR programmer or USB-to-serial converters to load and run compiled code. It's hardware design allows the user to develop low cost USB devices with Atmel's AVR ATmega microcontrollers. It can also be used to develop projects which are not USB devices. It is even compatible with Arduino.”
I have adapted the schematics and remove the voltage regulator and kept only the zener diodes to limit the D+ and D- voltage (see the schematics image). All these specifications are detailed on the V-USB Obdev site (V-USB Obdev)
The needed components are the following:
- 1x Atmega328p
- 1x USB connector
- 1x 12MHz crystal
- 2x 3.6V zener diode
- 2x 22pF ceramic capacitor
- 1x 100nF ceramic capacitor
- 1x 4.7μF electrolytic capacitor
- 1x 1.5kΩ resistor
- 2x 68Ω resistor
- 2x mini push button switch
The first success step is to turn the device in the USBasp mode by activating the bootloader.
The use of the bootloader is not mandatory but it is very useful as il allows to flash the future SW directly through the USB port (FTDI or AVR Programmer are not needed any more)
Step 3: Programming the midi Software
The bootloader mode allows to consider the device as an USBasp programmer. In this mode, you are able to upload softwares directly to the MCU without an extra FTDI or Programmer. This mode is also compatible with the Arduino IDE (exemple).
In my case, I didn't succeed to use directly any MIDI library with Arduino IDE sketches, so I came through a more basic way (with AVRdude command lines) and I was inspired by 2 work:
- Atmel Attiny45 / Attiny85 based USB MIDI controller by Thorsten
- V-USB-MIDI project by Martin Homuth-Rosemann
I made some modifications in the C code to make it compatible with the Atmega328 MCU (pin numbers, analogic/numeric - input/output, etc.) and the USnooBie configuration (mainly the D+ and D- pin assignment).
Once the USB divice is reseted, it is recognized as an Audio Device.
Step 4: The result
You can see the result in this short video.
The device is recognized as a MIDI controller.
In my case, I assigned it to a Piano keyboard and I send “Note On” and “Note Off” MIDI message by pressing and releasing some switches.
등록된 댓글이 없습니다.