Help with Accelerometer (ADXL3xx) and MIDI

so I'm using the ADXL3 and trying to get it to read midi. I've actually had this working in the past with this code, but it's not working anymore and I'm not sure why. I've attached a midi jack's a 220Ohm resistor to MIDI pin 4, ground to MIDI pin 2 and 5V to MIDI pin 5. Like this instructions

I'm using hairless midi and keep getting the error: Warning: got a status byte when were expecting 1 more data types, sending possible incomplete midi messages. I actually gotten this error in the past, but I dont know how i got rid of it.

I have my MIDI out to my Midi man port A with a baud rate of 115200. Is this suppose to be 9600? I forget. Thanks

 Reads an Analog Devices ADXL3xx accelerometer and communicates the
 acceleration to the computer.  The pins used are designed to be easily
 compatible with the breakout boards from Sparkfun, available from:

 The circuit:
 analog 0: accelerometer self test
 analog 1: z-axis
 analog 2: y-axis
 analog 3: x-axis
 analog 4: ground
 analog 5: vcc
 created 2 Jul 2008
 by David A. Mellis
 modified 30 Aug 2011
 by Tom Igoe 
 This example code is in the public domain.


int control = 176; //10110000 in binary
int controller = 43;
int control2 = 176; //10110001 in binary
int controller2 = 42;
int control3 = 176; //10110001 in binary
int controller3 = 41;

// these constants describe the pins. They won't change:
const int groundpin = 18;             // analog input pin 4 -- ground
const int powerpin = 19;              // analog input pin 5 -- voltage
const int xpin = A3;                  // x-axis of the accelerometer
const int ypin = A2;                  // y-axis
const int zpin = A1;                  // z-axis (only on 3-axis models)

void setup()
  // initialize the serial communications:
  // Provide ground and power by using the analog inputs as normal
  // digital pins.  This makes it possible to directly connect the
  // breakout board to the Arduino.  If you use the normal 5V and
  // GND pins on the Arduino, you can remove these lines.
  pinMode(groundpin, OUTPUT);
  pinMode(powerpin, OUTPUT);
  digitalWrite(groundpin, LOW); 
  digitalWrite(powerpin, HIGH);

void loop()
 int x = analogRead(xpin);
  // print the sensor values:

  int value = map(x,480,530,0,127);
  MIDImessage(control, controller, value);//turn note on
 int y = analogRead(ypin);
  // print the sensor values:
  int value2 = map(y,479,531,0,127);  
  /MIDImessage(control2, controller2, value2);//turn note on
   int z = analogRead(zpin);
  // print the sensor values:
    int value3 = map(z,478,532,0,127);  
  MIDImessage(control3, controller3, value3);//turn note on

//send MIDI message
void MIDImessage(int command, int MIDInote, int MIDIvelocity) {
  Serial.write(command);//send note on or note off command 
  Serial.write(MIDInote);//send pitch data
  Serial.write(MIDIvelocity);//send velocity data

I have my MIDI out to my Midi man port A with a baud rate of 115200. Is this suppose to be 9600?

No it is what ever you set it to in the sketch must be set in Hairless.

At the moment it is set to:-


31250 Baud.

The two speeds must match so make it 115200 Baud, not 31250 Baud.

Thanks Grumpy_Mike! That fixed the error in MIDI Hairless. Okay we are getting somewhere.

I however still am not able to get the data to read as a midi note. Ableton live and other programs are noting seeing any notes being triggered. Not sure exactly how to set it up in Live so I just turned track remote and sync on on both everything. Also is it midi suppose to be on input or output? I have it on output rn, but have checked both.

Be aware that instructables are, by and large, crap. That links you posted will not work for me so I can’t make comments. However the really wording bit is the suggestion you are using Arduino’s output pins as power and ground.

Can you post a schematic of your circuit, not a Fritzing piece of crap but a schematic, pencil and paper is fine.

As a test change your loop function to send out a note, just like the standard blink program. Then we might be able to separate problems between your Arduino and the setup of Live.

Okay Cool Thanks, Maybe the midi connector is messed up? Also i fixed the link

Thanks for the schematic. One thing greatly puzzles me. If you are using Hairless then why are you taking the Arduino's output and converting it into a 5 pin DIN MIDI output and then through a MIDI / USB adapter into your Mac?

You should be doing ONLY one of the following:-

  1. Remove DIN socket and USB/MIDI adapter and connect the Arduino's USB to the Mac's USB, then look for Hairless in Live.

  2. Remove Hairless, set your Arduino's serial output to 31250 Baud and look for the USB/MIDI adapter in Live.