Driving a brushless DC motor using an Arduino

There are several samples on the web, that show a brushless DC motor being driven using an Arduino and an RC ESC. Most of these samples come without sketch sources, and that is kind of lame.

Now, that I am building my own ROV (more on that soon, maybe), I had a need for a solution, as most of what's on the web was either over-complicated or just didn't work. Controlling an brushless DC motor via an ESC using an Arduino is surprisingly simple, yet  a bit frustrating at times due to three facts:
  1. ESCs seem not to come with pulse widths defined (min, max) in their manuals. At least not the HobbyKing Quik 60A and the Flyermate 80A.
  2. Even if "auto throttle range" is supported, it still needs to be within an acceptable range.
  3. Figuring out the ideal range can be "labor intensive".
Below is a sketch that works just perfect with both the Quik 60A and the Flyermate 80A. The only difference between the two is that the Flyermate seems to respond better to a shorter range of 700 - 1700, while the Quik responds to 700 - 2300.

Tested on Arduino Mega2560.

Working with Google Docs and OAuth on Android (part two)

In part one I have described the process of obtaining an OAuth access token for Google Apps. Part two will focus on the implementation of that process, and then - in part three - I will show you how to use the OAuth credentials to retrieve data from Google Docs. If you're not bothered reading and just want the sample code click here. I am skipping a lot of things below, so you will want to download that sample code anyway.

Let's start with creating a simple layout containing two buttons and a text view. Call the buttons B1 and B2, and the text view T1. I will leave this part as an exercise.

Working with Google Docs and OAuth on Android (part one)

As you may know already know I have recently released my very first application on Android Market. It is doing well with nearly 6000 downloads and close to 4000 active users. In the process of learning the Android SDK and refreshing my (minimal) Java skills, I have stumbled upon the problem of interacting with Google services, mostly Google Docs.

First of all, there is as of now no stable Google Docs API for Android. The recently released google-api-java-client is an early alpha both in usability as well as stability terms. The currently stable gdata-java-client library does not work on Android. So what are the options?

Extracting ROM files from a HTC Android RUU

Official HTC ROM updates are released as RUUs (RUU = ROM Update Utility), which you run on your (Windows) PC to get the target device updated automatically. However convenient, RUUs have a major fault in the context of ROM customization: they don't support any. Some of the big brains in the Android community release RUUs re-packaged into signed update files, which in turn allow for whatever ROM customization you can imagine.

In this entry I will show you how to extract ROM files from a RUU image, which you can then customize and use to flash your device without the fear of a new bootloader possibly making your device unrootable.

Prerequisites:

This how-to is based on the 2.73.405.5 RUU for HTC Hero (GSM) released in late 2009, but has been verified as 100% working on the latest Android 2.1 RUU released in mid-2010.

Upgrading PHP on Red Hat 5

As you may know, Red Hat Linux 5 comes with PHP5 in a pre-packaged form. However, due to the OS' long release cycle, you may find that the supplied version is at least one major release (and several minor) behind the current standalone "stable" release. At the time of writing, Red Hat 5 ships with PHP version 5.1.6, while the standalone stable releases are 5.3.1 and 5.2.12. In some cases this may become an issue, especially if your PHP code relies on newer features not present in the Red Hat supplied binaries.

One solution is to switch to a Linux distribution with a more sane approach to its software base, but if that is not feasible the only choice is to do an "out-of-band" upgrade. Below I will describe how to build a set of PHP5 binaries that closely (but not entirely) replicate those supplied by Red Hat.

Moving from Wordpress to Blogger

If you are reading this it is highly likely you are thinking about moving your blog from the Wordpress platform to Blogger. I have just done this a few days ago, so here are my field notes and thoughts on the entire process.

Wordpress is a great blogging platform, clearly superior to Blogger. However for me, as a sysadmin, it has one major downside - frequency of updates. There are several big updates a year and at least one or more major releases. This is not a problem if somebody is doing the updates for you, e.g. your hosting provider, but becomes a nuisance once you get to do it yourself. Especially if you are someone like me, who has a blog to use it as a "memory dump" of sorts rather than anything else.

So, at some stage, you may consider changing the platform and look into moving to Blogger. You could move to hosted Wordpress but there is a catch - wordpress.com will charge you for hosting a blog under your own domain man. Blogger does this for free.

Initially the whole platform change process seems like a daunting task with all the differences in templates, layout and how things are done in the back-end. But let's be honest - the most important part of any blog is the content. Read on for a few tips that will hopefully help you move place.

Configuring network interfaces in reverse order under Red Hat 5

As you may know, network interfaces under Red Hat 5 are configured in numerical order, with eth0 followed by eth1, eth2 and so on. The default gateway will by default be configured for that of the last interfaces to be brought up. Sometimes this is less than optimal. For example you may have two interfaces, the first one dedicated to normal traffic, the other one for storage traffic or some other non-default use. You probably do not want all you traffic to go via the second gateway, but by default it will.