User:Opersing2688/ENES-100/Project 1:

Other Pages
Music Project Team Page

Connor's Wikiversity Page

Rachel's Wikiversity Page

Week1 Narrative
For the first weekend I was tasked with programming an arduino and a MIDI board to play notes on a keyboard. Since I know nothing about arduinos or MIDI boards, I spent much of the first week researching. For this project I am using an Arduino Uno SMD Edition, SparkFun's MIDI Breakout board, a Casio CTK 519 keyboard, a MIDI cable, and an USB cable.

 File:Arduinouno9.JPG|The Arduino Uno SMD File:Midibreakout.JPG|MIDI Breakout board File:Keyboard519.JPG|Casio CTK 519 Keyboard File:Midicable.JPG|MIDI cable File:Usbcable2.JPG|USB cable 



These are the webistes/videos that I used to learn about arduinos and MIDI boards:
 * Arduino
 * In-system programming
 * Musical Instrument Digital Interface ( MIDI)
 * Official arduino website
 * ATmega8 controller
 * SparkFun Electronics MIDI Breakout
 * RobotShop MIDI Breakout Board
 * HowStuffWorks MIDI
 * YouTube–Jeremy Blum Arduino Tutorial
 * YouTube–Piano Professor Arduino

I learned that an arduino is a single-board multi-controller that makes using electronics easier. It can be plugged into a computer via a USB port. It also has a DC power jack.

The MIDI Breakout allows the arduino (or other micro-controller) to communicate with electronic instruments. MIDI stands for Musical Instrument Digital Interface. In other words, MIDI is data that tells an instrument what to play.

After I had done some research, I was ready to experiment with the arduino. I downloaded the arduino software and plugged the arduino into the computer. The "on" light lit up green and a little light labled "L" was blinking orange. I then followed a tutorial on how to write a simple code to flash a light on and off.

Code One
Goal: Blinking a light on and off

I am not 100% sure the code worked. The light did blink on and off, however, it was already doing that before I uploaded the code.

I then decided to attach the MIDI board to the arduino. I inserted a sample code taken from the arduino website and uploaded it. I plugged the "in" side of the MIDI cord into the "in" port of the MIDI board and the "out" into the "out" port on the keyboard.

Code Two
A sample MIDI code

Goal: To play a simple series of notes

Nothing happened after I plugged everything in. I switched the cords so the "out" side of the MIDI cable was in the "out" MIDI port and the "in" side was in the "in" port of the keyboard. Still nothing.

I watched this video on YouTube but it was only showing the final project, not how to program the boards.

Week2 Narrative
I started off week two with the same mission as before, to get the arduino and MIDI board to play the keyboard.

I visited a previous HCC student's wikiversity page and found a sentence saying,


 * Uploading this code to the arduino, connecting the MIDI shield to said arduino, connecting MIDI out to the MIDI shield, and MIDI in to the keyboard (or any other device with a MIDI in) will result in all notes the device (keyboard) can possibly play, in ascending sequence.

I followed these instructions and it still didn't work. I tried connecting and reconnecting the cords multiple times still with no success.

I then visited the 2011 HCC Music Team's page and looked for ideas. I found a paragraph that had some helpful information about finding the right port


 * The arduino environment... has to in essence "find" the right board once it's hooked up to your computer. You have to make sure you have the right model of arduino selected (such as arduino Uno, arduino Mini, arduino Fio...), and that it's "looking" in the correct COM port... To find this setting and change it, go to tools -> board and select the correct arduino board. The correct COM port is a bit trickier if you don't already know how to find it. First one must find that the arduino is properly recognized in the device manager. On a Windows 7 64 bit operating system, go to the control panel -> system and security -> system -> device manager -> Open the drop-down menu labeled "Ports (COM & LPT)". The arduino Duemilanove was recognized as the "USB Serial Port(COM3)", but other boards are recognized under different names. To change the COM port the arduino environment looks for, go to tools -> Serial Port and select the corresponding COM point.

I followed the instructions, selected the correct port (in my case COM 11) and tried again. Like all previous attempts, nothing happened. I tried switching a switch from "run" to "pgm", but that didn't work either.

I went to class on Wednesday and found out that I had the wrong MIDI board. I was supposed to have the MIDI Shield, not the MIDI Breakout. I was then given the correct board, however, it was not assembled.

The MIDI Shield
The MIDI shield is similar to the MIDI Breakout except that it has additional buttons and knobs.

 File:Midishield.JPG|The board File:MIDIports.JPG|In/Out ports File:Momentarypushbuttons.JPG|Momentary push buttons File:Potentiometers54.JPG|Potentiometers File:Analogpins.JPG|Analog pins 

I learned from SparkFunthat potentiometers are used to control volume, tone, and pitch.

Week3 Narrative
Week three began with assembling the MIDI shield. This step was necessary in order to move on to programming the keyboard.

Rachel soldered the parts onto the MIDI board (her tutorial can be found here).

Assembled MIDI Shield
 File:MIDIShieldassembled.JPG|Top view File:Assembledmidishield.JPG|Side view 

Testing MIDI Shield
After the board had been soldered, I again tried to upload code to the arduino/MIDI shield. I plugged the Arduino into the computer and uploaded Code 2 successfully. I then inserted the MIDI shield on top of the arduino and the arduino turned off. I tired attaching the MIDI board to the arduino before uploading the code but when I did it that way the arduino didn't even turn on. I also played around with the keyboard and tried to see if there was a certain mode it had to be in in order for it to play what was uploaded on the arduino, but that didn't lead anywhere.

I noticed that the arduino would turn back on right after I pulled the MIDI shield off. This made me think that something was wrong with the MIDI board, maybe even the soldering. Researching arduinos and MIDI boards led me nowhere.

