Friday, May 23, 2014

Final Project: Complete!

It’s time to hook up the whole system. The three of us met one final time to set up the flute (our lovely assistant, Box Cat) with grapes and the program Rebecca created to make this project interactive. While the Fruit Hero program was being finished, Amanda and I worked on getting the Arduino and breadboard into the box and ready for play. We ran into some interesting issues here, and we really had no idea why. We put the wires for the grapes up through the top of the box, and put the boards inside the box. We plugged a 9V battery into the board to see if we could make the system wireless, but then the program wasn't working. Touching the wires produced no sound. We thought the wiring was wrong, so we adjusted some things and tried again. Still no sound, or sometimes some notes would work and some wouldn't. We then plugged the board back into the computer, and it worked fine. We scratched our heads in awe, and then went to Google for answers.
20140520_142338
Wiring this was a pain.
Turns out, the problem is in the way the system is grounded. In this forum, a user explains that the system works fine if you touch the battery when touching the sensors, basically allowing your body and floor to be the grounding for the system. So when plugging it in to the computer, the computer acts as the grounding for the system. Pretty neat. Ultimately we went with the plug, since we need the Arduino to be talking and listening to the computer anyway for interaction.
Once Rebecca finished finalizing the Fruit Hero program, we hooked the two up together and played our new game. Read below to learn how we created the Fruit Hero program.
— From Rebecca’s blog, Arduino Hackers
Now we got the grapes playing notes, it’s time to send the note String data over to the computer.
Sending String data from the Arduino to the computer is very easy.
First you need to place this line of code in your setup method:
//Initialize serial communication at 9600 baud rate
Serial.begin(9600);
Then to send String data from the Arduino to Processing, you need to use this line of code:
Serial.println(“A”);
delay(10);//delay by 10 miliseconds so we don’t send the String data super crazy fast to Processing
For the purpose of our project, we placed it in the loop method, since we are listening for whenever a grape is touched to produce a note.
On the Processing side, we first need to import a library.  You can place this line of code before your setup method in Processing.
import processing.serial.*; //For Arduino to send over the String data to Processing
Then in your setup method, you need to place these lines of code:
//Get the port in the serial list
String portName = Serial.list()[5];// 5 – port number
myPort = new Serial(this, portName, 9600);
For my MacBook Pro laptop, port 5 is the one I am using on the Arduino side.  Your port will be different based on what computer you are using.  You can use this line to see what ports are available on your computer:
println(Serial.list()[5]); //5 is the port number.  To check, put in 0, 1, 2, etc. until you find the String printed out by this function to match the Serial port description for your Arduino Serial Port.  Mine is  /dev/tty.usbmodemfa131.  You can check what Serial Port you have by clicking on Tools -> Serial Port and see which one is checked.
Finally to get the String data value from the Arduino, you need these lines of code in your draw method:
//If we get data from serial port,
//then read it and store it in a variable
if(myPort.available() > 0)
{
serialPortValue = myPort.readStringUntil(‘\n’);
}
I used this tutorial to get this part working.
20140520_193755
Box Cat: Grapeless.
20140521_083634
Box Cat: Grapes.
















Some little details came in later, like adding in the “Call Me Maybe” music sheet and a color change for correct and incorrect notes. We also added in fireworks effects and celebration text to make the experience more dynamic. Since was the one who was best practiced at playing the "instrument," they had me demonstrate our project to the class, and they loved it. (Video available here)
Final Project – Complete. Thus, we end our time in Physical Computing.
You can view the entire project and its code here.

Final Project: Proof of Concept

It’s time to make this project interesting: we’re going to test out communication between an Arduino board and a piece of fruit. We had one lecture class on this process, so we talked to the teacher about how to do this. She drew a simple diagram, and then directed us to look at the CapSense tutorial.
The capacitiveSensor library turns two or more Arduino pins into a capacitive sensor, which can sense the electrical capacitance of the human body. All the sensor setup requires is a medium to high value resistor and a piece of wire and a small (to large) piece of aluminum foil on the end. At its most sensitive, the sensor will start to sense a hand or body inches away from the sensor.
We actually got this part working fairly quickly, testing with just one grape, then four, then all nine. This was rather quick. The next part can’t be too bad, right?
20140513_164502
The Grapes of Wrath.

Next: Polishing and the Fruit Hero program

Final Project: First Pass

