Month: December 2013

So my final project started with this as the inspiration: http://www.youtube.com/watch?v=xQx6YeoKVwU

I went through various different brainstorming sessions on what to do for visually impaired individuals. At one point I was looking at creating a remote that controlled music players using clapping sounds, which reminded my professor, Matthew, about the “Clap on, clap off” remote: http://www.youtube.com/watch?v=0viUrw0hEKg

In the end of the day, my final project ended up being a colour detector that reads out the colour being analysed. This has many applications in a society where we are so heavily reliant on colours to categorise and describe things i.e. wear a white shirt to a funeral, pick up the blue box, throw things in the green bin etc.

The basic idea for this machine would be to first sort out the output aspect: a music player with predetermined songs/tracks. Then the input aspect would be a colour sensor.

The output I built using this tutorial: http://apcmag.com/arduino-project-5-digital-audio-player.htm

The result was the following: [INSERT VIDEO]

To create the music player, I used the Wifi shield and its SD card reader to store my tracks. The tracks were made using Garage Band on Mac and converted using this audio converter: http://www.online-convert.com/result/b2ef4b4410687036be375f113f071358

Using the above tutorial one gets a working music player, basically a simple version of an iPod. But I wanted more. So then the aspect was to get a working colour sensor to do my colour readings. I used a I2C Grove Colour Sensor. I used the following Wiki tutorial to set it up: http://www.seeedstudio.com/wiki/Grove_-_I2C_Color_Sensor

I then tried to map the colours using the CIE colour space and the x,y readings given by the colour sensor: [INSERT COLOUR MAP]

However, this did not work very well in the end of the day, and I ended up using a simple version, using primarily only x-coordinates and only coding for Red, Green and Blue. The final colour sensor code that I used was provided by this tutorial: http://eiseler.synology.me/wordpress/?p=432

When the both the output and the input were working separately, I wanted to combine the two codes and connect the input and the output together. However, this proved a little difficult, and I ended up having to use two arduino boards and link them. This was a solution developed thanks to Matthew. Then one arduino took care of the output whereas the other took care of the input.

The working project can be seen here: [INSERT VIDEO]

I also decided to create a box using the laser cutter. The box was developed using the template provided by: http://www.makercase.com

Getting the template from MakerCase, I then edited the file in Illustrator to create wholes for buttons and cables. The final project looked like this:

[INSERT PHOTOS OF FINAL PRODUCT]

===========================================

Here are my final codes:

MUSIC PLAYER:

// ———————————————————————————
// DO NOT USE CLASS-10 CARDS on this project – they’re too fast to operate using SPI
// ———————————————————————————

// ———————————————————————————
// set cardType to ‘oldCard’ if using an old SD card (more than a few years old) or
// to ‘newCard’ if using a newly-purchase Class-4 card.
int cardType = newCard;
// ———————————————————————————

Here is my final i created a 3D LED cube. it took a lot a work for that little cube but it paid off! to create the cube i soldered 64 resistors to 64 led lights and then soldered the led lights together to create the grid of lights. then i got the code from an online site that provided the code for the arduino board!! amazing experience altogether learned alot !!

For my final project, I decided to improve on my paint application from my midterm project. There were some limitations to my original program, such as a small selection of color available and no way to erase. Additionally, my prior paint application’s interface was not very aesthetically pleasing, so I wanted to design a better looking user interface because research has shown that people are happier when using interfaces that are more pleasing to the eye. To solve these two problems, I created the present color wheel that is both very aesthetically pleasing and offers a wide selection of color. I also incorporated sliders which help the user choose the stroke weight and opacity with precision. Before I simply had blank buttons which were not helpful for allowing the user to know the current relative weight and opacity. The slider helps solve this interface defect.

Furthermore, I wanted to create a paint program that can interact and understand the user’s current mood. I realized that users mostly communicate with the paint tool using the mouse. Oftentimes if someone is mad, they would move the mouse fast and furiously. If they are sad, they might drag the mouse. Thus, I created two special interactive paintbrush effects. The first one allows the user to draw bubbles when they move the mouse –depending on how fast they the user moves the mouse, the color will change. The second brush follows a similar concept. Depending on how fast the user moves, the mouse the bubbles that come out of the brush will change in size.

