Society of Robots - Robot Forum

Software => Software => Topic started by: artistinfla on August 21, 2017, 10:52:58 AM

Title: MIDI Conrolled Animatronic project
Post by: artistinfla on August 21, 2017, 10:52:58 AM
I am planning on using a 16 track MIDI controller to save and send wave files with PWM data which can be converted and sent to a PWM amplifier to drive the servos. 

Can I save PWM data on a wave file?

I was reading that I could use Audacity with the PWM plugin to generate these files.  I am not well-versed in WAV files and could use some help.  Having the midi controller would allow me to sync movement to music and sound.

Has anyone done this or know how it could be done. 

I have 11 servos to control.

Mark
Title: Re: MIDI Conrolled Animatronic project
Post by: Doug83 on August 21, 2017, 01:34:54 PM
I'm not sure what you mean by "saving wav files with PWM data".
(-and I thought a MIDI source would only send MIDI files? but anyway-)

There is already a lot of guides online that allow you to connect an Arduino to a MIDI output, and then have the arduino control LEDs in response to MIDI signals fed to the Arduino.
So you could just use plain MIDI files to do it.

https://www.google.com/search?q=arduino+midi+control+leds
Title: Re: MIDI Conrolled Animatronic project
Post by: Doug83 on August 22, 2017, 12:56:08 PM
It might help to know your level of experience with building electronics.

If you don't have any experience with DIY electronics--then this may seem like it's complicated, but it really isn't difficult to do.

This page describes a project to use MIDI signals sent to an Arduino to turn LEDs on:
http://forum.arduino.cc/index.php?topic=189597.0
The way they are turning a LED on and off is almost the same as what you would do to make a servo move.

To keep this as simple to do you would want a board that has enough PWM output pins (each PWM pin can operate 1 servo).
An Arduino Uno only has 6 PWM outputs so that's not enough.
An Arduino Mega costs more but already has 15 PWM outputs, so it could run as many servos as you wanted, directly.
This isn't the cheapest way to do it, but it is the easiest way.

The MIDI jack connects to the Arduino with only 3 wires and a couple resistors.
Each servo has two power wires that connect to 5v DC and 1 signal wire, that connects to a pin on the Arduino Mega.
You would want a power supply at least 7 volts for the Arduino board, and you would need a 5v power supply for the servos. There is different ways of doing that.

The Arduino sketch you may not know how to write, but if you get the hardware connected, people online will help with writing the sketch.

You would need a soldering iron and solder, and a multimeter.
A cheap soldering iron will probably work well enough.
Any cheap multimeter will work, it doesn't need to be expensive.

What it will cost depends on what country you are in, and how cheap you can obtain the parts.