Week4 Narrative
I started off the week by figuring out what was wrong with the MIDI shield. In class I was told that the shield was soldered wrong. Instead on one strip of solder running across the analog pins, each pin needed to be soldered individually. Rachel fixed the soldering for me and once it was fixed I was good to go.

Soldering of the MIDI Shield
Make sure that each pin is soldered individually!

Testing the Correctly Soldered MIDI Shield
I successfully uploaded Code 2 to the arduino, attached the MIDI shield, plugged in the MIDI cable, and nothing happened. I wondered if it had something to do with the code so I went to the 2011 HCC Music Team page and used their code for Mary Had A Little Lamb. This team said that the code was a success.

Code Three: Mary Had A Little Lamb
The keyboard did nothing. I tried attaching the cables in different orders, placing the MIDI board on top of the arduino before uploading the code, switching what MIDI ports the cable went to, and nothing worked. I thought that the problem might be with the keyboard and decided to find out some information about it.

The Keyboard
I looked up the Casio CTK 519 Keyboard user manual and read the section on MIDI. It said that MIDI messages are received by attaching the "out" port to the device and the "in" port to the keyboard. That's what I've been doing and confirms the former music team's instructions. The manual also said that there are 16 MIDI channels on the keyboard and that both the sending machine and the receiving machine have to be set to the same channel. I didn't know how to tell if anything was on the right channel and never saw anything in the arduino program about channels. Another thing the manual mentioned is that the keyboard has two tone maps. Tone map N allows tones from 0 to 99 whereas tone map G allows for tones from 0 to 127. I assumed that the numbers correlated with the keys on the keyboard. The manual also said to use MIDI channels 1, 2, 3, 4, or 10.

In order to change the channels as well as the tone map, press the transpose/tune/MIDI button three or four times and use the + and - buttons to change the setting. I continued to read the manual and it said that the keyboard is not General MIDI compatible but it can still connect to a computer or other MIDI equipment. I don't know what that means.

Programming the Keyboard (again)
After I had done research on the keyboard, I tried to upload the code again. These are the steps I took:


 * 1) Plugged in the arduino (it turned on)
 * 2) Uploaded Code 1
 * 3) Turned on keyboard
 * 4) Pressed transpose/Tune/MIDI 3 times
 * 5) Selected "Tone Map G"
 * 6) Plugged in MIDI shield
 * 7) Plugged "out" port of MIDI cable into MIDI shield "out" port
 * 8) Plugged "in" port of MIDI cable MIDI "in" port on keyboard

Nothing happened. I followed the same steps again with the keyboard on "Tone Map N" and still nothing. I tried plugging the "out" port of the MIDI cable into the "in" port on the MIDI shield just to see what would happen. It didn't work.

I decided to go to YouTube to see if there were any videos on the topic. I watched this one and this one but they weren't really helpful.

Fritzing
Another important part of this project is creating a block diagram that shows how all of the different systems for the beat bearing project will fit together. In order to do this, I used an open-source software that allows people to design prototypes on the computer called fritzing.

I created a rough sketch I made in Google Drawings of what the system block diagram will look like.  File:System block diagram.jpg|Rough sketch of the system block diagram 

The way this program works is that you drag and drop parts from the parts bin onto the screen and connect them.

My first attempt consisted of figuring out how to drag items to the board and finding parts in the parts bin. I couldn't find an FPGA component in the parts bin. I googled "FPGA Papilio" and found a picture of it on SparkFun. I went back to fritzing to see if there was a papilio or FPGA but with no success. I searched FPGA and two items popped up but they looked nothing like the picture of the one online.

I decided to try and upload a image of a FPGA papilio onto fritzing. Since I didn't have a picture of the FPGA, I used a picture I took of the MIDI board.  File:Midishield.JPG|The picture of the MIDI board 

First I tried uploading the picture in .jpg format, but it did allow me to upload. I then saved the picture as a .png but that also did not work. I followed WonderHowTo's instructions on adding an image by using a silkscreen layer in PBC view. This did not work. I also tried uploading an image under schematic view

 File:Silkscreen image.jpg|Adding a silkscreen image in PBC view File:Schematic image.jpg|Adding a schematic image in schematic view File:Breadboard image.png|Adding a breadboard image in breadboard view 

On the Fritzing forum, one suggestion was turning the photos black and white before uploading them. I converted the picture of the MIDI board into a greyscale image on Microsoft Office Picture Manager and uploaded it. The picture uploaded, but I could only see the outline of the image  File:Midishieldgreyscale.jpg|Grey-scale image 1 File:Greyscale image fritzing.jpg|Picture of MIDI board in Fritzing 

I decided to try different shades of black and white to see if one would be successful in showing the image.

 File:GreyscaleMIDI2.jpg|Grey-scale image 2 File:Greyscalemidi3.jpg|Grey-scale image 3 File:Greyscalemidi4.jpg|Grey-scale image 4 

I found that image 4 had the same result as image 1 and image 2 and 3 didn't even upload.

This website suggested saving the picture as an .svg file and then uploading. I converted Image 1 through this site and again tried to upload. Below is what showed up. I tried using uploading the same picture as well as different grey-scale image in PBC view. The result was very similar. <Gallery> File:Svg MIDI upload.png|.svg file of MIDI board in Breadboard view File:Svgpicpbcview.png|2 .svg files of MIDI board in PBC view </Gallery>

I decided that I didn't have enough time to pursue this aspect of the project and just used parts that looked similar/had the same function as the desired piece. Once I finished the diagram, I exported it as a .jpg out of Fritzing. This is the end result.