Lastly, I added a save button that enables the user to save his or her artwork. In my previous application, I did not have such a function, so I felt as if my application was more of a fun thing to play around with rather than a serious tool used to create artwork.

Challenges faced: 1) The first challenge I faced was writing the code which allowed the user to hover over the color wheel to choose a stroke color. I resolved this issue by using several variables. I first used the “get” function to track the color of the pixel the mouse is hovering over. I then stored the color of the paint in a circle next to the color wheel, and proceeded to get the color of a pixel in the circle to use as the brush color.

2) Another challenge I faced is getting the sliders to work properly. When I pressed the mouse down to draw lines in the empty space, I also inadvertently moved the slider.

Thus Matt helped me write some code that put a bound on what constituted as moving as moving the slider. This only if the mouse is dragged in the area dictated below, will the stroke weight or opacity value change.

If I had time to improve my project I definitely would have incorporated music into it. For instance, I might have made a function that allows one to draw with their voice (depending on different pitches, volume, etc. ) different images will appear.

Additionally, the show on Thursday was a good way for me to get user feedback. After the show I created a function that allows the user to clear the screen with the space bar instead of having to re-run the program.

My initial idea for the final was to work with the webcam. However, as I tried to go through with the project, I encountered a lot of technical difficulties, and I decided that I wanted to change the project, so that I can continue exploring Processing.

I decided it would be fun to work with images and create something that is not limited to the files that are on my computer, but use the internet instead. When I started out, I did not have a very clear idea of what I wanted to make. I was thinking of creating a new kind of dictionary – one, that defines words by images, and not by word definitions. Another idea was to create a card-maker, that would download images, write messages on them and export them.

The end result was a search engine, similar to Google Images, but slightly different, in that it randomly chooses the image it shows out of the results of the search.

Those are sample images generated by the program for the search of the word “food”:

The program, even though it seems fairly simple, was not that easy to create. I wanted to use Google Images library at first, but then I decided Flickr would work better, as there are less differences in the size and the quality of the pictures on Flickr than on Google Images. I found a code online that allows for the search of images, and then modified it to search the term that was typed in by the user:

That, along with allowing the user to type in the word he/she wants to search, was one of the most important parts of the project. I found a code for typing online as well, and then modified it a bit to fit my purpose.

That was the basis. The next step was making the program look better and be more user-friendly. That is why I created an interface:

I also designed a screen, that appeared when there were no search results for the query on Flickr:

To make the images themselves look better, I found a way to analyze the dominant color in the picture and then used the inverse of this color to be the color of the font used to write out the word searched for over the image. The result of the addition of that code to the program can be clearly observed looking at these images:

When it came to the font, I could not decide which one to use. I also did not want all of the pictures to look the same, so I added a code that randomizes the font used. I incorporated 15 different fonts in the program, those are examples of some of them:

I was really happy when I finally got everything to work together. However, during the Final Show it became clear that the program has its weaknesses. Firstly, almost all of the users wanted to click the white slot meant for the typing before starting to actually type. That is because they subconsciously expected a cursor to be displayed, which I had not created. Secondly, the program does not have one clear function.

Other changes that could be made to the application would then depend on the purpose of the program. If it was to become a dictionary, perhaps it would be useful to enable the user to see more than one image. If it was to become a search engine, that, for example, searches private photo galleries, then the word written over the image would need to be removed. If it was to be a card-maker, perhaps the text on the image should be different from the text searched… There are many ways in which this application, with simple modifications, could be used, but so far, that’s the code of the program:

It has the features Rhythmania had: DanceJ tells the computer to play songs of the right rhythm according to the beat the user stomps on the pedal (and the pedal is a high class fancy laser-cut one now!) But the codes for accomplishing this feature is quite different now.