“Create a coherent interactive experience that involves the Arduino communicating with another device (computer, 2nd Arduino, MIDI instrument, etc.).
Interactive = listening, thinking, and speaking from both parties. Whether it involves one cycle or many, the exchange should be engaging.”
Such are the specifications for our final project in Physical Computing. Amanda, Rebecca, and I teamed up once again to create another interesting and engaging piece. We decided to make Fruit Hero: an interactive music experience with a  fruity twist. We’re going to make a musical instrument using grapes as the keys, and a program that shows the player musical notes to match.
finalfritz
That’s the idea. No, you can’t import grapes into Fritzing.
The materials:
  • One Arduino Uno
  • Nine Grapes
  • One Speaker
  • Nine 1.5 Mohm Resistors (These are huge!)
Before getting our hands on grapes, we wanted to prototype with buttons to make sure our notes were going to be played correctly. Easy enough, we’ve worked with buttons before. Except that we all forgot how to use buttons on a board. So that took some getting used to, as well as some issues with the organization of button prongs. But eventually we got four buttons onto the board. But then the speaker didn’t work for some reason. After some tweaking, we got this small version working.
Then we wired another breadboard with four more buttons. We ran into some issues with this. Only one side was working. We rewired a few times to no avail. We couldn't figure out why only some of the buttons were working, and the other weren’t. So we disconnected one and it was working again, but of course with only four buttons. But what was the issue? Turns out, the small ground wire we were using to connect the board together was just a bit too short, so the other breadboard wasn’t being grounded. Oops. We switched out the wires and all nine buttons (we added in two modifier buttons for changes in octaves) were working splendidly.
Next step: Grapes.

Friday, April 25, 2014

Come up with a game!

Spandex                      Lab Chairs                Cabbages
Dried Beans                Yarn                          Magnifying Glasses
Plush Toy Bats            Padlocks                   Paper Clips
We have been tasked with coming up with a game that involves at least one of these things. Simple. My entry is Hallway Derby!


Two people are tied down to lab chairs using the yarn. They remain in control of only their arms, which are holding fire extinguishers. The rest of the participants split into cheering sections for each participant. These participants are given three additional items: two cabbages and a plush toy bat. The job of the people holding these items is to give them to their team's racer as they go past. These items can be used to attempt to mess up the other racer. The cabbages can be thrown, and the plush toy bats can be used either to bat away the cabbages or to poke at the other player.


Last but not least, the participants are definitely required to be wearing spandex morph suits!



Project Audio

