Sunday, December 7, 2014

Two Eras of Mobile Phones

Maybe I am just repeat things people have talked about for a long time. But in my opinion, there are two eras of mobile phones. The first era is mainly hardware driven. From generation to generation, new features will be added to mobile phones most by updating to more sophisticated hardware. These new hardware updates become features which distinguish between phones. For example, one phone will support release 7 while the next generation will support release 8. In hardware-driven era, phone still needs software. But software is not at the central stage.

However, the introduce of iPhone and Android put software to the center. There comes the beginning of software-driver era of mobile phones. During this time, people put more attentions to software such as OS and app. Also, because of open source, phone software becomes accessible to virtually everyone. The start of new era also means grant shift of power in the industry. Hardware vendors’ impacts are eroding, At the same time, silicon valley also becomes the Mecca of mobile industry because of Google and Apple.

We also want to say the software era is the era for the Plebian. How many people are able to change the hardware features of his phone? Next to zero. But it turns out that almost everyone has his or her own idea about some applications, no matter it is fart or art. Apple and Google give them a chance to make it become true. As return, these two companies have literally hundreds of thousands of free-of-charge developers working for them. So the victory of iPhone and Android is also the victory of mass.

(original post published on Oct 10, 2010)

Android, 9+N+1 and Lego

Nowadays Kids have lots of toys. Toys are not equal. Some toys get more attention than others. Most are just laying in the dusty corners. Lego is favored by many children. They can play with it for a long time. Why? It is because each piece of Lego is quite simple. But the combination of many pieces can be quite sophisticated. That is why Lego is fascinating.

Similarly, like pieces of Lego, smart phone provides many sensors to us. I call the main sensors in a phone 9+N+1. “9″ stands for the small and often neglected position sensors such as digital compass, accelerometer and gyroscope. Each has 3 axis. So it is 9. “N” is the modem connecting with various wireless networks. In Nexus One, there are telephony (GSM, UMTS), bluetooth, gps and wifi. In the future, there might be more such as infrared and LTE. So we call it “N”. “1″ is the camera. “9+N+1″ lays the foundation for data transmission, location sensing, image processing, pattern recognition etc. I can extend the list on and on. But the point is that small phone gives us lots of pieces of Lego. By writing app, we can glue them together to make thousands of different shapes. If you consider that we can connect some peripherals to the phone by USB or through audio jacket, we will have even more pieces of Lego. And the number of combination of final products will increase exponentially.  The real and final boundary will be our imagination!

(original post published on Oct 10, 2010)

The Location Of Magnetometer In The Smartphone

