Show Posts
Pages: [1] 2
1  Community / Gigs and Collaborations / Project coding assistance request on: October 11, 2011, 02:48:41 pm
I am a New York City-based composer and sound artist looking for coding assistance for a new interactive art installation I am creating.  I am working with an Arduino Mega board and a Parallax RFID reader.  What I hope to accomplish is to have the Arduino send MIDI
note messages when a RFID card is read.  If you have experience with a similar project or experience coding RFID readers/creating MIDI controllers and are able to help me with the code, please contact me.  Thanks.
2  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 19, 2011, 06:23:14 pm
What are all the parts I will need to build something like your MIDI shield on a breadboard?
3  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 19, 2011, 05:43:14 pm
P.S.  Do you recommend using this?  http://www.sparkfun.com/products/9595
4  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 19, 2011, 05:31:39 pm
Ah!  OK.  Thanks so much!  I ordered the Mega so I will try it out when it comes!
5  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 19, 2011, 05:19:21 pm
Not sure I understand your question: "That is what are you using the real serial ports on and what are you using the software serial ports on?" 

For the MIDI circuit I used the following:
    * Arduino digital pin 1 connected to MIDI jack pin 5
    * MIDI jack pin 2 connected to ground
    * MIDI jack pin 4 connected to +3.3V through 220-ohm resistor (not sure if this is necessary??)

For the RFID reader, the circuit is as follows:
    * Arduino RX to RFID TX
    * Arduino GND to RFID GND
    * Arduino Digital pin 2 to RFID enable
    * Arduino +5V to RFID Vcc pin.

I apologize, I am a beginner at this. :-)  Thanks again for the assistance!
6  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 19, 2011, 04:57:18 pm
For reference of my hardware set up, I used the Parallax tutorial at http://www.arduino.cc/playground/Learning/PRFID and the MIDI tutorial at http://arduino.cc/en/Tutorial/Midi.  The only difference for the MIDI is that since the Parallax RFID reader used the +5v, I used the +3.3V instead and was able to still send MIDI messages separately (since, as you know, you can only run one program at a time on the Ardunio).
7  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 19, 2011, 04:15:42 pm
Any chance you can help me get started on the Arduino code for this?
8  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 19, 2011, 12:17:35 pm
As far as I can tell, the Parallax reader I am using continually sends the tag ID when present in the field.  Though, I wonder if that is really the case or just how I have it set up in the void loop statement.  I have a feeling the delay() might be the way to go.  I will try both out and see what happens.  I think I may be on the right track, although, I still am not clear on setting up the definitions for the RFID tags so that it correlates to the MIDI notes I intend to assign.  Guess it will take some trial and error.  LOL!  Thanks for the help guys!  Any other advice or suggestions is most appreciated.
9  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 19, 2011, 08:28:40 am
Eventually, I would like to create a musical instrument with RFID tags, but for now, I'd be happy sending MIDI notes one at a time to trigger sound samples and audio loops (the MIDI notes that are being sent would be mapped within Ableton Live, by the way).  Would I include definitions for the tags as in the above code that uses piezo sensors or is there a better way to code this?  Thanks!
10  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 18, 2011, 09:40:12 pm
Good point, Mike.  What might you suggest?
11  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 18, 2011, 03:41:22 pm
I was thinking I could use a Master tag that turns MIDI notes off.  Is that possible?
12  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 18, 2011, 12:28:58 pm
I would prefer not to use Processing to send MIDI data.  So here is what I am thinking.  How would I modify the following code for creating a drum controller to use RFID tags instead of piezo sensors?  You mentioned associating a tag with a number and use that number in a Serial.print statement to send it to the MIDI device.  Any chance you could show me how you would do that?

/*
 * MIDI Drum Kit
 * -------------
 * Convert Arduino to a MIDI controller using various inputs and
 * the serial port as a MIDI output.
 *
 * This sketch is set up to send General MIDI (GM) drum notes
 * on MIDI channel 1, but it can be easily reconfigured for other
 * notes and channels
 *
 * It uses switch inputs to send MIDI notes of a fixed velocity with
 * note on time determined by duration of keypress and it uses
 * piezo buzzer elements as inputs to send MIDI notes of a varying velocity
 * & duration, depending on forced of impulse imparted to piezo sensor.
 *
 * To send MIDI, attach a MIDI out jack (female DIN-5) to Arduino.
 * DIN-5 pinout is:                               _____
 *    pin 2 - Gnd                                /     \
 *    pin 4 - 220 ohm resistor to +5V           | 3   1 |  MIDI jack
 *    pin 5 - Arduino D1 (TX)                   |  5 4  |
 *    all other pins - unconnected               \__2__/
 * On my midi jack, the color of the wires for the pins are:
 *   3 = n/c
 *   5 = black  (blue)
 *   2 = red    (red)
 *   4 = orange (yellow)
 *   1 = brown
 *
 * Based off of Tom Igoe's work at:
 *    http://itp.nyu.edu/physcomp/Labs/MIDIOutput
 *
 * Created 25 October 2006
 * copyleft 2006 Tod E. Kurt <tod@todbot.com
 * http://todbot.com/
 *
 * Updates:
 * - 2 May 2009 - fixed noteOn() and noteOff()
 *
 */

