Monday, 7 November 2011

Satellite look angle calculations

Having spent a few months searching in vain for a good source of information on satellite look angles, I finally managed to get what I needed from a friend of mine who works for NSSL Global, a small satcoms company.

I then spent a couple of days integrating the mathematics into a simple app:





The app is available here, it's free, supported by advertising provided by admob. As of today, it's been downloaded a grand total of 14 times (2 of which are by me). Advertising revenue is, as you'd expect,  pretty pathetic, but the main aim behind uploading to the market is to get some feedback regarding the accuracy of the calculations. I have tested them against various online calculators, including dishpointer, and they do seem to be correct, but I'm hoping that if there is any errors in there, they'll be picked up by people who are actively involved in satcoms.

Thursday, 27 October 2011

First Arduino and Android setup

Had a bit more of a play with the Arduino, and managed to get it connected to a handset after a few days of frustration. It appears that even with the correct version of Android, the Samsung Galaxy S2 doesn't pass the correct Vendor ID to the Arduino, meaning it's not currently possible to connect the two (at least without doing some deep firmware modifications).

Using a HTC Sensation worked perfectly first time however, as shown in this video:



The source code I used is available here;

It's basically a trimmed down version of Google's DemoKit app, which will only work with a very limited edition demonstration board. It was helpful in showing me the basic construction of an App and a Sketch that will work together though.

I have ordered a second-hand HTC Desire, which will hopefully work the same as the Sensation, as I can't borrow that for the duration of the project. I'm a little annoyed with Samsung, and the complete lack of documentation of this problem on the net.

I'm still waiting on the arrival of my servos, the next step will hopefully be connecting them to the dish and having a basic prototype operational pretty soon. I've also started work on the Look Angle Algorithms I'll be using to direct the dish.

Thursday, 20 October 2011

Arduino Mega ADK

The Arduino development board and satellite dish I ordered have arrived.


The idea is to have my app control the tilt angle and direction of the dish, using two servo motors, via the Arduino.

I've had a quick play with the first tutorial for the Arduino, a very basic Blink program. Waiting on the arrival of my servos now, this is probably going to be in a couple of week since they're coming from China. In the meantime, I'll be fiddling with the Arduino, and possibly adding to my app.

Wednesday, 19 October 2011

Upgrading to Android 2.3.4