Metal detector applications in smartphone use magnetometer to detect the variation of magnetic field strength. Since magnetic field influence decays with distance, it is important to make the magnetometer close to the target as much as possible. However, magnetometer IC is a small block sealed inside of the phone. How can we know its location? If you look the part I of the following video, it gives some tips.
The proposed approach is to move a steel bar around the phone and find the spot generating the strongest magnetic strength reading. The phone used in the video is Nexus One produced by Google. The conclusion is that lower left corner of the phone is the approximate location of magnetometer sensor IC.
To provide more evidence, we checked various teardown reports of Nexus One smartphone. One interesting image we found is from ifixit teardown repot (http://www.ifixit.com/Teardown/Nexus-One-Teardown/1654/2).AK8973 is the magnetometer IC name. This PCB board is at lower part of the phone and it is bottom view of the board. Therefore, we know that the magnetometer is located near lower left corner of Nexus One phone. Same as what we find by steel bar.
I also tried the same steel bar trick with iPhone 3GS. It turns out that we should use the upper right part of 3GS for metal detector. To confirm, we searched 3GS teardown reports and find the this picture fromhttp://www.appleinsider.com/articles/09/06/24/cost_to_build_apples_new_iphone_3g_s_estimated_at_179.html
This page shows the main PCB board. The left part of this picture corresponds to the top of the phone. Also, this is the bottom view of the board. So the location of the magnetometer IC (AK8973) is the upper right edge of the 3GS phone. Same as we found by steel bar!

(original post published in Dec 19, 2010)

What We Have Learned From Writing Android App

  Writing Android App is an interesting experience. It is rewarding to see that your product is used by folks from South Africa to Canada. In the last a few months as I worked on the application “Magnetic Stud Finder”, I learned a few things, and I am willing to share with you. In fact, I am still learning and there is a long way to go.
  • Consider the variety of Android device
Android is promising because so many vendors provide solutions based on it. It guarantee that your Android apps have a large user base. However, it also poses problem to developers. Unlike iPhone developers who only need to consider 2 or 3 phones, Android developers need to face some many different devices. It is very difficult. For example, you wrote some code to provide location service. It worked quite well in your Nexus one phone. But later you find that it failed to work on Samsung Galaxy-S. Why? Is Android operation system supposed to be uniform? The reality is that phones from different vendors have subtle difference. All phones are based on Android. But because Android is open source, vendors can modify it to adapt to their needs. Vendors are motivated to customize because that is how they differentiate themselves. My observation is that for high level API such as drawing pictures or placing buttons, phones from multiple vendors behave quite consistently. The variation appears when some lower level APIs are touched such as location service or wireless network access. There is no easy solution to this problem. One way is to conceive various situations and write codes in a robust way. But things can be hard to predict. The ultimate solution is to own phones from major vendors and test on all of them. But for individual developers it means hard choice.
  • Don’t assume too much on users
People are busy nowadays. There are so many wonderful applications for them to explore. In addition, there are TV, Youtube and Facebook etc. So don’t expect that they will use 30 mins to learn how to use your app. For 95% users, if they can’t use the app in 2 minutes smoothly, your app is done! You might wonder that why people don’t look at those fantastic help information. They just don’t have time. So make sure that you put critical information in the premium location. Also use alert to deliver the message so that there is no way to avoid it. Many Android developers are technically savvy. They are proud of the smart design of the software. But make sure that your user interface and assistance information are equally smart.
  • Be cautious on cloud service
In order to design a successful and user-friendly application, you need to test , test, test! But sometimes testing is hard. For example, your app need to access some cloud service. At the time you released the app, service was tested and everything is fine. However, a week later, the server started to hiccup. Users complained and single-star ratings added. What can you do? At the end of the day, cloud service and server are not controlled by you. So the lesson learned is that if you have to pick up add some cloud service, you better be cautious. Before deciding to use it, you should monitor it for some time and make sure that the service provided is consistent and reliable.

(original post published in Jan 23, 2011)

Conversion between Quaternion and rotation matrix

There are different ways to represent rotation in 3D space including Quaternion, rotation matrix and others. Often people need to convert between them. Here we want to share some Matlab scripts to convert between Quaternion and rotation matrix. Rotation matrix, R, is a 3x3 unitary matrix. The quaternion has four element, w, x, y, z whereas w is the rotation angle and x,y,z represent the rotation axis. w^2+x^2+y^2+z^2=1.

The function to convert quaternion to rotation matrix R:
 function R = quaternion2R(w, x, y, z)  
 R(1,1) = 1-2*y^2-2*z^2;  
 R(1,2) = 2*x*y-2*z*w;  
 R(1,3) = 2*x*z+2*y*w;  
 R(2,1) = 2*x*y+2*z*w;  
 R(2,2) = 1-2*x^2-2*z^2;  
 R(2,3) = 2*y*z-2*x*w;  
 R(3,1) = 2*x*z-2*y*w;  
 R(3,2) = 2*y*z+2*x*w;  
 R(3,3) = 1-2*x^2-2*y^2;  


The function to convert rotation matrix R to quaternion:
 function [w,x,y,z] = R2quaternion(R)  
 t = R(1,1)+R(2,2)+R(3,3);  
 r = sqrt(1+t);  
 s = 0.5/r;  
 w = 0.5*r;  
 x = (R(3,2)-R(2,3))*s;  
 y = (R(1,3)-R(3,1))*s;  
 z = (R(2,1)-R(1,2))*s;