Instructables
loading
loading
Picture of Sugarcube MIDI Controller
IMG_0286 copy copy.jpg
IMG_0279 copy copy.jpg
IMG_0273 copy copy copy.jpg

This project is a portable, Arduino-powered, grid-based MIDI controller that boots up into a variety of apps to do lots of things with sound. It has 16 backlit buttons, used as both inputs and outputs to give the controller some visual feedback. 2 potentiometers give analog control, depending on the app the pots are assigned to tempo, MIDI velocity, pitch, and scrolling (making the avaible grid space larger than 4x4). An x/y accelerometer and an x/y gyroscope add some playful, gestural control to the device; most of the apps implement a "shake to erase" control and several respond to tilt in various ways. It boots up into 7 different apps (described below), though it has the potential to boot up into 16 total. This device is primarily a MIDI controller, but I've also written an app that allows you to pull the button and analog data into MaxMSP and to control audio.

This controller was inspired by both the monome and tenori-on. When I was in college, I built a large touchscreen display, based on the Arduinome monome-Arduino clone schematics and code, that worked with all the open source monome applications written in MaxMSP. There are a ton of people building their own monome-type devices using these buttons from Sparkfun and the Arduinome code, as well as a few variations on the theme. With this project, I was interested in making a device that was a little more self-contained and relatively cheap to make (lots of buttons = lots of $). In keeping more with the concept of the tenori-on, this controller does all its app processing itself, it does not rely on a computer to process button presses/analog controls into MIDI. This means you can plug it directly into a synth or any device that understands MIDI and you're good to go, no computer required. It runs off a beefy LiPo battery that keeps it running for days on a charge, so it's fairly portable as well. In keeping with the monome side of things, it's totally open source and can be adapted to your particular audio setup/needs. All the Arduino code is up on github (click the cloud-shaped button to download), along with a MaxMSP patch that decodes data from the controller into something usable in Max.

An overview of the apps I've written so far:

Pixel Tilt - One pixel moves across a 2D keyboard with tilt, triggering MIDI as it moves. Control velocity and basenote with pots.

Flin - Music Box app based on monome. Speed and velocity of notes controlled by y tilt. Paging across 16 "lanes" with pot. Shake to erase.

Serial Communication with MaxMSP - Pull data from buttons and analog controls into MaxMSP and use Max to send LED states. Supports 5 bit analog controls for x/y accelerometer and 2 pots. This is great if you want to run audio processing applications with the controller. Download SerialDemo app (SerialDemo.maxpat, included with the Arduino files, click the cloud-shaped button here) to parse data in Max. Beat slicer (shown above) app is included with the Arduino files as well.

Arpeggiator - Plays a two, three, or four note arpeggio, similar to this app I wrote for monome. One pot controls the speed of the arpeggio, another controls velocity. Notes within the arpeggio can be shifted up or down by one semitone via button controls. The whole arpeggio is transposed via x tilt. Press the leftmost note in the arpeggio to play the notes in ascending order, press the rightmost note in the arpeggio to play the notes in descending order, and press a middle note in the arpeggio to play the notes in a random order. Shake to erase.

Boiing - Bouncing pixels that generate polyrhythms, based on this tenori-on app. Bounce direction based on y tilt. Speed and MIDI velocity (loudness) controlled by pots. Shake to erase.

Step Sequencer - Four note 16 step sequencer. Pots control tempo and paging across sequence. Shake to erase.

MIDI Keyboard - Simple MIDI keypad. Control velocity and basenote with pots, pitchbend with x tilt.

Parts List:

SPARKFUN:
(1x) Button Pad 4x4 - LED Compatible Sparkfun COM-07835
(1x) Button Pad 4x4 - Breakout PCB Sparkfun COM-08033
(1x) Arduino Uno Sparkfun DEV-11021
(1x) Accelerometer/Gyro 5 Degrees of Freedom Sparkfun SEN-11072
I put a 3-axis accelerometer and 2 axis gyroscope in this controller to give it some gestural control, but so far I haven't actually used the gyro in any apps, and I've only got the x and y axis of the accelerometer wired up. That means you could sub in a simpler/cheaper part like this.

