Review: OnePlus 2

February 2016 | Dios Kurniawan

It raised eyebrows whenever I told friends what phone I had bought; a OnePlus Two. No one has ever heard of OnePlus, let alone the ‘Two’ model (there is OnePlus One which came before it). The company/brand name is new, and their products are not sold in stores in Jakarta, so it is quite normal to see that OnePlus is still far away from stardom and fame. Because many have asked why I had chosen this never-heard-of phone, so I guess it is good to write a short review of it.

Few months ago, I started to feel the need to get a dual-SIM phone because I began to dislike the idea of carrying two phones everyday. I needed a one powerful phone to replace both my trustworthy Samsung S5 and my 3-year-old BlackBerry Q10. I usually keep two phone numbers with me, one for business and the other one for personal contacts. Therefore, carrying one phone instead of two while keeping my both SIM cards active in a dual-SIM device sounds like a promising move.

So I went to the market to check what’s available, and OnePlus 2 came to the top of my list. OnePlus 2 (or OPT, as some users call it) offers a slick build and strong specs that only expensive ‘flagship phones’ carry.

OnePlus 2 is a 5.5-incher smartphone equipped with a powerful processor, large RAM and a decent camera. It has dual SIM slots, which is the main reason why I chose this phone. It is a feature something the other flagship contender such as Samsung S6 or Sony Z3 simply do not possess. The metal frame and the iconic sandpaper back cover help the look.

What I Like About OPT:

  • Strong top-notch Snapdragon 810 processor and the whopping amount of 4GB RAM – never again I have experienced lags or sluggishness. It handles everything I throw at it very well.
  • The fingerprint scanner; it’s very fast and accurate. It is way much better than the swipe fingerprint scanner of my old Samsung S5, which most of the time is a hit-and-miss action. With OPT, I can unlock my phone with fingerprint almost 100% of the time.
  • The physical ‘Alert Slider’ which allows me to put the phone into silent mode instantly without even looking at the screen. A simple idea which helps a lot.
  • Multi-user This feature is actually part of Android 5 release, but somehow not all device manufacturers have enabled this capability in their products. OPT with its own Oxygen OS, is very close to stock Android and lets me use this multi-user feature with no restriction. This feature comes up very handy as now I can have multiple WhatsApp account, Google account etc. on a single phone. Very neat!
  • The reversible USB Type-C Being able to plug the cable without looking at the orientation is really a convenience. The connectors are stronger that ordinary USB, too.

What I Don’t Like:

  • The LCD screen. I have the impression that its 5.5-inch display could have been better. It does not deliver any real pop, and colors look less striking compared to Super AMOLED screen of my Samsung S5. AMOLED technology allows displays to produce deeper and richer blacks, making the pictures look more dynamic, which is not the case with OPT’s screen.
  • It’s heavy. OPT is, in my opinion, very heavy and feels bulky. Perhaps because I used to use Samsung S5, a much lighter, plasticky device.  I just wish OPT could be lighter.
  • Does not support LTE / 4G. I was unlucky to get a Chinese version (A2001) that did not support LTE/4G bands in Indonesia. Learning from the online forums, there is another version which does supports 4G bands, it is called A2003. So readers who are interested to buy OPT, I strongly recommend you to get the A2003 version.
  • No infrared I used to have fun with infrared remote control apps in my Samsung S5, allowing me to control TV sets, airconditioners and other home appliances. Too bad, I lost this when I migrated to OPT.
  • The battery does not last very long. A single charge can only last 7-8 hours, even after I removed all power-hungry apps. This is still a mystery to me to understand what is causing the power drain.
  • The metal frame needs a protective cover.
  • It’s not cheap. At S$580, I cannot say this is a cheap phone.

Overall, OPT is a good buy and I enjoy every moment using it.

Holiday Project: Simple IoT Experiment

September 2015 | Dios Kurniawan

Last Lebaran holiday in July was a good time for me to jump back into my programming hobby. Quiet days, no interruptions and no deadlines. It was really a good time to delve into coding. Well, programming is actually much more fun if it is only a hobby when you can choose what real-life problems you want to solve with your software, pick the language you like, and choose how to do it. This time, I got about a week worth of leisure time, and I decided to create a solution to one domestic problem: a refrigerator door sensor.

A remote sensor for refrigerator

Let’s be more clear with the requirement. The problem definition is: I want to know how many Magnum Mini ice cream packs are left in my fridge. Yes, ice cream. My daughter loves to eat Magnum Mini while the same is true for me. It creates some sort of competition situation, either she or myself would eat up the ice cream. Nothing more upsetting to me than seeing no more Magnum Mini is left in the fridge each time I got home from work. I wish I could have an app in my hands telling me if my ice cream supply falls short, so I could stop by at local groceries store on my way home to restock the ice cream. I was thinking about some kind of a camera that monitors the inside the freezer, or a counter device to see how many times the fridge door is opened each day, but I could not find such thing in local DIY shops. Enter Android smartphones.

My stockpile of Magnum Minis in the fridge

