Sunday, October 20, 2013

How to make the LED guided piano teaching device

Hi there, here goes the manual. (Here is more important manual for your life)

First, I made an android app for the LED guided piano. I am sharing the code at a Github. This android app  parses *any* piano MIDI songs and convert the data into data format for driving the IOIO OTG board.

Materials needed:

2 Meters of LED Strip (WS 2801 based) 
Your android phone.
Micro USB Type A to Type B cable (For connecting your phone to IOIO OTG)
Soldering Supplies.
Breakable pin header.  (This goes to IOIO OTG and LED Strip. This is actually important)
Lots of short jumper wires (female to female)
5 volt 1A power supply and corresponding power jack
(So power supply powers the IOIO OTG, and IOIO OTG directly powers LED strip)
3M Double Sided Tape  (For attaching your LED strip to Piano)

Three critical notes.
The 2 Meters led strip is cut into three parts. One part for powering 20 black keys, one part for powering 21 white keys, and one part for powering 5 black keys and 15 white keys. This is because IOIO OTG can send only 64 bytes of data which correspond to controlling 21 led lights. So this is the setup. Three strips are controlled simultaneously. 

The way you attach the LED strip to the white key. Do not set tapes on every single white keys
For black keys you have to cut the LED strips into pieces of three LED lights and two LED lights to accomodate for distances between the black keys. Also use pin header to connect the LED strip to jumper wires. You do not want to solder the jumper wire directly onto the LED strip because the LED strip can tear easily.

How to connect from IOIO OTG to LED strip:
Solder the pin headers onto the pins of IOIO OTG and LED stip. Connect the headers using female-to-female jumper wires. Here is the setup.

This is the Java code within the android app that tells the IOIO OTG to use pin 1,2 for strip 1,  and pin 4,6 for strip 2, and pin 10,11 for strip 3.

    white= ioio_.openSpiMaster (27,4,6,15 ,Rate.RATE_50K);
    black= ioio_.openSpiMaster (28,1,2,16 ,Rate.RATE_50K);
    three= ioio_.openSpiMaster (29,10,11,17 ,Rate.RATE_50K);