DIGIKEY:
(16x) White 5mm LED (3mm is fine too) Digikey C513A-WSN-CV0Y0151-ND
(2x) 74HC595 shift register Digikey 296-1600-5-ND
(1x) 74HC165 shift register Digikey 296-8251-5-ND
(3x) 16 pin IC socket Digikey A100206-ND
(16x) 1N4148 Diode Digikey 1N4148FS-ND
(4x) current limiting resistors (value will depend on LEDs, sample calculation included in step 5)
(4x) 10kOhm 1/4watt resistors Digikey CF14JT10K0CT-ND
(1x) 220Ohm 1/4watt resistor Digikey CF14JT220RCT-ND
(1x) 5-Pin MIDI Jack Digikey CP-2350-ND (optional - explained in step 27)
(1x) USB type B female jack Digikey 732-2734-ND (optional - explained in step 27)
(2x) 10kOhm linear taper potentiometer Digikey 987-1308-ND

JAMECO:
(1x) 16 conductor ribbon cable Jameco 28RC16-10VP
(1x) 16 pin right angle connector Jameco 746285-3
(6x) male header pins Jameco 103393

RADIOSHACK:
(1x) Midi Cable Radioshack 42-2149 (optional - explained in step 27)
(1x) Size N Panel-Mount Coaxial DC Power Jack with switch Radioshack 274-1576
(1x) Size N Coaxial DC Power Plug Radioshack 274-1573
(1x) SPST Toggle Switch Radioshack 275-634

AMAZON:
(1x) Li-Ion 7.4V Tenergy 2200mAh Rechargeable Battery module with PCB Amazon
(1x) Tenergy Universal Smart Charger for Li-Ion/Polymer battery Pack (3.7V-14.8V 1-4 cells) Amazon
(1x) MIDI to USB cable Amazon (optional - explained in step 27)

NEWARK:
(2x) Aluminum knobs Newark 74M6717

ADDITIONAL MATERIALS:
22 Gauge Wire, various colors Jameco #9313-0-R
electrical tape Radioshack 64-2373
wire cutters
wire strippers
solder
wood/acrylic/project enclosure (I used this 6"x6"x2" bamboo box The Container Store)
glue/epoxy
double sided foam tape Amazon

 
Remove these adsRemove these ads by Signing Up
1-40 of 105Next »

I really like it.. Well done

Really mind blowing

adamrussell22 days ago

This is amazing

denniscook25 days ago

Fantastic, it works beautifully

kierondeane1 month ago

Hi Amanda is there a way to adapt the button test code to print the button presses straight to the serial monitor. im trying to encorporate part of the code into a bigger patch.

markkuki made it!1 month ago

My version of a Arduino SugarCube based on this instructable. Mine has 4 pots, no gyroscope, no accelerometer, no battery power, just a MIDI controller for my project studio. I edited all the code to suit my own basic needs, uploaded the firmware and everything it works great! Thanks Amanda! :)

WP_20150402_21_32_31_Pro.jpg
kierondeane3 months ago

hi i have completed this build but am getting this error when uploading the final code.


This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.

Arduino: 1.0.6 (Mac OS X), Board: "Arduino Uno"

