I've been trying to make a start in using Android for remote control of devices. No actual motors have been moved in the making of these notes yet. Thought it might be worthwhile to put together some notes for others interested in the same thing to see where that leads.
I've not managed to find anything on line yet for a group working on control of astronomical devices from Android devices.
I've managed to get my HTC Wildfire talking to a serial bluetooth module hooked to an Anduio Mega, at this stage trying to get the com's more reliable.
Still very early days for me so if more experienced programmers spot errors please correct them.
I'm on android 2.2 which appears to still be very limited by way of USB support for external devices and I'd like if possible to be wireless where practical hence the use of bluetooth. Wi-fi gives the impression that it would be more complex.
There are a heap of tutorials online about getting started with Android programming (which is mostly done in Java). One which seems to cover it is at
http://mobileorchard.com/introductio...d-development/
He has a range of articles most of which I've not used yet.
http://mobileorchard.com/category/tutorials/android/
Also some useful notes on setting up at
http://developer.android.com/sdk/installing.html
It is possible to work directly with the Android SDK without Eclipse but I've not tried it.
The stuff I'm doing is based on a modified version of the bluetooth-chat sample which is included with the Android SDK . You can build a new android project based on a sample as an option when you start the wizard for a new project.
A bug in the bluetooth stack used by a lot of android devices means that the sample project probably won't connect to a bluetooth serial device. A dodgy workaround is to set a generic UUID, in the bluetoothchatservice.java file (under the src area) set the UUID
// Unique UUID for this application
private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
There are other alternatives which work around the bug and possibly get a real UUID using a dedicated app, intents etc but I've not managed to get the simpler ones working and there was mention of other stuff not working, factory resets etc afterwards so I'm leaving that for now.
The worst failure I've had is having to restart the phone by pulling the battery out.
I'm using an Arduino Mega on the other end of the bluetooth comms at the moment so that I have multiple serial ports. Eventually I'd like to either use one of the smaller Arduino's to drive a focuser or hook a bluetooth module directly to a mount's TTL serial port (an Android EQMOD?). Note for experimenters, the serial ports intended to talk to PC serial ports are not the right voltages and would need interfacing.
I gather that the baud rate is not relevant for Bluetooth itself and I'm running the Serial3 port which is connected to the Bluetooth module at 115200.
I'll post my Arduino code in a follow up post, pretty basic and just for testing. I've started adding in the Skywatcher API commands but the Arduino so far does very little except let me know what it's received.
The Skywatcher API is published at
http://code.google.com/p/skywatcher/...atcherProtocol and via
http://code.google.com/p/skywatcher/
Still a lot of learning to go but I'm hoping that my learning's may prompt some useful discussion or help someone else get started. The ultimate goal out of all this with be an ASCOM like approach to Android control of Astronomical devices. I'd also like to see something like EQMOD available via Android (preferably with an Alt/Az option for motorised Dob's).
Please also note, all care no responsibility. Writing apps for your phone or tablet using the Android SDK and Eclipse should be safe but I'm not responsible if you manage to make a lightweight brick of that expensive gadget.
Bob