Month: October 2013

So i decided to make a electronic dice for my midterm because i wanted to start working with led’s for my final. I started looking online for various methods of developing my dice and found a few interesting websites that help me lead my self (www.instructables.com) and finally started constructing my dice. I attached the shield to my arduino and taped the breadboard on top of it and then just started connecting a lot of wires here and there and finally installed the leds !

After that there was a switch that had to be put in place for the dice to work each time you rolled it but i decided to change that up for another type of switch and thought about the motion sensor switch and just replaced the normal switch. then to make my experiment portable i decided to add the 6 battery pack to my arduino and it turned out perfectly!

the items needed is very basic it includes:

Arduino or a clone ( I’m using a protoshield but a breadboard will work the same way)
11 Jumper Wires (or stripped wires in order to make connections on a breadboard)
7 Resistors (I used 330ohms) (ORANGE)(ORANGE)(BROWN)(GOLD)
7 LEDs ( I used green)
1 tactile switch or motions sensor (I used a motion sensor)

Hello, my name is Fred Wu and today I want to introduce my mid-term project: virtual color mixer. Basically, it needs three potentiometers to control RGB colors, and what I’ve done is to program Arduino so that it can output the value according to the resistance. By using the serial fuction in Processing, we can vividly demonstrate how the values change.

We started the assignment with recording the sound of the background music (played with erhu), the wind stimulated by Lee, and the people talking. Then we edited with Audacity. The problem existed in the volume of the background music, the convergence of different sounds, and the logic of the story. To revise the audio, we added the sound of coins thrown into the bowl, adjusted the timing of the wind and the dialogue. And, there comes our final audio!

Echo Yvonne Jingyi and Aileen proudly presents: What to do when vendors give you a ridiculous price.
The answer is: you bargain.

We fixed it so that Echo (the vendor ripping us off) was on the left channel and everyone else was on the right. Hope that clears it up a bit. We also changed the volume so that everyone was about the same.

So for our midterm project, we originally wanted to make the Mao Statue on a skateboard dodge obstacles on a rolling screen, with randomized objects coming out of the side. However we found that with our limited understanding of processing, that it would prove to be far-fetched to attempt to use a rendered image of the Mao Statue remain on the skateboard, which was made out of objects on the processing. The mouseX and mouseY functions were just too confusing for us to figure out. So scrapping the Mao idea, we decided instead to use a small Bart Simpson figure as our cursor, movable by the mouse functions. From there we found an image online of a bird’s eye view of a street and used that as the background.
Our goal with this movable Bart figure would be to create a little game with obstacles dropping out from random places from the top of the screen and the objective would be to dodge the objects without being hit. So after photoshopping a few images of Kevin’s and Max’s face, we created the objects. Using the x = function(width) in the void setup portion of the code to have the objects appear in different places every time we start the code. We gave each of the objects different dropping speeds so the user would have a more difficult time avoiding the objects. We also continued the scrolling of the objects by making them repeat their course of action once they rolled to the bottom of the screen. So what we have is a Bart figure, controlled by the user, attempting to dodge the falling objects. Looks like this:

Failures:

We were disappointed by several things in our midterm project. The first thing had to be the randomizing function. When initiating the objects to have randomized dropping places in the void setup, we understood that the objects would have different falling places every time the code started. However we wanted the objects to continually have different falling places once they finished the run through the screen. So putting the random x function again in the void draw section to redraw the images only created wonky images that bounced off the left and right sides of the screen, without stopping. So that left the objects continually falling from the same place they started at each time the code was started. The second and probably the most frustrating thing that we had to deal with was a lack of a hit detection system that would make the Bart figure disappear when the user failed to avoid the object. However, we were totally unsure how to accomplish this. We tried created an if statement that would make the Bart figure false if the object touched mouseX / mouseY ‘s position, but that didn’t turn out correctly. So those are two things we wish to improve on when we try to recreate a game in the future.