Nearly all Android phones today are equipped with built-in accelerometers. This sensor is good for measuring the acceleration force that is applied to a device on all three physical axis (x, y, and z), including the force of gravity. Just like an aircraft, an Android device orientation is also defined by pitch, roll and azimuth. So why don’t we use this sensor for detecting door movements? Simply attach a cheap Android phone on the door and let it run to detect motion. All we need is an app that reads the accelerometer and sends the data over the internet thru Wi-Fi or 3G connection, basically turning an Android device into a remote sensor, or as some people prefer to call it : an M2M (machine-to-machine) sensor.

Device orientation variables for detecting open-close state

For this purpose, I wrote a simple Android app (I named “dSensor“) that reads the accelerometer sensor, detects movement and sends the event over the Wi-Fi to a remote server, which in turn will store the data. I do not intend to create anything overly complex because I understand a decent movement detection algorithm would need an in-depth study on digital signal processing theories. I would try to skip that and make the detection function as simple as it can. Simply detect changes in orientation and trigger the event to send data. Luckily, Android provides pretty complete library for accessing sensors under android.hardware.Sensor package.

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;

Quite straight forward, detecting door’s open/closed position is achieved by implementing code in the onSensorChanged() event. The movement detection is implemented using accelerometer which in turn would trigger detection using magnetic field sensor, to determine if the door is opened or closed.

@Override public void onSensorChanged(SensorEvent event) { 
 if(event.sensor.getType()==Sensor.TYPE_ACCELEROMETER) { 
 //detect any slight movement to trigger door check 
 if(event.sensor.getType()==Sensor.TYPE_MAGNETIC_FIELD) { 
 //get azimuth, pitch & roll to check if door is open or closed 

After a couple days of coding, my first prototype app was ready to test. For this purpose I used my 4-year-old Samsung Galaxy Y which had been lying around unused at my house for quite a long time. This old smartphone is glued on the fridge’s door with its battery charger permanently attached, and continuously running the app in the foreground.

Android app to detect motion and send the data over Wi-Fi

The Android phone is attached to the fridge, acting as a sensor

Data from the device is transferred in JSON format via HTTP and is then stored in a database. Initially I chose MySQL, but later I moved to MongoDB (a NoSQL database) to take advantage of its scalability. I also created a simple web application to display the reports.

| time stamp          | azimuth    | pitch    | roll       |
| 2015-08-23 20:55:28 | 36.71875   | -25      | 11.5234375 |
| 2015-08-23 20:50:27 | 36.71875   | -25.7812 | 12.3046875 |
| 2015-08-23 20:45:26 | 35.9375    | -25      | 13.0859375 |
| 2015-08-23 20:40:25 | 39.84375   | -25      | 9.9609375  |
| 2015-08-23 20:35:24 | 39.84375   | -25      | 9.9609375  |
| 2015-08-23 20:30:23 | 39.84375   | -24.2187 | 9.9609375  |
| 2015-08-23 20:25:32 | 40.625     | -25      | 9.9609375  |
| 2015-08-23 20:20:21 | 39.84375   | -25      | 9.9609375  |
| 2015-08-23 20:15:20 | 39.84375   | -25      | 9.9609375  |
| 2015-08-23 20:10:18 | 35.9375    | -26.5625 | 8.3984375  |
| 2015-08-23 20:05:18 | 37.5       | -25      | 11.5234375 |
| 2015-08-23 20:00:16 | 37.5       | -25.7815 | 12.3046875 |

Now the analysis part. The raw data sent from the sensor tells me how many times the door is opened, but it cannot tell me how many ice cream packs are still in the fridge. The approach is to make an assumption that each time the door is opened, one Magnum Mini is taken out. I understand that my kids get home from school at around 3 PM, therefore any door opening event during the time until they get to sleep at around 10 PM can be assumed that my kids are extracting Magnum Minis from the fridge. Using simple if-then statements, each time the door is opened during this period, the number of ice cream counter is subtracted by one. Of course in reality it is not that simple as there may be other things inside the fridge, but at least that’s the closest approximation.

The application would require me to adjust the counter each time I restock my ice cream. Subsequently, the application will count how many ice cream has been consumed and will display the (estimated) remaining number in my fridge. Now, I can remotely view this information at my fingertips anywhere I have access to my web application. Pretty neat.

Web application shows how many times door has been opened during the day, and estimate how many remaining ice cream are still there

Not limited to refrigerators and ice cream, my sensor-on-a-phone solution can also be used on doors to detect theft, to count how many people entering a room, and many other uses. I am now working on modifying the code to detect motion and even vibration in my car. This demonstrates that a pretty versatile sensor can be had with a old, cheap hardware (under $30) which would otherwise become electronic waste.

Theft Detector

My simple project here highlights the vast opportunity to use Android devices for sensors, especially in light of the emergence of IoT (Internet of Things) trends. This is just a simple experiment, but the potential use case is limitless. There is nothing as exciting as starting a new project and seeing it evolve.