Amanda (http://amandaimperial.wordpress.com/), Rebecca(http://arduinohackers.wordpress.com/), and I teamed up once again to work on a project, deemed Project Audio. This was a smaller scale project for practice in preparation for the big final project. For this one, we needed to incorporate a speaker and a microphone.We came up with the idea to make something that detects temperature, and when you speak to it, it will talk back and light up either green (room temperature), red (warm), or blue (cold).


We ran into an issue early on, where we were using a capacitor instead of a thermistor (some of them do look very much alike). We fixed this issue, but we were struggling to get the temperature reading just right. We tried changing resistors, thermistors, code…but with no difference in results. Finally, we went to the professor for help. She showed us a diagram of how to wire a thermistor–turns out, we were wiring it wrong. After fixing this, the thermistor was working splendidly.

Now we just needed to fix the microphone. We had tested some mic code earlier, so we altered that for the rest of the project. The mic was tricky about detecting sound. We never did get it to work perfectly, but it works well enough. After adjusting the mic and the range for the temperature, our project was done. When we made noise or tapped the mic, the speaker would make a sound depending on the temperature; the higher the temperature, the higher the pitch. Originally we wanted the speaker to output something like a .wav with custom commentary, but we didn’t get that implemented in time. Regardless, it’ still cool.
Project Audio – Complete.
fritz_bb

Monday, April 7, 2014

Project Runway: Project Finished!

Project Runway: Turn existing physical behavior into a compelling, interactive experience using a person's clothing or worn accessories (not gadgets). Incorporate a transistor, external IC, motor, speaker or fan to help accomplish the "conversation".


Laser tag is complete!


After working for three more days, with a five hour marathon session on the 26th, we finally were able to get the game working in its entirety. 
Along the way some changes were made to the project. Box-cat is no longer the target, and the emitter is no longer a glove. After speaking with our professor, we realized that a laser pointer strapped to a glove did not really fit the requirement for a wearable component to the project. We decided that the emitter would be wearable instead, which forced us to scrap box-cat. 
We tossed around a few ideas on what to do for a wearable replacement. Some of the ideas included making cardboard armor and turning box-cat into a hat. In the end, we opted to go with just a shirt with the sensors in it. 




Getting the shirt assembled was a struggle. In an attempt to avoid any kind of sewing, we bought a shirt with a breast pocket. The thought behind this was to have a place to put the arduino where we would be able to access it easily. Using a very liberal definition of "easily," this idea worked out great.

Our next major struggle was getting the working sensor into the shirt. Where we had thought using the pocket would make it easy, we were instead ambushed by a few problems. The first: working in such a confined space. Having so many parts to go into the correct holes in the breadboard was a struggle. Getting the entire setup working when it was sitting open on a desk is a cakewalk, but trying to assemble it through a shirt was another thing entirely. That leads to the second issue, after sticking the phototransistors through the shirt, it was impossible to tell which prong was which, as we could not see the tab on the transistor itself that marks the prongs. We had to mark the prong on our own after it got through the shirt. After struggling with these first two issues for an hour, we finally got the phototransistors connected to the breadboard through the shirt. We were able to do it by turning the entire pocket inside out, but that created our third issue: after getting everything hooked up, we had to turn the pocket back into a pocket, all without dislodging any of the pieces. This took us a couple tries, but we were able to get it working. 



Awesome! It works! We can shoot the transistors with a laser pointer and they play a little tune!
At this point, Amanda made a joke about how it would be funny if the speaker played the beginning of Bon Jovi's "You Give Love a Bad Name" instead of our little tune ("Shot through the heart! And you're to blame, darlin you give love a bad name!") because the sensors were over the heart when the shirt was being worn.
Challenge accepted.


Another half our of work, including finding sheet music for the song and turning the music notes on the staff into digital sounds that the arduino and speaker could interpret and play, and it worked. The sounds it produces aren't perfect, especially the second half and the parts where there would normally be a carry, but it was at least recognizable as the tune. 


Mission accomplished!



Monday, March 17, 2014

Project Runway: Proof of Concept

Project Runway: Turn existing physical behavior into a compelling, interactive experience using a person's clothing or worn accessories (not gadgets). Incorporate a transistor, external IC, motor, speaker or fan to help accomplish the "conversation".

This time around, I've joined a group in the hopes that I can make my project bigger and better! I'm working with Amanda Imperial (http://amandaimperial.wordpress.com/) and Rebecca Vessal (http://arduinohackers.wordpress.com/) to create a wearable laser tag game. We hope to create a glove gun, where the user folds their hand into the shape of a gun, and shoots an IR beam at a target. 
Our initial idea had a second person wearing a shirt with IR sensors sewn in, but for our proof of concept, we're planning on having the sensor stationary on a box-cat.

Box-Cat!

Moving forward with this idea, we decided to get an IR emitter and IR sensor working before we decided to sew anything together. This meant getting an IR LED turning on and off (which should be a cake walk) and getting a sensor to recognize that that is happening. 
After looking around online for some advice, we decided to proceed with a photo transistor as our sensor. We assembled the materials and started building. 

A standard LED (for testing) across from a photo transistor.
After some trial and error, we realized that while moving things around, we had forgotten to put a resistor back in next to the photo transistor. All the power we had been sending through it burned it out, and that was the source of our recent frustrations. We traded it out, and we had a working system.

The sensor is connected to the alligator clips
on the far right, with the speaker connected to
 the breadboard on the far left
In the hopes of making our game more fun (and more complicated!), we decided we wanted to add a speaker to the box-cat that would make noises when it was shot. Having never worked with a speaker before, this posed some issues. We thought we had everything wired and coded right, but the speaker wasn't working. After a lot of trouble shooting, we gave up and decided to wait until we could get help from the professor. 
The next day in class, we hooked up a different speaker. It works!

The laser pointer is being powered by an Arduino.
 I hope to add a speaker to this system too so that when fired,
the glove-gun goes "pew pew!"
We then moved the emitter to a second Arduino and breadboard so that we could test the range on the system. This is where we hit a major roadblock. The photo transistor was sensing the IR LED, but only at a maximum range of about six inches (and that's being generous). We had to go a different route. 
We got some advice from our professor, who suggested using a laser pointer instead. After connecting the pointer, we were able to get a solid reading at any distance!
With a little tweaking, the speaker now makes noise when the photo transistor is tripped by the laser pointer.

This completes our proof of concept. All that remains is getting the laser pointer on a glove for the player to wear, and getting the sensor embedded into the box-cat!

Box-cat!