I wish for a music player that plays music that matches the way you dance. For this midterm project I created a pedal so that the computer can choose the music to play according to the beats you step on the pedal.

The first problem I had to tackle was to calculate the beat. I needed something like a timer. so I thought of letting a line going from the left to the right of the screen. I could record the positions of the line when the pedal is stomped on, and compare the differences of the positions.

I wanted to add a little something that would help the user understand what the project is doing by leaving a line on the screen each time he or she steps on pedal. But it gets confusing as the line restarts from the left every time it reaches the right. I put background() in draw(), but then the line didn’t leave a mark on the screen at all. Then Matt suggested that I should think of drawing the lines every time the draw() runs. I tried the “for” loop and it worked!

A very difficult thing for me was to connect Arduino with Processing. How does Processing receive data from Arduino? I tried Firmata but the codes were complicated. Matt told me that he very often used Serial Port to send and receive information between programs and we found an example code. There was some problem with what sort of data processing is looking for, but by trying out the different possibilities, I adjusted the example code to my project.

I didn’t know how to use Processing to play music. Vivian told me there was something called minim and she helped me so much with where to look for resources I could use.

Then a crisis occured because the program reported that there was not enough space. I was inspired by Matt talking about defining a functon by ourselves instead of using draw(), which occupied so much space. I dragged a function out of draw(). Problem solved.

Also, one particular headache I had was that as I stepped on the mat, there was always a period of duration, so the line sometimes left several lines closely together at one time, which totally messed up my beat calculation. Matt hinted that I should have a true or false value to work like a switch. This was so helpful. I thought about it and used boolean; it worked perfectly!

I broke the project into small pieces and finished them one at a time. Then I fused them together and made adjustments. I feel this is a very efficient and less scary way of doing projects!

There are so many things to talk about! I have different versions of my music players. I have my primitive ones, which need to be restarted if you want them to play another song before one song ends. I have my lying ones which works fine if and only if the line is moving in its first round (math problem). I have my noisy ones which sometimes play several songs at the same time. I have my processing one, which does not require the Arduino part at all to run well( but of course the important experience of the user is missing). I have my tough one, which can be very hard to control with Arduino because of delays.

Everything needed adjustments and improvements all the time, as I got closer to my expectation step by step. A good amount of math-related thinking was involved in my program. Now my program plays music smoothly, having no trouble switching from one song to another; the music can be stopped if you step on the pedal after playing the music for a long time or you stomp on the pedal too quickly. The lines are clear indicators. I love my project very much. I didn’t know much about Processing or Arduino and I still don’t, but trying was very important. Just trying out different possibilities and exercising new things helped me learn a great deal and become much more comfortable with Processing & Arduino. My heartfelt thanks go to dear Matt, dear Marianne and dear Vivian who inspired me and supported me. I strongly recommend my fellow students to communicate more with professors and teachers because students can learn so much this way.

My project can be in so many ways improved and enhanced. My hope right now is that I can continue and create what I wish for (stated at the beginning of this documentation).

Note: Just before presentation a fellow student accidentally kicked over my Arduino and broke the force sensor. I had to take the force sensor off the circuit and use the naked ends of the wire to control the circuit and play music. So what I presented in real was a music player controlled by “clapping”(not even so much as clapping) rather than stomping.

At first, I had couples of ideas about my midterm project. I tried some of them, but they seemed to be a tough challenge to a beginner as me.

Therefore, I started with some simple shapes and tried to combine my project with some photoshop and illustrator stuff, which I know pretty well. I used them to creat a background and Shanghai’s skyline. It turned out to be a good idea and made my work much easier.

All the changes in my work, such as the location of the sun and the colors, are controlled by mouseX. It’s really not easy to compute everything with a single variable , especially the location of the sun.

Basically, I just played with codes. I didn’t have a clear plan. I just kept adding and testing my ideas to the project. That is why my codes are totally a mess. I made many mistakes, but those mistakes always surprised me. They made my work even nicer than I expected.