Skip to content

Latest commit

 

History

History
80 lines (49 loc) · 4.64 KB

File metadata and controls

80 lines (49 loc) · 4.64 KB

Arduino-MIDI-Stepper-Motor-Instrument

This is an Arduino Project that uses A4988 stepper drivers with bipolar stepper motors along with the MIDI library to create sound.

Link to my Project on the Arduino Website HERE

UPDATE: I am working on a new version of the MIDI Stepper Synth that uses an FPGA, Custom PCBs and 32 Stepper Motors. Link HERE

Hardware:

  • Any Arduino board (Uno, Mega, Micro, Mini, etc)
  • NEMA 17 Stepper Motor or similar
  • A4988 Stepper Driver

I used an Arduino CNC Shield to control the stepper motors, so the code is preset for that pinout.

How to use:

Make sure you have the MIDI Arduino library installed in your IDE.

The Arduino code is designed so that it can expand to handle as many stepper motors as you need. I have put instructions on how to configure the code in the ino file.

You might want to use the TuneStepper code to check for your motor's resonant frequency (which will sound bad). For me, the notes that were around the resonant frequency were E3, F3, and F#3.

I have also put plenty of comments in the source code so that you can easily understand the code and what it does.

MIDI Communication

There are a few ways to communicate with the Arduino to send MIDI Data. You can:

USB MIDI Setup

If you want to configure your Arduino to be a USB MIDI Device, we need to change the firmware on the AVR chip. This chip's job is to convert the USB communication to serial data that the processor (the ATMEGA328 chip on an UNO). To make the computer see it as a MIDI device, we simply put a different firmware on the chip. I am using a custom compiled firmware called mocuLUFA that allows a dual boot option depending on the presense of a jumper on the ISCP header. One of the drawbacks of changing a firmware on the AVR chip is that you loose the ability to reprogram the 328 chip through the Arduino IDE. This method fixes that problem. So how do we do it?

  1. You will need to install the Atmel FLIP software

  2. Get the "midi_stepper.hex" file from the LUFA directory above. (or make your own custom hex file HERE)

  3. Open up both Atmel FLIP and the Device Manager

  4. Plug in the Arduino. It should appear on a COM port.

  5. Check your Arduino to see if you have an 8U2 or 16U2 chip. It is located here:

ad_layout 6. Put your Arduino in DFU Mode by briefly shorting the reset and ground pins, as shown in the picture:

ad_dfu The Arduino should then disappear from the device manager and appear as an unknown device.

  1. Right click on the unknown device in the device manager and choose "update driver". Specify the path to the driver, which is by default "C:/Program Files (x86)/Atmel/Flip x.x.x/usb" and be sure that "include subdirectory" is checked. After doing so, the device should rename to 8U2 or 16U2 in the device manager.

  2. in Atmel FLIP, go to "Device > Select" and choose the matching chip ("Atmega16U2" or "Atmega8U2")

  3. Go to "Settings > Communication > USB" then click "Open"

  4. Go to "File > Load HEX File" and choose the correct Hex file.

  5. Click "Run" and it should load the new code.

  6. Unplug and re plug in the Arduino and it should appear as "Midi Stepper" in the device manager.

If you want to enter USB Serial Mode, connect a jumper (while off) to the Arduino as follows:

ad_usbser And now it will act like an ordinary Arduino.

Changes

2-apr-2021
  1. Renamed folders

  2. changed containing folders to match the .ino file

  3. Comments inserted where needed