Project Phone Reborn (#projectphone)
Project phone has been reborn!Following on from the untimely demise of the HTC Touch Diamond's battery (again!), I have acquired an Android phone as its replacement. Specifically a Sony Ericsson Xperia Arc running Gingerbread 2.3.4.As the Diamond was running a ultra light Windows Mobile 6.1 ROM, I am going to have to completely rewrite all the software from scratch, but this time I can have much more control over the hardware, and I will only need one app, rather than several controlled by scripts triggered by hardware events.The original plan was to flash a custom build of Cyanogenmod, but I quickly discovered that this phone has a boot loader that can't be unlocked by S1tool. This means it is not possible to flash any custom ROM.However, it can, and has already been rooted, I then uninstalled all the Sony Ericsson bloatware (Seriously all phone manufacturers, nobody likes your crappy software, so make it easier to remove it!) And anything else I didn't need. Once removed the phone runs better than it ever did before.I am hoping that I can connect a USB keyboard to use as a rudimentary input board to interface with the car (ignition on, lights on heater on, etc...)This might take some doing as its not supported natively, however there is a usbotg apk within the system/app partition, but if not there are apps that claim to add the functionality. Some research and testing will definitely be needed...I should have kept my old Galaxy S2!This page will be updated as the project progresses.Stay tuned!
Update 05/09/15After installing some apps from the Play Store and installing some modules to /system/lib/modules I can now connect and use a standard USB keyboard. #winningNow to start writing the code...
Update 13/09/15
So, instead of wasting a standard USB keyboard, I decided to dig out my old USB game pad that I haven't used since forever, and guess what?It works!So I'll be disassembling this one soon...
Update 03/10/15
I have discovered that these things exist, so I have bought one and I am awaiting it's arrival. This should allow me to control the car with my phone...Remote start by way of text message anyone?
Update 10/10/15
It's here...
Update 25/10/15Not much has been achieved due to a family holiday, however I have written the PHP code that will reside on my Webspace.If I load the page with an argument formatted like this...http://foo/bar.php?loc=$time,$date,$lat,$lon,$speed(I will replace the values with actual data obviously.)The PHP code writes it to a secure file, then reads it back and displays it so projectphone can download and verify the correct information has been stored, if the data doesn't match, it will upload it again.This is to be updated by projectphone once a minute, 24 hours a day 365 days a year. It's only a few bytes of data so shouldn't use that much internet.Without using arguments, (ie, the page just loaded on a normal web browser on any device)http://foo/bar.phpThe data is displayed in a human readable format, after logging in obviously!There is also a link to import the data into Google maps to see a map or get directions.The next task to do is to take the same data and write it into a database so I can keep track of the vehicle's movements over time.The problem with that is Virginmedia's Webspace does not support databases. I would have to have the database on my home network and send the data there instead.Should be easy...
Update 06/11/15
The first draft for the app, I'm just trying to get all the data gathered and work out the how to process it.For instance, I have now got the GPS data and I can tell when the last GPS lock was. I can send this data formatted how I want to my PHP script on my web server, and retrieve and process the response. I can get the current time and date. And I can send and receive SMS messages, all within the app.You can see in the photos some of this happening, (obviously I edited the location details) the green data string is the response after uploading the data and the blue data string is the same data downloaded (the cars current location)You can also see the SMS messages being sent and received.I have decided to create two apps, a simple one for my normal phone that handles sending and receiving the messages to control the phone installed in the car (like having a screen full of buttons entitled Lock, Unlock etc.) And an app for the phone in the car which will have the main app installed, this will be more automated and won't need user input.The buttons at the bottom are there to manually start processes like the location data being sent or received from the web server and to send SMS messages to itself.Here is the web site I created to locate my car, it gives the location, speed and direction of travel, and an option to import the data into Google maps.
Update 20/12/15
Not much has been achieved recently due to the festive preparations, except for a full days testing out on the road and then the inevitable bug fixing and redesigning of the screen.The two bugs fixed so far were a nulPointerException when trying to upload the GPS data when it hasn't been acquired yet, for example just after a reboot or if the Android location services had been turned off and back on again, and a stringIndexOutOfBoundsException when attempting to process the uploaded data if there was network problems during upload. Both were fixed by conditional statements.Now the basic engine works reliably, I can start adding the extra features like the stopped time counter, auto cruise and Twitter engine...
Update 06/01/16
I've restyled the main screen and implemented the stopped counter. The on-screen ignition button is there while I test various methods for blanking and turning on the screen.It's slowly coming together...
Update 02/02/16
I'm going to run the Twitter engine at home on my spare Raspberry Pi.Twitterbots are easy to set up with Python scripts, so I'll poll the data from the car stored online and tweet according to the values and replying to any mentions or new followers.Also I've been playing with the IOIO board...
Update 05/02/16
The IOIO OTG board in action...I needed to flash updated firmware into the IOIO board before my Galaxy S5 recognized it, but that was a painless enough experience.Stupidly however, I had downloaded some IOIO applications from Google Play which wouldn't detect the board, turns out all the applications in the Play Store are for the IOIO V1 board, not the IOIO OTG board, I spent far too long trying to work that one out.Once I had installed the correct apk from the IOIO application download from their repository and updated the firmware, it worked fine......with the S5, but not the Xperia though!
Update 13/07/16
It's been a long time coming...Things have changed, and again excessive power consumption has partly caused it. Despite extensive testing of various USB power supplies, I cannot get the power consumption to fall below 300mA, this is probably due to running the GPS continually and holding onto a wakelock. And the second issue I cannot resolve is the IOIO board will not talk to the Xperia, I'd imagine this is a ROM problem, and I can't flash another because of the locked bootloader. So now, the Xperia is going to be used as a dashcam with already existing software, and I've bought a Raspberry Pi Zero for the tracker.
So now I have to find a RPi compatible GPS module and mobile SIM adaptor, then rewrite everything in Python...Also I need to create a small app to run in the foreground on the Xperia that starts at boot to blank the screen and disable the screen lock for fully automated hands free operation...
Update 13/07/16
The experiment with the Raspberry Pi Zero was ok, I could get the GPS location easily in python, however the mobile internet was a pain in the @$$, the first dongle, a Huawei E303 does not allow you to read incoming SMS when in serial mode, you can send SMS easily with Gammu, but for some reason incoming messages are moved to a web interface and are out of reach of Gammu. #fail.So a second dongle was purchased, a Huawei E220, this does allow you to read messages in serial mode, but not while you're connected to 3G internet, and on the Zero it eventually went into a connect/disconnect loop, which you can see with dmesg | grep ttyUSB, I haven't been able to resolve this, despite making a USB cable filter as instructed on the internet.
I replaced the Pi Zero with an old Pi B+ and it works fine, but the power consumption is far too high, so it's back to android.
Read about the original project phone here Project phone