// what midi channel we're sending on
// ranges from 0-15
#define drumchan           1

// general midi drum notes
#define note_bassdrum     35
#define note_snaredrum    38
#define note_hihatclosed  42
#define note_hihatopen    44
#define note_crash        49

// define the pins we use
#define switchAPin 7
#define switchBPin 6
#define switchCPin 5
#define piezoAPin  0
#define piezoBPin  1
#define ledPin     13  // for midi out status

// analog threshold for piezo sensing
#define PIEZOTHRESHOLD 100

int switchAState = LOW;
int switchBState = LOW;
int switchCState = LOW;
int currentSwitchState = LOW;

int val,t;

void setup() {
  pinMode(switchAPin, INPUT);
  pinMode(switchBPin, INPUT);
  pinMode(switchCPin, INPUT);
  digitalWrite(switchAPin, HIGH);  // turn on internal pullup
  digitalWrite(switchBPin, HIGH);  // turn on internal pullup
  digitalWrite(switchCPin, HIGH);  // turn on internal pullup

  pinMode(ledPin, OUTPUT);
  Serial.begin(31250);   // set MIDI baud rate
}

void loop() {
  // deal with switchA
  currentSwitchState = digitalRead(switchAPin);
  if( currentSwitchState == LOW && switchAState == HIGH ) // push
    noteOn(drumchan,  note_bassdrum, 100);
  if( currentSwitchState == HIGH && switchAState == LOW ) // release
    noteOff(drumchan, note_bassdrum, 0);
  switchAState = currentSwitchState;

  // deal with switchB
  currentSwitchState = digitalRead(switchBPin);
  if( currentSwitchState == LOW && switchBState == HIGH ) // push
    noteOn(drumchan,  note_snaredrum, 100);
  if( currentSwitchState == HIGH && switchBState == LOW ) // release
    noteOff(drumchan, note_snaredrum, 0);
  switchBState = currentSwitchState;

  // deal with switchC
  currentSwitchState = digitalRead(switchCPin);
  if( currentSwitchState == LOW && switchCState == HIGH ) // push
    noteOn(drumchan,  note_hihatclosed, 100);
  if( currentSwitchState == HIGH && switchCState == LOW ) // release
    noteOff(drumchan, note_hihatclosed, 0);
  switchCState = currentSwitchState;

  // deal with first piezo, this is kind of a hack
  val = analogRead(piezoAPin);
  if( val >= PIEZOTHRESHOLD ) {
    t=0;
    while(analogRead(piezoAPin) >= PIEZOTHRESHOLD/2) {
      t++;
    }
    noteOn(drumchan,note_hihatopen, t*2);
    delay(t);
    noteOff(drumchan,note_hihatopen,0);
  }

  // deal with second piezos, this is kind of a hack
  val = analogRead(piezoBPin);
  if( val >= PIEZOTHRESHOLD ) {
    t=0;
    while(analogRead(piezoBPin) >= PIEZOTHRESHOLD/2) {
      t++;
    }
    noteOn(drumchan,note_crash, t*2);
    delay(t);
    noteOff(drumchan,note_crash,0);
  }
}

// Send a MIDI note-on message.  Like pressing a piano key
// channel ranges from 0-15
void noteOn(byte channel, byte note, byte velocity) {
  midiMsg( (0x90 | channel), note, velocity);
}

// Send a MIDI note-off message.  Like releasing a piano key
void noteOff(byte channel, byte note, byte velocity) {
  midiMsg( (0x80 | channel), note, velocity);
}

// Send a general MIDI message
void midiMsg(byte cmd, byte data1, byte data2) {
  digitalWrite(ledPin,HIGH);  // indicate we're sending MIDI data
  Serial.print(cmd, BYTE);
  Serial.print(data1, BYTE);
  Serial.print(data2, BYTE);
  digitalWrite(ledPin,LOW);
}
13  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 17, 2011, 09:21:18 pm
I am starting to think I might need a MIDI shield.  Is that correct or am I over thinking this?  LOL!
14  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 14, 2011, 03:42:56 pm
When you say: "Yes it is very simple, just associate a tag with a number and use that number in a Serial.print statement to send it to the MIDI device," I understand the theory behind it, but with very little programming experience, are there any sketch examples close to or similar to what I am trying to do that I could employ?  Thanks for your assistance!
15  Using Arduino / Programming Questions / Re: Converting RFID signal to MIDI on: June 14, 2011, 11:00:53 am
Thank you for the reply!  Do you know of any sample code I could look at for a frame of reference?  Thanks.
Pages: [1] 2