This is the explanation for each input for the above java code.
 spi = ioio.openSpiMaster(misoPin, mosiPin, clkPin, ssPins, Clock rate;

ioio.openSpiMaster does not serve 'null' for the case there is no misoPin or ssPin, so we have to specify misopin or sspin even though they are not used.
pin 27,28,29,15,16,17 are not used.

Monday, October 14, 2013

Use Bacteria for Communication

For security reasons, electromagnetic wave might not be feasible for communication.

Use bacteria. Recombinant technology can put any DNA into bacteria. Write your message into bacteria using DNA, and send the bacteria to the receiver through air, water stream, or dirty surfaces.

Friday, October 4, 2013

LED Guided Piano Playing

I built a piano teacher. I installed LED light on each piano key and turned on and off each of them to show which piano key to press for any given song. (So that any novice should be able to play piano) I don't play piano at all, and this is me playing piano with the help of the device I made. This should not be too hard to build. You will be able to see the instruction manual on how to build this device in 1 or 2 weeks from now. Android app driving the LEDs will be provided as well. As far as I know, no one made this before and I am an amateur, so it had been such a roller coaster ride building this without instruction manuals. But I wanted this device badly enough. It was fun overall. Post your comments here if you have questions.

Saturday, May 4, 2013

Cosmetics I Really Want to Build

There is something I would really like to make.
Currently, girls wear beautiful cosmetics. They are wonderful. .. but they are static. Once drawn, it stays there as it is. But wouldn't it be GREAT if it changes? I mean wouldn't it be great if we can 'spray' special LCD material onto human face so that LCD screen on human face can, like a TV, display absolutely dynamic & beautiful art patterns in the form of motion pictures?

 Yes, it is impossible. But as soon as I find such 'sprayable' LCD materials in a distant future, I am going to make cosmetics out of it. For now, maybe I can make just an LCD mask with flexible LCD like this.

I hope they are not too expensive for hobby projects....

Monday, April 29, 2013

Automated Piano Lesson with Embeded Systems

To learn Piano, it costs a fortune to hire a pianist to get lessons. So I am building piano teaching device that costs under $70 to teach myself Piano.

The basic idea goes like this: install one LED on each Piano key and turn each LED on/off to show which key to press down for each note in a song. The implementation involves an Android Phone, IOIO Board, and an LED module. I thought I was the only one who came up with the idea but it turns out there was a startup company based on this idea. Booohh

Android cannot control shift registers by directly sending out bits. Intermidiary is needed so the system like IOIO board is needed.   The project is nearly done so I will post a youtube video of me playing piano with the LED module. Standard music media format MIDI is parsed within anroid phone to send bits to the shift registers. This  can be done with external java library found by googling.

This is the photo showing the IOIO board+74HC595 Shift Registers+ Arduino Board. Why do I need Arduino board? Well I forgot to buy power supply so now Arduino's 5V Pin/Ground Pin is being used to power IOIO board. LOL. Above all, JAVA is needed to program Android and even for driving IOIO board. 

(Edited 10/9/13: Comment here if you have questions about the setup.) 


Wednesday, April 24, 2013

Python Powered Bible Reading

For Church, it is good for the church members to read the Bible everyday. 

Previously I made a python script to parse and analyze the Bible. So I launched it into a web application serving my church: if you submit your email address, everyday the web app sends HTML email containing daily bible verses.

The website is powered by Django (Python) on Amazon Web Services EC2 micro instance (Free.)  The server contains the Bible in text file so I made a python script to parse and load into Django.  The script has to run permanently so I used 'sudo nohup python &' command found by google search. The beautiful looking front end is not my work. I downloaded the template from this website. The hardest part was parsing and using Korean language within python and html. I did not know I had to declare encoding within html to serve foreign language. Django does not naturally serve media file (The beautiful CSS) so I used an inefficient way recommended here

Sunday, April 7, 2013

Flattery Generator

So if you need some sentences for flattery, you could use this webpage I made for fun! For example, it outputs entries like " YOU, painfully amazing flower, shut up and take me." each time you push a button. 
 I used some JQuerry, AWS, and Django to implement this..

Sunday, March 31, 2013

Catch a Squirrel with Arduino Electronics

There are lots of squirrel in my town, and I want to catch one of them for fun. So I made a laser trap using Arduino to catch a squirrel.

The electronics circuit is very simple. It goes: 3.3V pin -> Photoresistor -> Pull-down resistor -> Ground, so digital I/O pin measures voltage between the photoresistor and pull-down resistor. I used 5V pin and another digital pin  to run the servo that closes the trap if the reading from photoresistor drops too much (i.e. laser is blocked by the presence of squirrel.). This is the photo of the arduino setup. Notice how I try to entice a squirrel with Korean food. 

I will post the photo of the unfortunate squirrel later. Here goes the Arduino sketch.

Servo myservo;  
int pos = 0; 

void setup()

void loop()
  float v = analogRead(0)* .004882814;  

if (v > .5)
  for(pos = 0; pos < 180; pos += 1) 

Wednesday, March 6, 2013

Prototype Submitted to Make-a-thon Competition

MAKE magazine's Make-a-thon competition  awards up to $5000 for creative DYI projects submitted to their website. With my friend (a college friend I met at Rice Univ), I introduced LED guided dance floor.
It is an extended version of DDR (Dance Dance Revolution) with higher resolution and size. Take a look!

Saturday, February 9, 2013

Creative Idea Generation Helper

One of the core sources of creativity is finding useful link between
two disparate items. So I made a Django view that randomly pick two items from Webster's Unabridged Dictionary ( and show them at the same place. Then, you can try to find the interesting link between the two items that might assist your brainstorming/ideation/thinking. Visit:

Friday, February 8, 2013

The answer to the Egg-Drop Competition.

I love Egg-Drop competition. It is a very interesting competition where the contestants devise clever ways to protect an egg dropped from around 100 feet high. They are evaluated on one thing:total weight of material used to protect the egg

And I claim here that I know the ultimate answer to this. 

Squeeze two balloons together, with an egg between them. Then permanently fix them altogether by taping around the balloons.
That's it. The total weight of two balloons and the tape used is less than 4 grams. It will win you the 1st prize ALWAYS. This works because the low weight density of the balloons serve as parachute. The system weighs 4 grams always, protecting an egg drop from 'any height' .

Sunday, January 27, 2013

Run Codes On the Webpage!

Fun little project where..
1. Copy your source code (Live shell script, Python, Html, and Perl) and paste them into the text box.
2.Click the run button corresponding to each language the code belongs to.
3. See the output below the buttons. (No page reload needed, using JQuery)
(I am not going to reveal the url for this webpage, because this opens lots and lots of security holes to my server..,., Just a proof of concept.)

It was fun.  Here is the JQuery that
1)gets the code in the text box,
2) sends to the Django web server,
3)Gets the result,
4)show it to the webpage without reloading