sugarcube/SugarCube.cpp.o: In function `SugarCube':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:13: multiple definition of `SugarCube::SugarCube()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:13: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:13: multiple definition of `SugarCube::SugarCube()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:13: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::timer1Setup()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:77: multiple definition of `SugarCube::timer1Setup()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:77: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::timer2Setup()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:99: multiple definition of `SugarCube::timer2Setup()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:99: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setDefaultPinConnections()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:121: multiple definition of `SugarCube::setDefaultPinConnections()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:121: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setLedLatchPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:137: multiple definition of `SugarCube::setLedLatchPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:137: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setLedClockPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:144: multiple definition of `SugarCube::setLedClockPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:144: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setLedDataPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:149: multiple definition of `SugarCube::setLedDataPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:149: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setButtonLatchPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:154: multiple definition of `SugarCube::setButtonLatchPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:154: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setButtonClockPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:159: multiple definition of `SugarCube::setButtonClockPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:159: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setButtonDataPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:164: multiple definition of `SugarCube::setButtonDataPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:164: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setXAccPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:169: multiple definition of `SugarCube::setXAccPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:169: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setYAccPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:174: multiple definition of `SugarCube::setYAccPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:174: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setPot1Pin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:179: multiple definition of `SugarCube::setPot1Pin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:179: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setPot2Pin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:184: multiple definition of `SugarCube::setPot2Pin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:184: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setXGyroPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:189: multiple definition of `SugarCube::setXGyroPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:189: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setYGyroPin(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:194: multiple definition of `SugarCube::setYGyroPin(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:194: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getStateOfButton(unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:239: multiple definition of `SugarCube::getStateOfButton(unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:239: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getStateOfButtonRow(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:247: multiple definition of `SugarCube::getStateOfButtonRow(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:247: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getXAxisGyroVal()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:321: multiple definition of `SugarCube::getXAxisGyroVal()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:321: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getYAxisGyroVal()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:326: multiple definition of `SugarCube::getYAxisGyroVal()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:326: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getPot1Val()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:331: multiple definition of `SugarCube::getPot1Val()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:331: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getPot2Val()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:336: multiple definition of `SugarCube::getPot2Val()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:336: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::turnOnLED(unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:347: multiple definition of `SugarCube::turnOnLED(unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:347: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::turnOffLED(unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:352: multiple definition of `SugarCube::turnOffLED(unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:352: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setLEDState(unsigned char, unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:355: multiple definition of `SugarCube::setLEDState(unsigned char, unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:355: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setLEDsByArray(unsigned char*)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:364: multiple definition of `SugarCube::setLEDsByArray(unsigned char*)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:364: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setLEDRow(unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:397: multiple definition of `SugarCube::setLEDRow(unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:397: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::turnOnLED(unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:402: multiple definition of `SugarCube::setLEDCol(unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:402: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::clearLEDs()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:410: multiple definition of `SugarCube::clearLEDs()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:410: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::buttonCheck(unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:494: multiple definition of `SugarCube::buttonCheck(unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:494: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setXGyro(int)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:583: multiple definition of `SugarCube::setXGyro(int)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:583: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setYGyro(int)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:591: multiple definition of `SugarCube::setYGyro(int)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:591: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setPot1(int)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:599: multiple definition of `SugarCube::setPot1(int)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:599: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setPot2(int)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:607: multiple definition of `SugarCube::setPot2(int)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:607: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::checkForShake()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:615: multiple definition of `SugarCube::checkForShake()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:615: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setDelegate(Delegate*)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:727: multiple definition of `SugarCube::setDelegate(Delegate*)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:727: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::timer2Routine()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:704: multiple definition of `SugarCube::timer2Routine()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:704: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setupSerialCommunication()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:679: multiple definition of `SugarCube::setupSerialCommunication()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:679: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setupMIDICommunication()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:645: multiple definition of `SugarCube::setupMIDICommunication()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:645: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::sendMIDI(unsigned char, unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:666: multiple definition of `SugarCube::sendMIDI(unsigned char, unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:666: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::pitchBend(unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:661: multiple definition of `SugarCube::pitchBend(unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:661: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::noteOff(unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:656: multiple definition of `SugarCube::noteOff(unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:656: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::noteOn(unsigned char, unsigned char, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:651: multiple definition of `SugarCube::noteOn(unsigned char, unsigned char, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:651: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::scaleAcc(int)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:577: multiple definition of `SugarCube::scaleAcc(int)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:577: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setYAcc(int)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:566: multiple definition of `SugarCube::setYAcc(int)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:566: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setXAcc(int)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:555: multiple definition of `SugarCube::setXAcc(int)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:555: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getYAxisAccVal()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:316: multiple definition of `SugarCube::getYAxisAccVal()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:316: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getXAxisAccVal()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:311: multiple definition of `SugarCube::getXAxisAccVal()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:311: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::analogValFromPin(unsigned char, int)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:546: multiple definition of `SugarCube::analogValFromPin(unsigned char, int)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:546: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::checkAnalogPins()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:535: multiple definition of `SugarCube::checkAnalogPins()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:535: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::initAnalogPins()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:525: multiple definition of `SugarCube::initAnalogPins()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:525: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setLEDsByBitmap(unsigned char*, unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:377: multiple definition of `SugarCube::setLEDsByBitmap(unsigned char*, unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:377: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::numPressedButtons(unsigned char*)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:283: multiple definition of `SugarCube::numPressedButtons(unsigned char*)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:283: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getPressedButtons(unsigned char (*) [2])':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:265: multiple definition of `SugarCube::getPressedButtons(unsigned char (*) [2])'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:265: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getStateOfButtonCol(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:252: multiple definition of `SugarCube::getStateOfButtonCol(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:252: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::shift(unsigned char)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:421: multiple definition of `SugarCube::shift(unsigned char)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:421: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::timer1Routine()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:690: multiple definition of `SugarCube::timer1Routine()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:690: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getButtonStatesBitmap(unsigned char, unsigned char*)':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:217: multiple definition of `SugarCube::getButtonStatesBitmap(unsigned char, unsigned char*)'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:217: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::getButtonStatesArray(unsigned char (*) [4])':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:201: multiple definition of `SugarCube::getButtonStatesArray(unsigned char (*) [4])'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:201: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::setupInputsAndOutputs()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:55: multiple definition of `SugarCube::setupInputsAndOutputs()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:55: first defined here

sugarcube/SugarCube.cpp.o: In function `SugarCube::init()':

/Users/kierondeane/Documents/Arduino/libraries/sugarcube/SugarCube.cpp:39: multiple definition of `SugarCube::init()'

sketch_feb23a.cpp.o:/Applications/sketch_feb23a.ino:39: first defined here

core.a(main.cpp.o): In function `main':

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:40: undefined reference to `setup'

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:43: undefined reference to `loop'


any help would be greatly appreciated

amandaghassaei (author)  kierondeane2 months ago

maybe try a fresh download? what version of arduino are you using?

im using the newest version of the arduino ide and arduino uno. all test codes such as buttons and led test code works the rest get this same error

amandaghassaei (author)  kierondeane2 months ago

I think maybe you put the folder in Arduino/libraries? you don't actually have to do that, you can just download the zip from github, unzip, change the folder name to "SugarCubeLibraryFiles" and then open the SugarCubeLibraryFiles.ino file inside.

I tested it on the latest version of arduino, should work. Jut make sure you have the right board selected.

Sorry if that was confusing!

markkuki5 months ago

Hello again! :) Had to take a long break from this due to other school work keeping me busy. Ok, I re-read steps 19-24 with your updated notes taken into account. The "Test Buttons" arduino code when run on my build results in the following inverted behavior: all the LEDs are lit up after uploading the code and while pressing a button each LED momentarily turns off (i.e. when pressed) and is lit back up after release of button. I don't know why this is and I have allegedly checked all my other connections to the best of my ability that is.... :( P.S. Note, Step 18: Test LEDs code is working as it should = OK. I went all the way back to re-trace the steps 1 thru 24 documentation to see what I might have done wrong.

WP_20141208_03_33_26_Pro.jpg
amandaghassaei (author)  markkuki5 months ago

did you work this out? sounds like the leds are fine but something is up with the button wiring. Are the diodes in the right direction?

Does are in the right direction, yes. Still having this issue, and yes something is wrong with the button wiring. any suggestions?

amandaghassaei (author)  markkuki4 months ago

are the pull down resistors there? can you attach a clear pic of what you've got? and you're running the code from step 24?

Yes, running the code from step 24. All the buttons respond (more or less) there is just inverted operation of the buttons compared to that of your implementation (is really the only difference I can tell). Here are some more pics.

Note, I burned some of the traces from the PCB board so I had to create a jump lead for one of the 8 group of header pins that connect to the ribbon clamp.

I fear the only thing there is left to do is to re-do the 8 header pins and resistors because they are a mess. As you mentioned to me a while ago, the DIPs are pretty resilient and should be okay so I keep looking at the 8 header pins as the source of this glitch.

The discoloration of the solder came from earlier cleaning during troubleshooting because I didn't use distilled water (I think). Disregard the scratches, I used a stanley knife to make sure none of the globbed solder points were touching each other on the edges.

Also note, I do have a protoboard in case it might help to re-build a sub-circuit or two on that first before going back to soldering again. Also, I'm getting a new solder because the one a bought is too hot and cannot be adjusted.

Any help would be greatly appreciated. I just hope I don't have to start from scratch because this project was expensive.

WP_20150123_05_58_22_Pro.jpgWP_20150123_05_58_48_Pro.jpgWP_20150123_05_59_04_Pro.jpgWP_20150123_05_59_43_Pro.jpg
amandaghassaei (author)  markkuki4 months ago

Do you have a multimeter? what's the voltage at the swt-gnd pins when no buttons are pressed?

I got 4.904 Volts when no buttons are pressed, I measured from the 5V arduino pin with the red probe to the swt-gin pins (pull down resistors going to arduino gnd) with the black probe. Those are points.

Could you perhaps give me an example value of what I should be getting and a point in the circuit unrelated to my problem. This would give me more confidence in my measurements. Thanks! :)

markkuki markkuki2 months ago

Update, I completely rebuilt the header pin section with all the resistors and everything for the ribbon cable that goes to the Sparkfun buttonPad. Still same result, "Test LED" code works perfectly but inverted behavior of the Buttons (they are all light up as soon as I upload your "Test Buttons" code and if I press the button the led shuts off when pressed & lights back up as soon as button is released). Should I check anything with the digital pins at the arduino or the HC195 connections?

markkuki markkuki2 months ago

and I tested the buttons with the pushbutton mini circuit and code that is lighting up the LED 13 embedded on the Arduino board. Result = all OK :)

After doing more research, the pull down resistors are behaving like pull up resistors on the switches but I just need help or need to do more research on the pins of the shift registers and arduino digital pins in order to finally isolate the problem.

WP_20150228_01_41_50_Pro.jpg
markkuki markkuki2 months ago

Victory! :) I finally figured it out! On my own, which is obviously the most rewarding way! Anyone else reading this & waiting for a reply from Amanda it might take a while because she went back to school and her studies are taking up a lot of her time and if I understand it correctly she no longer works at Instructables... source re: her website.

amandaghassaei (author)  markkuki2 months ago

great! sorry I couldn't help more what was the problem? Should I change something in the instructable?

No worries at all, I think your instructable is fine. This was my mistake all along. At the header pins I dragged the solder over too much over the pull down resistors (for the l.e.d GND) and then proceeded to make a carbon copy of the same mistake when I rebuilt the header pins on solder and retry. To troubleshoot, I rebuilt the entire circuit on breadboard to be able to make fast changes and disconnect pins at will. Now, I just have to manage to re-solder correctly without burning off any traces otherwise I have to re-do the header pin section one more time (no biggie, whatever it takes). Thanks Amanda for the help thus far, I think soon I will be able to complete the project and your help has been appreciated along the way. Cheers for that and congrats on getting into MIT (I read this on your website or somewhere it was written I'm pretty sure). :)

victory_for_now.png
amandaghassaei (author)  markkuki2 months ago

thanks! keep me posted on your build

liampower7 months ago

I've gotten an adafruit trellis button pad and controller (https://learn.adafruit.com/adafruit-trellis-diy-open-source-led-keypad/overview) which interfaces with the arduino through an on board chip multiplexer, communicating through the i2c protocol. How would I go about converting the sugarcube firmware to work with the adafruit trellis? Is it possible? My coding skills are pretty weak so any help is greatly appreciated.

Thanks

amandaghassaei (author)  liampower5 months ago

you could adapt this to work with the trellis, but you'll have to do a fair amount of coding to get it to work with i2c

mle108 months ago

When I connect to my computer through the Arduino USB port, I am able to see it in the serial port drop down in Hairless and am able to control MIDI sounds in FL studio but when I connect through the USB of the MIDI to USB cable, I get the message USB not recognized and it does not appear in Hairless. I tested the cable prior to taking it apart and it worked fine. Do you know what could be causing this discrepancy from Arduino USB port and MIDI to USB cable USB port?

amandaghassaei (author)  mle108 months ago

you should only use hairless if you're connecting through plain old usb, the point of hairless is to convert a "usb" message into a midi message in your computer. If you have a MIDI to usb cable and you are able to get that into fl studio, you should be good to go. right?

pj.jones.589510 months ago

AWESOME!! Whats the total cost? :)

markkuki10 months ago

Amanda, I have multimeter incase you are able to help with troubleshooting. On step 24 right now. After uploading your code, only one row of buttons lights up and they all light up at the same time when pressed (4 LEDs). All other buttons are non-responsive as of now.

NOTE: I am omitting the gyroscope and accelerometer. Note sure if or how much this changes things with the DIP chips? I have been following the schematics until this point and noting your mistakes in the pictures and fixing them as best as I could interpret them.

Steps 21-23 are a lot more confusing than the previous 20 steps.

Documentation is key for others to build properly. I think it is not ideal to show an image and then say "don't do it like that."

Seems you might be on vacation again? Hope you are enjoying it and looking forward to a reply when there is time. :)

IMG_3960.JPG

I'm about to attempt the same thing... I just want the MIDI output part of this build...

My biggest question is this... what portions of the code can I scrap? Obviously, the gyroscope and rotary knobs, but I'm not sure about the rest. Coding Arduino's are still a weak spot of mine...

I basically want to assign each button a MIDI note, as the software I want to control can listen for MIDI notes on each playback button. When the SC button is pressed, it triggers that soundbyte from the software.

amandaghassaei (author)  bacarudaguy10 months ago
If you tie the analog pins to ground it should work as is. If you want to get fancy you can go in the code and comment out the parts where it's grabs accel/gyro data.
amandaghassaei (author)  markkuki10 months ago

did the code that just cycles through the buttons work correctly? I've updated the button schematic, are there other errors in the documentation? the gyro and acc should not affect the code in step 24. Where do I show an image and then say to do it differently?

I replied to baracudaguy an update on how my troubleshooting is going so far and what I have already eliminated as a point of failure. I think I fried my 74HC165 chip somehow but do not have another one on hand and won't be able to buy a new one until Friday morning when I am back home. Are you able to help with troubleshooting techniques to determine if the DIP is dead? Never done that kinda diagnosis before.

re: your question ... Step 22 - 74HC165 Part 3: (fig. 1) "these
should be connected to the analog pins, the design changed while I was
building, please refer to the schematic rather than this image."

Sorry, I just got a little confused because I thought there should be no mention of the analog pins until Step 28 and Step 29. Therefore, it begs the question what you mean by "these" what should be connected to the analog pins instead of digital pins that you were connecting in Step 22?

In my case, I am using 4 potentiometers as Attack, Decay, Sustain, Release for example, so I understand I will be using only 4 analog pins and the rest are free I think.

amandaghassaei (author)  markkuki10 months ago

I realized that I put it in the schematic, but I never mentioned in the text how to power the buttons - I think that may be your problem. Reread steps 19-24, I've made some edits that hopefully help with the clarity. I doubt you have damaged the 165, I've used them a lot and found them pretty sturdy chips.

Markkuki - have you checked all your solder connections on the 4x4 pcb?

Tested so far on Sparkfun PCB / perfboard (I am discretely testing everything (including components I know are working) since I didn't know where the best place would have been to start and this is good practice for me either way):

LEDs = OK (tested with Arduino code from Step 18)

4 x 100 Ohm resistors = OK

Diodes = OK (tested with multimeter to exact instructions that came with multimeter)

Ribbon Clamp Female Pins 1-16 = OK (discretely tested with multimeter)

Male Header Pins 1-16 for Ribbon = OK

NOTE: After cleaning with 91% isopropyl alcohol and toothbrush (believe it or not) now all rows are non-responsive aka not lighing the buttons.

NOTE: Steps not necessarily in the order I preformed each troubleshooting check.

Slowly but surely elimating potential points of failure. As I type this, I am waiting for my perfboard to dry from cleaning and will resolder the SWT GND pins that have the 10K Ohm resistors on them. The continuity I checked OK was at the male header pins but my soldering was messy so not necessarily continious from the lead wires at the header pins going to the 74HC165 socket. Meaning, if I touched certain spots of the joined solders I could not get a signal (multimeter in "beep mode" so to speak).

Furthermore, I do not have another 74HC165 chip to test/swap in... so who knows that DIP could have been defective straight out of the bag since it was not in a anti-static vacuum sealed bag or I damaged somehow by accident.

mle1010 months ago

Great project! I am on step 25 and am getting no response from my sugarcube when uploading the code and the running the individual beatslicer app. In step 24, I needed to set the pin modes individually using pinMode() to get it to work. I am using a SainSmart Mega 2560 R3 instead of an arduino uno though. Do you know of any differences between these that would cause some of your code not to work? Any advice would be greatly appreciated!

amandaghassaei (author)  mle1010 months ago

yes you're going to run into problems if you use a board other than uno or duemilanove. It's possible to use a 2560, but not supported with my code.

I added up the prices of the parts listed above, excluding the basics such as wire, solder, cutters, etc. and making a couple of substitutions for parts that are no longer available, and this project comes out to $146.63. Pretty pricy, though it could be reduced by scrapping some of the optional parts or finding cheaper alternatives. Attached is a spreadsheet with the price breakdown.

amandaghassaei (author)  StephanStansfield10 months ago

nice, thanks for posting this. markkuki did just point out one small error in the parts lists - 2x the 595 and 1x the 165, not 3x the 595. and I noticed one other thing: 16 leds instead of 20. little change in the price though. Yes you can definitely find cheaper alternatives - all the Radioshack parts could be found for cheaper on amazon or digikey. Using plasic knobs instead of aluminum ones, maybe finding another battery - anything that outputs between 7 and 12V will work.

1-40 of 105Next »