After lots of searching, I struggled to figure out how to disable mobile browsers (i.e. Android/iPhone browsers) zoom function so I thought I would share it since its important for developing games and more advanced mobile sites.
I can confirm that the following works on the Android browser. Feel free to confirm for others like iPhone and Windows Mobile.
You may have noticed but I decided to change my blog from garr.me to garrows.com. All links to garr.me will still work too.
The decision comes as I realised that garr.me just looks dodgy and probably scared off some people. So here we have, a completely safe looking http://garrows.com
There has been a few tutorials now on how to get an Android phone to communicate over its serial port although these have always been one directional (phone being the source).
Until now.
Assumptions
I’m going to assume that you have already got the single direction cable working. If not, check out the following tutorials.
You will need a Logic Level Converter if you don’t already have one. I used this one from SparkFun which allows 2 way conversion for up to 2 serial ports.
Pin 4 of the extUSB connector (which has been marked as not connected in previous tutorials) is the logic high voltage of 2.8volts. We need this for our logic level converter so solder an extra wire onto it. What we want is
ExtUSB Pins
LLC Pins
4
LV
7
GND (low voltage side)
8
TX1
9
RX1
Now connect up the high voltage side to what ever you want. I’m going to assume its a Arduino.
LLC Pins
Arduino Pins
HV
5V
GND (HV side)
GND
TX1
0 RX
RX1
1 TX
Testing
To test that I can actually receive serial on the Android, I wrote some code on the Arduino that transmits hello every second and some python script on the Android that prints anything it reads to screen.
And what you have all been waiting for…. Android
import os
print "Ready\n"
process = os.popen('cat /dev/ttyMSM2')
while process:
print process.readline()
print "Exiting\n"
Problems
If you are using the default CyanogenMod ROM, you will probably find that when you send something from the Arduino to the Android, it will invoke some sort of kernel serial debugging routine which spits out some data back to the Arduino. This is particually a problem if you get your Arduino to print something to serial for every byte that it recieves as this will create a massive flow of data.
Currently the cellbot.com team and I are working on disabling the serial debugging routine and will post back here when we get a fix.
The following is output after sending certain inputs to the Android. First line is the input, second line is the output bytes, third line is the bytes converted to ASCII.
After the long wait for parts and struggling to find spare time, I have finally managed to give my robot its first test run.
For the test run I used the android script and arduino code from the nice folks over at cellbots.com. It struggles with turning since the code is designed for smaller wheels but works well other wise.
My setup is very simular to cellbot’s Truckbot althogh I have wired up my android have the ability to send and receive serial communications (for sensor reading) and to have another servo to move the angle of the phone but it isn’t using either of those yet.
The next steps are:
1. Merge my arduino code with cellbot’s code to enable 2 way serial communicaiton.
2. Create a android application that mimics the abilities of the script.
3. Expand on the android application to use the sensor readings from the arduino.
4. Make the android application autonomous & intelligent.
Finally got my DSO Nano today and thought that there might actually be some people interested in it since a $80 pocket sized, open source, oscilloscope.
Btw, sorry about the dirty fingernails. Was working on my bicycle earlier.
UPDATE: Available from April 27 from $60/month or $780 outright.
Telstra has announced that they will be selling their first Android powered phone, the HTC Desire. The announcement was officially made this morning at the Mobile World Congress in Barcelona.
Australians have been eagerly waiting for an Android powered phone on Telstra’s superior NextG network ever since Optus released the HTC Dream and the HTC Desire definitely impresses. Said to be the sister to the Nexus One, it totes a 1GHz Snapdragon processor, 3.7inch AMOLED display, Android version 2.1, Flash 10.1 compatibility, and HTC’s SenseUI.
“It will be priced aggressively, that’s all we can share at this stage. We’ve had lots of interest and excitement around HTC and combined with the Next G network’s speed and coverage, you can’t get a better combination.” – Telstra’s Ross Fielding
Telstra is expecting to release it as of April 2010 and has acquired a 3 month exclusivity deal in Australia.
A demonstration of the new version of Windows Mobile has appeared on Engadget today and as a Windows Mobile developer, I am unimpressed.
Traditionally, Windows Mobile has been for business applications in PDAs, not consumer phones. For example, Motorola/Symbol have been using their Windows Mobile in their PDA based barcode scanners for years. The MC9090 is a particular type that is very popular with a Stock Tracking application I wrote.
The problem I have as a business applications developer is, it’s already far too complicated for the typical users. They struggle running a program if it’s not in the quick list of the start bar. They don’t want to be swiping squares around the place. They want it to be simple, easy to type on and easy to run their business applications.
Windows Mobile 7 simply destroys it’s established market, to try and take a share of an over inflated market.
Don’t get me wrong, it’s not a bad looking phone for the phone market but it shouldn’t be heading for the phone market. iPhone and Android phones have failed in the business market because they lack in group control and because 90% of business apps are written in .NET because of the rapid development times.
Microsoft, don’t make businesses switch back to Windows CE :’(
This set of instructions assumes that you have some knowledge of .NET programming. The instructions are written in VB.NET using Visual Studio 2008 and is deployed on a Windows Mobile 6.1 Device although they are applicable for C# and some different versions of Visual Studio and Windows Mobile. It also assumes that you have connected your device via Microsoft ActiveSync.
Create The Projects
Open Visual Studio, File, New Project. Under project types on the left hand side, find “Smart Device” in the list then select the ‘Smart Device
Project’ on the template side. Click the OK button.
Select the corresponding ‘Target platform’. I chose ‘Windows Mobile 6 Professional SDK’. Select your desired framework. Most WM (Windows Mobile) devices come with .NET 2.0 but if it doesn’t, you will need to install it on the device. Same for .NET 3.5 etc. Select the Device Application template then the OK button.
Hello World Application
You will now have a design view that looks like a dorky phone. Add a button to it. Double click the button to generate the click event in code. Put the following code into it. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("Hello world") Button1.Text = "Hello" End Sub
Ensure the code compiles by building the project (Ctrl + Shift + B).
Debugging
You have a couple of different options when debugging a WM application. You can either use an emulator or your actual device that is connected via ActiveSync. I find it is faster to use the actual device. Select the desired debug device in your toolbar. Select which ever one suits best. When you give the debug command (F5) you may be prompted again for this value. Debugging the project with the emulator will give you a new window once everything is built, the emulator is started, the code is deployed and executed. This may take some time. Once your finished clicking your hello world button, you can keep the emulator open to speed up the next debug session. In WM, when you click the “X” button up the top right, the program doesn’t actually close unlike Windows XP,etc. Instead, it will go into a ‘deactive’ state. So if you click the X button, the debug mode is still running. If you don’t like this “feature”, you can handle the Deactivate event and close the program like so. Private Sub Form1_Deactivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Deactivate Me.Close() End Sub
Compact Framework Limitations
You might have noticed by now that there isn’t all the controls and libraries available. This is because your not using the FULL .NET library, you are using the ‘Compact Framework’ library. Usually its not possible to fit the entire library on the mobile’s limited memory. You will simply have to deal with a lack of features.
Deployment
We have written our award winning WM application. Now we have to get it out there. Unfortunately we can’t just post an exe or use click once. We need to create a ‘.CAB’ file. This is done via a deployment project. File, Add, New Project. Be sure not to create a new project outside the solution. Both need to be in the same solution which is displayed in “Solution Explorer”. Under Project types, select ‘Other Project Types’ then, ‘Setup and Deployment’. Then select the ‘Smart Device CAB Project’ then click the OK button.
A tab should open titled ‘File System (SmartDeviceCab1)’ (if you closed it, right click on the CAB project, view -> File system).
Select ‘Application Folder’, right click on the right hand pane then select ‘Add ->Project Output…’. Ensure that the correct project is selected and that ‘Primary output’ is selected. Click OK.
If you want the program to appear in the programs folder of your device, select ‘Program Files Folder’ then right click on the right hand pane and select ‘Create New Shortcut’. Navigate to the Primary Output that you just created in the Application folder and click OK. Rename it to something relevant.
Rebuild the solution. Navigate to the debug output folder of the CAB project. You will find a .CAB file there. Copy this onto your device via ActiveSync. Open file explorer on your device and navigate there. Click the CAB file and it will install on your device. Under Start -> Programs, you will notice your project in the list. It should run perfectly from there.
Better Deployment
Although it is perfectly acceptable to distribute the CAB file, it is hardly user friendly or professional. You can create a Windows Application that deploys your program in a much better fashion. I would highly recommend this method but it is out of scope for this article.