$('button').mouseenter(function(event) {
    var text = $('textarea').val();
    var language =;

       {user: text,lng:language}, 
       function(data) {$('a#friend').html(data);}

Also you can deal with this age-old problem about how to insert the tab in the text box by: (Found by googling it)

$("textarea#1").keydown(function(e) {
    if(e.keyCode === 9) { // tab was pressed
        // get caret position/selection
        var start = this.selectionStart;
        var end = this.selectionEnd;

        var $this = $(this);
        var value = $this.val();

        // set textarea value to: text before caret + tab + text after caret
        $this.val(value.substring(0, start)
                    + "\t"
                    + value.substring(end));

        // put caret at right position again (add one for the tab)
        this.selectionStart = this.selectionEnd = start + 1;

        // prevent the focus lose

Real-Time GPS Tracking of my Android Phone

I made a website to track the location of my Android Phone real time.
Aww it was a pleasant project. But of course I cannot show the url to this for privacy reasons ;)

This is the step I took..
1 Download Android SDK. This includes IDE (eclipse with Android SDK plugin installed).  So you can create an android app project right away. Basic Android App dev tutorial
2. Give permission requests in the manifest file (internet and gps device), and follow this tutorial to get the source code to get the access to GPS device.
3. In the main java code, do http get request to send the latitude and longitude of the location to the django loaded in amazon web services. Such request is made every 5 seconds within android view.
4. Using USB debugging mode, upload and install the app.
5. Have a Django to save the location info into a text file (LOL).
6. On the webpage, use JQuery to send repetitive HTTP GET requests (every 3 seconds using setInterval() method. There is no such thing as sleep() method to put in while loop) to get current location. 
7. Use Javascript to do real-time update of the location of marker using Google maps API.
Of course the API key registration needs to be done.

Here goes the source code

Real Time Control of my Arduino Device through Webpage

I made a website where an anonymous visitor can turn on/off an LED light in my Arduino device on my desk real-time. Live video broadcast shows the LED light for live feedback. Visit
But this is now a downtime.
(What I learned here turned out to be a help for the next project. Nice)

The mechanism is:
1.You click a button.
2.JQuery detects the event and send a HTTP request. (To prevent the page from reloading)
3.The Django mounted on Ubuntu Server (amazon web services micro instance) serves the HTTP request.
4. The Django view writes to a text file saying the button was clicked.
5. And every 1 second the python program in my laptop makes ssh request to read the file to know the state (I know this is really akward)
6. The python program talks to my Arduino to turn on and off via a protyping module
7. The Ustream app on my Android Phone does live broadcasting on the LED.
8. The streaming is shown on the channel embeded to the browser
9. Additionally, I embeded a facebook comment tab.

From this point, many things can be tried to extend this idea. 

Well now is a downtime.

Friday, January 11, 2013

Analyzing the Bible with a Web Server

Finally, it's the weekend. As a celebration, I made a website that searches all the bible verses that include a keyword you want. Type in the word in the text box and submit it. The reference bible is New International Version.

Aw, this website is run on amazon web services micro instance (free tier) so please limit your searches (<100)... Also feel free to comment on the Facebook comments window.