DanceJ hasmore features: DanceJ can play sound effects based on the intensity of the user’s dance moves. This feature is realized by using web-cam. There is a window on the screen that displays a cool dark version of the video showing the difference between different moments of the user’s gesture.

DanceJ is much more organic than Rhythmania. You can add new songs to your playlist by just dragging your mp3 files onto the display screen. Then the computer starts playing this new song you added. Now you can listen to this song and tap on keys to define the rhythm of the song. There are texts on the screen saying “define ur music by 10 taps”. When you are done, press ENTER then the information about this song’s rhythm and name will be saved into a CSV file. So a new song is added to the user’s playlist and is ready to be called upon by stepping on the pedal at its defined rhythm.

The hardest part in this project was for me to integrate the different parts of DanceJ together. Each different function was completed separately. When the individual programs are put together, the whole thing becomes a big big mess. At that moment it was so important to believe that it was all going to work out. After this semester’s experience with coding, I have found one very important psychology a coder must have is to believe there is always a solution to all the problems and errors. Only when he or she have that faith can he or she struggle through the difficulties.

For the first lab we had to build three circuit boards. The first circuit uses a buzzer and a switch. The second circuit uses a resistor, LED and a switch. The third circuit uses a potentiometer, LED and switch.

I followed the schematics below to construct the three circuits. I did not run into any trouble, except for the third circuit board I lacked a potentiometer at the time.

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.

This project is roughly a sound remixer. It is based on Arduino and Processing. By pressing the buttons (three) on the interface board, the operator can remix any sound effect or music he want. In my final project proposal, I describe my project as a band. However, the result may seem more like a music remixer than a band. Anyway, if you change the tracks, it can still sound like a band.

By the way, this is my very first time to design something with our super cool laser cutter. I enjoyed this progress so much. Thank you Vivian Xu for your generous help and always, I want to express my gratitude to our beloved professors, Prof. Matthew Belanger and Prof. Marianne Petit. Thank you all for your support!

Codes:

/* * Firmata is a generic protocol for communicating with microcontrollers * from software on a host computer. It is intended to work with * any host computer software package. * * To download a host software package, please clink on the following link * to open the download page in your default browser. * * http://firmata.org/wiki/Download */

/* Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved. Copyright (C) 2010-2011 Paul Stoffregen. All rights reserved. Copyright (C) 2009 Shigeru Kobayashi. All rights reserved. Copyright (C) 2009-2011 Jeff Hoefs. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See file LICENSE.txt for further informations on licensing terms.

/* timer variables */ unsigned long currentMillis; // store the current value from millis() unsigned long previousMillis; // for comparison with currentMillis int samplingInterval = 19; // how often to run the main loop (in ms)

void reportDigitalCallback(byte port, int value) { if (port < TOTAL_PORTS) { reportPINs[port] = (byte)value; } // do not disable analog reporting on these 8 pins, to allow some // pins used for digital, others analog. Instead, allow both types // of reporting to be enabled, but check if the pin is configured // as analog when sampling the analog inputs. Likewise, while // scanning digital pins, portConfigInputs will mask off values from any // pins configured as analog }

void enableI2CPins() { byte i; // is there a faster way to do this? would probaby require importing // Arduino.h to get SCL and SDA pins for (i=0; i < TOTAL_PINS; i++) { if(IS_PIN_I2C(i)) { // mark pins as i2c so they are ignore in non i2c data requests setPinModeCallback(i, I2C); } } isI2CEnabled = true; // is there enough time before the first I2C request to call this here? Wire.begin(); }

/* disable the i2c pins so they can be used for other functions */ void disableI2CPins() { isI2CEnabled = false; // disable read continuous mode for all devices queryIndex = -1; // uncomment the following if or when the end() method is added to Wire library // Wire.end(); }

/* send digital inputs to set the initial state on the host computer, * since once in the loop(), this firmware will only send on change */ /* TODO: this can never execute, since no pins default to digital input but it will be needed when/if we support EEPROM stored config for (byte i=0; i < TOTAL_PORTS; i++) { outputPort(i, readPort(i, portConfigInputs[i]), true); } */ }