So, I've now upgraded my phone to 2.3.4, which wasn't nearly as scary or as difficult as I was expecting it to be. As well as allowing me to use the Android Open Accessory Kit to control the USB output, it has also significantly improved the performance of the phone, and the battery life, which was a bonus. This has come at a price however, since I used an unofficial upgrade (Samsung haven't yet released 2.3.4 for the Galaxy S2), I have invalidated my warranty. Oh well!

Next step will be getting to grips with the Arduino ADK prototyping kit I have ordered.

Wednesday, 12 October 2011

Rooting my Galaxy S2

Since Samsung haven't yet released the official Android 2.3.4 upgrade, I'm going to have to use an unofficial version, which means rooting my phone and changing the ROM. Luckily, rooting is pretty straight-forward (although it does invalidate my warranty!).

It only takes about 15 minutes in total, but I have to admit it's pretty nerve-wracking. I've bricked phones in the past, but none I've ever been particularly bothered about. Fortunately, this guide is excellent, and I had no problems at all.

So now I'm in possession of a rooted handset, my next step is finding and installing an unofficial upgrade.

Tuesday, 11 October 2011

First Apps - First beta

Having got to grips with the basics of most of the functions I want my final app to use, I combined them in a simple, single screen app.


The specification of my project has changed after a meeting with my supervisor. Initially it was to be a Satellite finder with a 3D GUI, somewhat similar to Google Sky Map, but it has now been decided to have the app control a motorised satellite dish. Android allows for USB control of accessories, but only with Android 2.3.4. Annoyingly, my handset (a Galaxy S2) is only 2.3.3, so I will either have to wait for the official release or root my handset.

First Apps - GPS

Although the network location is accurate enough for what I need, I decided to have a quick play with the GPS functions. Interestingly, it's possible to obtain your current speed and altitude using the methods. The altitude is taken with respect to the Geoid however, and is not particularly useful to most people.


The accuracy is low in this screenshot as it was taken indoors, but it is possible to get accuracy of within less than 1m outdoors. The timestamp is in Unix time, that is, milliseconds since Jan 1st, 1970.

First Apps - Location from network

The next step was to obtain the handset's location from the phone. This is achieved most easily by using the getLastKnownLocation() method. This gets the most recent location data stored on the handset, which is regularly updated by the network (using mast connection data, and possibly(?) the wifi data Google collected with their StreetView cars). It isn't as accurate as using GPS, it is usually a few hundred metres out, but it will be adequate for my purposes.


The code is available here.

First Apps - Accelerometer

Once happy with the compass, I started on the accelerometer app. The idea is to display the data received from the accelerometers textually and graphically.


I tried this using both the SensorManager.getOrientation() and the Sensor.TYPE_ACCELEROMETER methods. I found the latter worked better, as the former jumped from 180 to 0 degrees, which would cause problems later on. The code for this app is available here.

First Apps - Compass

The idea is to build my final app up from individual modules, starting with a Compass app, an accelerometer app, and location apps. The first few are pretty much completed.





The above screenshots show the compass app. The arrow is rotated according to data received from the handset's magnetometer, and always points North. I used the getRotation() method from the Display class to adjust for different orientations. This means that when the handset is held in landscape mode (as I anticipate it will for most uses) the compass 'face' points out from the back of the phone, rather than the top where the magnetometer is actually situated.

The code is available here.

I have noticed how easily the compass is affected by outside sources, the magnet on its case causes particular problems. The compass is easily recalibrated by moving it in a figure of 8 shape in the air however.

Thursday, 22 September 2011

Tutorials. Hundreds of tutorials....

Haven't posted anything for a while, because I've been busy working through a load of The New Boston's youtube tutorials, which cover Java, XML, SQL, openGL and are an excellent source of information on developing Android apps. I've also worked through a book called Learning Android by Marko Gargenta. It's not quite as thorough as the youtube tutorials, but it's still a useful source of information.


I've now got a pretty good idea of what tools I'll need to use to build the app I have in mind, so I'm going to spend some more time getting the hang of them, (particularly OpenGL) before I start putting the app together. I know the app is going to make use of the following hardware;



  • Accelerometer
  • GPS reciever
  • Magnetometer (Solid State Compass)
  • Camera

So I'll also be learning how best to integrate these into my app. Back to youtube then...

Monday, 4 July 2011

Using Eclipse

After taking a week or so off, (spent wading through mud at Glastonbury) I have started trying to get to grips with using Eclipse, following the developer's guide provided by Android.com.


This is much, much more complicated than using app inventor, and since I have no experience of Java (and only limited amounts of C++), it looks like I'll be spending much of my spare time this summer learning to code. Good times!

Monday, 20 June 2011

Touch to Talk - a simple communication aid

The first app I made from scratch using app inventor was touch to talk; a basic soundboard which would allow a child with speech problems to communicate simple phrases, such as the desire for something to eat or drink.


Four global variables were created, and linked to the 4 button groups on the screen. This meant that if a mistake was made, it could be rectified by simply choosing a different button in the same button group. It also meant that the selections would be read out in a predefined order, regardless of what order they were entered. Upon hitting the 'Speak' button, the variables were read out by the TextToSpeech component from the 'Other Stuff' palette.


Not all of the app is shown on the emulator, as the screen is smaller than that of my phone, and as I mentioned in the previous post, I have been designing the apps using my phone for testing. Later on, I will hopefully learn to create apps that automatically adjust to the native screen size.




Bobo Smack - A simple game

After making the molemash tutorial app, I added a few features to it. Instead of a mole moving around the screen, I had a picture of my girlfriend, and had her record sounds which play at random when a point is scored (although not every time a point is scored, as this quickly became irritating!). I also created levels, so that the speed at which the sprite moved around increased with every ten points scored. Finally, I included a hits to misses ratio, which rated the players accuracy.


A screenshot of the app running on the App Inventor emulator is shown below. I found that connecting the blocks editor to my phone, and testing apps on that was preferrable, and only used the emulator to take screenshots.


Starting out with App Inventor

As an Electronic Engineering student due to start my final year in October this year, I have decided that my final year project will involve developing an app for Android (I have already got a particular program in mind, but will elaborate on that later). My supervisor has suggested that I maintain a blog of my experiences, as it will hopefully serve as a useful reminder of what I have done, and may be useful to future students.


I have purchased a Samsung Galaxy S2, since it comes with the features (accelerometer, magnetometer, GPS) required for the final app I intend to make. The first step so far has been to play around with Google's App Inventor service, and complete the provided tutorials.


App Inventor is designed for complete beginners, and requires no previous programming experience (I have a little C++ knowledge, but having carried out some research it seems that Java is the preferred language for Android, and Eclipse the most highly recommended IDE). It is a good way to get a general feel for how an app comes together, but its abilities are limited, and apps built using App Inventor can not be uploaded to the Android marketplace.


Having completed most of the tutorials, and built a few basic apps of my own (see later posts for details), the next step will be to install Eclipse, download the Android SDK, and start to code apps using Java.