Tuesday, February 28, 2012

2nd project: Android controlled LED lighting

Overview
This project is about the use of an android phone to control LEDs via bluetooth. The system basically consist of an android phone, Arduino UNO, and bluetooth module. The android phone, through an application, sends data to Arduino via bluetooth. The Arduino UNO prototyping module then process the data from the android phone and control the brightness of each LED. The brightness control of each LED is implemented by using PWM pins of the Arduino UNO. The hardware can be powered by a 9V battery or a DC supply between 9 to 12V.

The Android Application
The application is made using sliders to vary the brightness of the LEDs. Each slider has a value of 0 to 255 from which  internet colors can be easily reproduced using the 3 sliders. Establishing the communication link is also done in the application. Basically, the app can search for other bluetooth devices, query for paired devices, establish RFCOMM channels/sockets, connect to a device, and send data over bluetooth.

Arduino UNO
Arduino UNO is an open-source electronics prototyping platform based on a flexible, easy-to-use hardware and software. It serves as the processor of the data from android phone. The value 0 to 255 from the android phone is translated to PWM wave with a frequency of approximately 490Hz to the pins 9, 10, and 11.

Bluetooth Module
The datasheet states that signal can reach up to 100m but actual distance may depend on the other communicating device. This module is using the UART interface in SPP configuration to connect to the Arduino UNO. In essence, the bluetooth module acts as a cable replacement between two devices.

Below is a demo video of the project.

Monday, February 13, 2012

Test and Debug

After writing your codes, it's time to test my application.

Using Android Virtual Emulator
One way to test your application is to run it on a virtual device.  The Android Virtual Device is included in the Android SDK tools.

1. Run the AVD manager.
On Eclipse, click Windows > Android SDK and AVD Manager.

2. Create a new virtual device.
- Name: virtual_galaxyS
- Target: Android 2.2
- SD card size: 512MiB
- Skin: Built-in: HVGA

* You can create several AVD with different screen sizes and Target versions.

3. Run your application.
On Eclipse, click Run > Run

* If you have multiple AVD, choose one that you want to use.

Now, have you made a good, working app already? Then good for you but most of the cases, it's not. So we need to debug.

Debugging

In debugging, the DDMS and DEBUG perspective view in the Eclipse IDE are  helpful.


The Debug Perspective in

Monday, July 25, 2011

Making new Android project

In the succeeding posts, I will try to present my workflow in developing an android app using the RB Pace Calculator as an example.

Let's start.

From my previous post, Hello Android World! and How to get started?, I would assume that you already have the necessary things to start Android development.

In this time being, below are my development tools/platform.
1. PC - Toshiba R830 (Intel Core i5-2410M, 2.3GHz, 6GB DDR3)
2. Win7 Pro 64bit
3. Eclipse (Helios Service Release 2) with Android SDK tools.
4. Java Development kit (v1.6.0.250)
5. Samsung GalaxyS (Android v2.3.3) - used for testing my apps.

Procedure

1. Create a new Android project in eclipse.
In this case:
- Project Name: RB Pace Calculator
- Create new project in workspace.
- Build Target: Android 2.2
- Application name: RB Pace Calculator
- Package Name: com.fmvf.pacer
- [check] Create Activity: convert
- Min SDK version: 8
- Finish

2. Design the 'view' of your application.
In this case, I made

Thursday, July 21, 2011

RB Pace calculator

My very first Android app


Are you a runner? Do you use Android phone?
Then this application might be useful for you

Finally, here is my first Android app. It is a simple application I made for runners to calculate for their average pace for a race. Being a runner myself, I thought that this application could be useful to become handy in a runner's phone. It was actually based from an application that I made for my running group's website.


You may download it here.
Android v2.2 and above.


Please feel free to comment, suggest and report bugs in the comments section.



Saturday, June 25, 2011

Finally Upgraded to Gingerbread

I bought my Samsung Galaxy S with the Froyo version installed on it and since the Gingerbread update was released, I was very eager to upgrade mine. The most convenient way to update is to use the Kies software as provided by Samsung. Plug your phone, run the software, and update. That easy! (or just as I thought). It could have been that easy if I had known the problems that can be encountered in using Samsung Kies. 

Tirelessly waiting..
On my first try, I backed up my phone (contacts, pictures videos, etc.) first. When I started the Samsung Kies, it immediately prompt me that a firmware upgrade is available for my phone. And with eagerness, I clicked the "upgrade" button and it started. For a few minutes waiting, I noticed that the status bar was not moving. Thinking that it was just possibly a server or network slow down, I still waited for a few minutes until I finally gave up. Around 40 mins gone, still 0% in the progress bar. Since it is just my first try, it is worth for another one. But still the same thing happened. What could be the problem? My phone? My laptop? Time to ask for help to my friend (Google).

Consulting my friend
So I search for answers over the internet but all I can find are procedures that are the same of what I did.  Another option is to manually flash your phone using Odin which I don't want to try. Although I was tempted to manually flash my phone, I still did not try because I want the official release version. So I kept searching until I came across with a forum with their topic about upgrading using Kies. Someone told that he was experiencing problems in upgrading his phone thru Kies and found out that his internet connection seems to be the culprit. He was using a mobile broadband connection. It makes sense because I am also using

Thursday, December 30, 2010

Android Versions (sounds tasty)

Quite interesting about Android is their version code naming. You may notice that their version code names are based on dessert names. Here is a brief summary of the features of each version.

v1.5 (Cupcake) - This is the first major platform release for phones.
  • Ability to record and watch videos through camcorder mode
  • Uploading videos to YouTube and pictures to Picasa directly from the phone
  • A new soft-keyboard with text-prediction
  • Bluetooth A2DP and AVRCP support
  • Ability to automatically connect to a Bluetooth headset within a certain distance
  • New widgets and folders that can populate the Home screens
  • Animated screen transitions

v1.6 (Donut)
  • An improved Android Market experience
  • An integrated camera, camcorder, and gallery interface
  • Gallery now enables users to select multiple photos for deletion
  • Updated Voice Search, with faster response and deeper integration with native applications, including the ability to dial contacts
  • Updated search experience to allow searching bookmarks, history, contacts, and the web from the home screen
  • Updated technology support for

Sunday, December 26, 2010

How to get started?

This would be the very first question of any beginner like me. How to start? Where to start? What do I need? Well, as long as you have already set up your Development PC (as in previous post) then we can say that we have already started. As for me, I used the Eclipse IDE as this is what I commonly read so I assumed I can get a lot of help in the net.

I already have my IDE with ADT plugin installed, now what?
Make sure that your PC have been setup properly including all the components needed. If you have a background on java programming, then it will be a lot easier for you. But for me who is without java experience, I better start reading a lot and browse through sample codes. My usual technique in programming is to see sample codes then learn from it how each syntax was used.

Some things to consider before starting actual project

1. App layout - this could be something to think about since a lot of android devices are coming out today. Smartphones and tablets comes with different screen sizes so better design your layout properly.

2. API level - which API level would you like to support or which phone features would you like to use? Since Android OS itself is continuing to develop, there could be a lot of changes in different android versions and some features might not be available yet on previous versions. I'll give an overview of the android versions later to help you decide

3. Target users - As of today, devices are running on different android versions. So which version/s would you like to support? This graph could help you in deciding based on percentage of users of each version. You may notice that android 1.5 and 1.6 users are declining while android 2.1 and 2.2 users are increasing.