PocketMagic

May 12, 2009

Developing for Symbian

Filed under: Software, Symbian — Tags: , , — medachiorean @ 4:31 pm

Getting started with the first project on my Nokia N73 was not as easy as it should have been in my opinion,
as making a simple Hello world app makes you go throw a lot of files saved in different places, you’ve got to
figure out how to modify some information so that you are able to build your application.

1.Install the tools

First thing to do is to install all the required tools:

-S60 Platform SDK for Symbian OS
-ActivePerl 5.6.1.x
-Carbide.c++

-and to manage the files on the phone from the pc you can install Nokia PC Suite, I’ve inserted an SD-card in my Nokia N73
and there I copied the sisx file (nokia installer), in order to deploy my application’s installer on the phone.

Here is a link where you have all the information about this:

http://www.forum.nokia.com/document/Cpp_Developers_Library/?content=GUID-232258EC-D3B4-4D72-B12B-FFC34F070B4B_GUID-9615092A-9FA2-4F4E-859F-A231A3919FC9.html

2.Create the first HelloWorld application

Next step is to start with a simple HelloWorld application. For this run Carbide, select the working directory,
then go to File->New Project select Symbian OS C++ project next 3rd-Future Ed. GUI Application, next type the name
of the application, next select the SDKs and Buil Configurations, you can select them all then latter you can choose
the active one you need, next give a random UID for the App UID field, fill the other fields also, then tap next and finnish.

In the left side you’ll have the Project Explorer with all the projects present in the working directory,
expand the current one and you can start writing code. The currently created code is not working though, you’ll have
to make some changes first.

Choose the platform you want to develop for, go to Project->Build Configurations->Set Active and select:
Emulator Debug(WINSCW) for the emulator, or Phone Release(GCCE) for device(you can also select for the ARMV5).
Right click->Build Project on your project name(in project explorer) to build your application. You can see some errors,
this is because the pkg file has to be modified, you can find it in the sis directory.

3.How to modify the pkg file

The pkg file is the package file that is used to create the *.sis file that can be installed to the phone.
If you open the pkg file you’ll see some paths like:
“$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\…
you need to change the source paths to match the place where Carbide created those files. You can set absolute paths there
like c:\Symbian…, but it’s more practical to set the EPOCROOT variable, that will be common for all of your projects.
For this open a cmd prompt(it’s not important in which directory)
and write the command: “set EPOCROOT” to first check the value for the EPOCROOT, if the path is correct meaning
that you can find the Epoc32 directory there, then it is ok, you can leave it like that(it must be somethig like:
(\Symbian\9.1\S60_3rd_MR\ , without the drive letter, and ending with \), otherwise you’ll have to set it
correctly with the following command: “set EPOCROOT=\Symbian\9.1\S60_3rd_MR\” (without the drive letter “c:”).
Now you must have the right value for EPOCROOT, and use it in the pkg file. You can do the same for the $(PLATFORM) and $(TARGET), but
I’ve replaced them with specific directories as once I changed them they were set back to there default value, for some
reason I didn’t manage to do that, if you find out why you are welcome to post a comment on this.

To keep the path settings, you can place the ‘set EPOCROOT= …’ command inside c:\autoexec.bat, to be executed each time your PC starts,
or you can configure the PATHS by right clicking my computer -> properties -> advanced -> environment variables.

So in the end the paths must look something like this:

;Files to install
;You should change the source paths to match that of your environment
;
“$(EPOCROOT)Epoc32\release\gcce\urel\test5_0xEC4573B9.exe” -”c:\sys\bin\test5_0xEC4573B9.exe”
“$(EPOCROOT)Epoc32\data\z\resource\apps\test5_0xEC4573B9.rsc” -”c:\resource\apps\test5_0xEC4573B9.rsc”
“$(EPOCROOT)Epoc32\data\z\private\10003a3f\apps\test5_0xEC4573B9_reg.rsc” -”c:\private\10003a3f\import\apps\test5_0xEC4573B9_reg.rsc”
“$(EPOCROOT)Epoc32\data\z\resource\apps\test5_0xEC4573B9.mif” -”c:\resource\apps\test5_0xEC4573B9.mif”
“..\help\test5_0xEC4573B9.hlp” -”c:\resource\help\test5_0xEC4573B9.hlp”
“$(EPOCROOT)Epoc32\Data\z\resource\apps\test5.mbm” -”c:\resource\apps\test5.mbm”

you’ll have to check the paths to be correct, you must be able to locate the exe, rsc, mif…files there, if not search for them
and add the correct paths. One thing you have to consider is the platform you have chosen at step 2:
gcce, armv5 is for device, winscw is for emulator, udeb is for debug, urel is for release, so use the correct directories.
Eg:
if you’ve selected the platform for the device Phone Release(GCCE) you’ll find the exe file in
$(EPOCROOT)Epoc32\release\gcce\urel\,

if you’ve selected the platform for the emulator Emulator Debug(WINSCW) you’ll find the exe file in
$(EPOCROOT)Epoc32\release\winscw\udeb\,

4. Create the sis, sisx files

At this point you can rebuild you application, and the sis and sisx(signed sis) files must be created in the
sis directory of your project. Sometimes if they are not created you must specifically set this option from:
Project->Properties open Carbide c++ and select
Carbide Build Configuration then go to SIS builder tab and add the pkg file,
check the create self signed sis file, apply the settings and this is it,
now the sis and the sisx files will be created.

5. Install the application on the device or emulator

5.1 If you’ve made the build for the phone then you are done, just copy the sisx file on the phone. I’ve inserted an
sd card and copied my sisx file there. Go to Menu->Tools->File mgr at second tab (using right dpad) and install it.
You’ll find the application installed in Menu->Applications on your device.

5.2 If you want to run the installer on the emulator there are some problems that you’ll encounter.
First copy for eg. the sisx file to:
c:\Symbian\9.1\S60_3rd_MR\Epoc32\winscw\c\Data\Installs
on your pc, then you should find it in
Menu->Organizer->File Mgr->Installed Files
on the emulator.

But running it you’ll get the File corrupted error message so you need to install this for the certificates:
http://wiki.forum.nokia.com/images/a/a6/Certstore_S60_3rd_SDK.zip
unzip the file and copy it to the epoc32…(corresponding directory)

This does not solve the problem either cause you will get:
“Unable to install. Component is built-in.”. The “built-in” error message
To solve this use “abld reallyclean” command to clean the project, if this doesn’t help then delete the files manually
, go to the location where your SDK is installed(c:\Symbian) and search for all files containing your project’s name
(eg: my project is named test5 so I search for test5 and delete all files, the files that can’t be deleted I rename them to something else)

Having all this information you should be able to install your application on device or emulator.
Next article I’ll present how to display an image, draw shapes, etc.

By Meda Chiorean

Android C native development – take full control!

Filed under: Android, Research, Software, Windows Mobile — Tags: , , , — radumotisan @ 2:32 pm

A recent project I’ve been working on required Bluetooth programming on the Android.
Having a quick look over the latest 1.5 Android SDK, I could see that bluetooth support was missing. Later research pointed out that Google expressively excluded Bluetooth APIs blaming lack of time.

On the other hand, I’m not a big Java fan, to say the least. I find Java unfriendly, and I don’t like the look and feel of Java apps. Sorry, I prefer C/C++ since it provides better control and flexibility. So it’s time to start doing C/C++ native applications for the Google Android.

How run a C program on Google Android?
First thing I’ll show here, is to compile a simple C program for the Android.


#include <stdio.h>
int main()
{
printf("Hello Google Android world!\nwww.pocketmagic.net\n");
return 1;
}

Save this program as test.c. In the next steps we’ll be compiling this sample for the Google Android using gcc.

The tools

1. Download ubuntu linux. I currently use Desktop edition 9.04 in a virtual machine.
Attention: You’ll need to install Ubuntu on a machine with at least 1.5GB Ram, 10GB ext2 partition and 2GB Swap partition or you won’t be able to use this tutorial’s info (less then the minimum requirements will result in the impossibility of compiling the Android Code and we need that for the libraries).

2. Once Ubuntu is installed, download the Android Source code. On your linux box install additional packages:
$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
$ sudo apt-get install valgrind
$ sudo apt-get install lib32readline5-dev

3. Install Repo
Create a ~/bin directory in your home directory, and check to be sure that this bin directory is in your path:

$ cd ~
$ mkdir bin
$ echo $PATH

To add it to the Path, you can use:

$ PATH=$PATH:~/bin/

Download the repo script and make sure it is executable:

$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo

4. Initializing a Repo client
Create an empty directory to hold your working files:

$ mkdir mydroid
$ cd mydroid

Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:

$ repo init -u git://android.git.kernel.org/platform/manifest.git
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake

When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a Google account.
A successful initialization will end with a message such as

repo initialized in /mydroid

Your client directory should now contain a .repo directory where files such as the manifest will be kept.

5. Getting the files
To pull down files to your working directory from the repositories as specified in the default manifest, run

$ repo sync

For more about repo sync and other Repo commands, see Using Repo and Git.
The Android source files will be located in your working directory under their project names.

6.Verifying Git Tags
Load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.

$ gpg --import

then paste the key(s) below, and press Control-D to end the input and process the keys. After importing the keys, you can verify any tag with

$ git tag -v tagname


key 9AB10E78: "The Android Open Source Project "

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9
b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv
aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k
cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI
2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl
QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up
hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk
C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX
LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+
OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----

7. Building the code
The Android code contains a bug that hasn’t been solved up to the date of this article.
So before you start compiling the code, you’ll need a few modifications, or the build will fail (after consuming some of your time and patience). The error is:

external/qemu/sockets.c: In function 'sock_address_init_resolve':
external/qemu/sockets.c:637: error: 'EAI_NODATA' undeclared (first use
in this function)
external/qemu/sockets.c:637: error: (Each undeclared identifier is
reported only once
external/qemu/sockets.c:637: error: for each function it appears in.)
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/
sockets.o] Error 1

To fix this, before compiling the android code, open ~/mydroid/external/qemu/sockets.c and add

#define __USE_GNU

just before the #include <netdb.h>

Now you can build the files. Run make from within your working directory:

$ cd ~/mydroid
$ make

On my virtual machine running ubuntu, the build process took several hours. The host PC is a 2.6GHz P4.

Compile test.c with gcc for the Android platform
Android uses a simplified version of libc, called bionic. We need to compile using Android’s prebuilt cross-compiler arm-eabi-gcc, and use the bionic library on the phone.
The easy way to do this is to use the agcc perl wrapper. You can download the original file here, and modify

my $TOOLCHAIN = "$DROID/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1";

to

my $TOOLCHAIN = "$DROID/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1";

Or download this updated version directly.

Copy agcc to your home directory, and chmod it:

chmod +x agcc

then set the PATH to the bionic libs and the agcc location:

$ PATH=$PATH:~/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin:~/:~/mydroid/

Now you can compile the test.c file:

agcc test.c -o test

Take the resulting test binary and upload it to your android using:

adb push test /data/local/test

Then run it:

adb shell
chmod 775 test
./test

See the pics for more details:

Next thing to do is to try to control the bluetooth functionality using native C code and the android toolchain.

More on native C apps for Android here.

Best regards,
Radu Motisan

Developing for Google Android – the SDK

Filed under: Android, Software — Tags: , , — radumotisan @ 1:23 pm

Following the recent posts on the Google Android platform, I thought it is time to go a little deeper in the programming world of this mobile device.

So the questions is:
- What do we need to start coding for Google Android?

Lucky for us, there are lots of tools available online, and the Android team has provided a comprehensive guide on this. You can read it here.

In just a few words:
1. you will be needing Eclipse, get it here. I’m currently using (actually I’m currently having installed, since I’ve moved to native C/C++ Android development), Eclipse IDE for Java EE Developers (163 MB) , jee-ganymede-SR2. Download it and install it.
2. the Google Android SDK, get it here . Current version at this time is 1.5.r1. To install the SDK you simply need to unzip it to a location on your PC. You will have a folder named android-sdk-windows-1.5_r1, and inside several subfolders (add-ons, docs, platforms, tools, usb_driver). Keep this structure intact.
3. Open Eclipse (start eclipse.exe from the installation folder), and go to menu, Help->Software Updates->Available Software->Add Site. Type in this address: http://dl-ssl.google.com/android/eclipse/, and press OK. Click the newly added check boxes and press Install. On the following Install window, “Android DDMS” and “Android Development Tools” must both be checked. Click Next/Accept/Finish and restart Eclipse when prompt to do so.

4. Add the SDK to Eclipse. Again in Eclipse menu, Click Window->Preferences->Android and browse to the location of the SDK folder you’ve unzipped earlier. Then click apply / ok.

First Android application
A good idea for a start is to try to compile one of the SDK samples. Android SDK comes with several samples developed in JAVA. Let’s see how we can get one running.
1. Open Eclipse, go to menu File -> New ->Project , select Android Project and click next. Now give it a name, eg. TestHello, and select “Create project from existing source”, and browse to %SDK_PATH%/platforms/android-1.5/samples select HelloActivity folder and click OK. You should get the source code imported.

2. Go to Menu Project -> uncheck Build automatically. Now you can right click your project name in the project explorer and select Build Project.
3. Go to \android-sdk-windows-1.5_r1\platforms\android-1.5\samples\HelloActivity\bin\ and locate TestHello.apk . This is the installer for your newly compiled app.
4. Using adb, from SDK tools, install the application:
adb install TestHello.apk
Next you can locate it in Android programs , and execute it with a simple tap.

Next you can modify the code, and learn new things. Hope you find this start-up useful.

Radu Motisan

May 9, 2009

Ultraviolet Light

Filed under: Hardware, High Voltage, Optics — Tags: , , , , — radumotisan @ 8:51 pm

“Ultraviolet (UV) light is electromagnetic radiation with a wavelength shorter than that of visible light, but longer than x-rays, in the range 10 nm to 400 nm, and energies from 3 eV to 124 eV. It is so named because the spectrum consists of electromagnetic waves with frequencies higher than those that humans identify as the color violet.” Source.

There are several ways of subdividing the UV electromagnetic spectrum. Most common is:

Name Short Wavelength Photon energy
Ultraviolet A, long wave, or black light UVA 400 nm–320 nm 3.10–3.94 eV
Ultraviolet B or medium wave UVB 320 nm–280 nm 3.94–4.43 eV
Ultraviolet C, short wave, or germicidal UVC 280 nm–100 nm 4.43–12.4 eV

There are several ways of producing UV light, that include natural sources (Eg. the Sun) or artificial sources (UV bulbs, UV tubes, N2 Lasers, etc).

I have tested two UV Light tubes: a black light UV tube, and a germicidal UV tube. There two correspond to UVA and UVC spectrum.

UVA
The wavelength is in the range of 400 nm and 320 nm. I have a 6W “blacklight tube”. Looking at powered tube you barely see anything, but putting a piece of white paper shows powerful fluorescence. The second picture below shows this phenomenon:

The reason for this is that my UVA tube emits long wave UV radiation and very little visible light.
In the third picture, the glass ball is an uranium doped glass. It shows greenish fluorescence when exposed to UV. See an article on this topic, here.

This type of tube looks black when non energized, as the deep-bluish-purple glass called Wood’s glass, is a nickel-oxide–doped glass, which blocks almost all visible light above 400 nanometers.
Unlike the other UV subdivisions with shorter wavelength, the UVA emits lower energy radiation, that doesn’t cause sunburns or skin cancer. Instead, UVA is capable of causing damage to collagen fibers and destroying vitamin A in skin.

UVC
I got these tubes at a fair price on Ebay. They were manufactured to be used in germicidal applications. Most of the light they produce is in the 280 nm–100 nm spectrum. The sun is a natural source for UVC radiation. Some of the UVB and UVC radiation is responsible for the generation of the ozone layer. After running my UVC tubes for a while, ozone smell could be detected in the air surrounding the tube.

In this video you can see that if the magnetic field moves, the plasma moves in such a way that magnetic field lines cannot slide across the plasma.

UVC rays are the highest energy, most dangerous type of ultraviolet light. Unshielded exposure of the skin or eyes to UVC light sources is quite dangerous. It can produce DNA damage that leads to skin cancer, since it penetrates the skin, so protection is required.

Power source
Solution 1:
To power these tubes you need a high voltage source. A simple solution is to use an inverter. You can also build one, using a power transistor (2n3055) and a flyback transformer ferrite core:

The resistors need to be at least 5W, and the transistor can be a 2n3055.
The primary consists of 30 turns, for the feedback you’ll need 15turns and 250 turns of secondary, all concentric. You might need to be able to swap feedback (or primary) connections in case of wrong phase polarity.

Solution 2:
Another way of building the power source is without a feedback coil, but instead a 555 timer to trigger the power transistor. Here are the schematics:

Instead of the MPSA42 / MPSA92, you can use any other generic PNP/NPN pair of 0.5A minimum current.
The Mosftet (IRF540) will be needing a heatsink. You can use a different power mosfter or a power BJT transistor instead (eg. 2n2055).
The secondary can be winded manually or you can use a flyback secondary.
The advantage of this circuit is that you can adjust the frequency using the pot.

The next few days, I’ll be publishing an article on various high voltage sources, so we’ll see more on these later.

Radu Motisan

May 6, 2009

Developing for Google Android – update the OS version

Filed under: Android, Software — Tags: , , , — radumotisan @ 7:43 pm

There are already some very good articles and tips and tricks on how to do this, but for the purpose of having my own information structured and available online, I will describe what you need to do to update the OS version of your Android.

In no event will I be liable to you for any damages arising from the use of this info, so its only your responsibility if you decide to do the upgrade. You might loose the warranty or even make your Android unusable.

On the other hand, being able to update the OS, brings several advantages, especially for developers. You can root your device, meaning that you can get a way of using your Android linux box as root, very useful, since it provides complete access to the device.

Also, if you hard-reset the device and don’t have a T-Mobile SIM with data plan, you’ll need to use this article to unlock your Android G1.

STEP 1: Flash your Android with OS version RC29. This is an older release, but we need it to take advantage of an exploit that will give us root.
Download the rom image (~90MB).
Copy DREAIMG.nbh to the root of a micro SD card. The file should appear like this:

STEP 2: Insert the MicroSD in the android, and turn off the phone (you can unplug the battery and then replug it). Hold the Camera button, and press Power button to entry the bootloader. You should get a white screen with instructions to flash your phone with the update on your SD card.
Follow those instructions and press the Power button. The update will start and it looks like this:

Be careful not to interrupt this update!
When the update is complete, restart the phone.

STEP 3: You should now be running the RC29 OS version, and if you don’t have a SIM card in your Android, you should get this screen:

RC29 (and RC7 as well) have an interesting vulnerability that we’ll use for our purposes: all the characters you type get executed in a background shell as ROOT!
For instance type [enter]restart[enter] w/o the square brackets . The device will reboot.
To take advantage of this and unlock your device type:
[enter]telnetd[enter] (again, no square brackets, [enter] refers to the enter key on the Android keyboard). This will start the telnet daemon process (you won’t see it as it is running in the background).

STEP 4: Connect your Android to the PC and use adb shell to open a remote shell command prompt. Here’s an article showing how to do that.
If you get an error (device not found), you’ll need to start the ADB server on your android. Do do that we’ll use the same background shell exploit – simply use the keyboard and type:
[enter]setprop persist.service.adb.enable 1[enter]
Retry connecting with adb.

STEP 5: Download busybox and use adb push to copy busybox binary to your G1:
adb push busybox /data/local/busybox
In the adb shell, type chmod 755 /data/local/busybox to make it executable and then /data/local/busybox telnet 127.0.0.1.

Congrats, YOU Got root!

STEP 6: Disable registration and enable WLAN connectivity. Type in the adb shell:
setprop app.setupwizard.disable 1
and then:
am start -a android.intent.action.MAIN -n com.android.settings/.Settings (works without root as well)

Now you can use your device and you can stop here. But if you want more, hit continue :)

Flash to latest OS build, but keep root access:
STEP 7: Copy recovery.img and update.zip (this is the Hard SPL) to the root of your MicroSD card.

STEP 8: using adb shell as root (at the # prompt), type the following commands:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd sdcard
flash_image recovery recovery.img
cat recovery.img > /system/recovery.img

STEP 9: Install update.zip form sdcard (restart device while pressing HOME, then ALT+L, and finally Alt+s)

STEP 10: Upgrade the Radio. Download Radio ROM zip (9 MB) , rename to update.zip and put it on the SDCard and install it (restart device while pressing HOME, then ALT+L, and finally Alt+s)

STEP 11: Upgrade the OS ROM to latest version. Download OS ROM zip (42 MB) , rename to update.zip and put it on the SDCard and install it (restart device while pressing HOME, then ALT+L, and finally Alt+s)

Try to carefully follow these steps. It will keep you out of trouble. Should you have any questions, use the Comments form below.

Radu Motisan

Developing for Google Android – introduction

Filed under: Android, Software — Tags: , , — radumotisan @ 11:46 am
Android, the mobile platform developed by Google, offers a robust communicator with some exciting features.
Taking Windows Mobile as a reference, the Android comes with some powerful new concepts:
- smooth functionality – no more wait icons, the unit is quite fast
- fingerfriendly everything, especially the Mobile browser is by far better then the WM PIE. Now I can actually USE the mobile internet browser
- some google specific services like google maps, IM, and Gmail, easy to use as well
- slim design, including a full keyboard
- long battery life

All in one, this finally is what a mobile companion should be like, meaning that it does what it’s advertised to do – thanks to the way the interface is organized, and the touchscreen, it allows easy and painless interaction with the device. Direct information interchange between the user and the device, taking advantage of the small size. No more need for a sharp stylus, and this is wow!

For this article, here are a few things I’d like to show:
- how to connect the Android to your Windows PC
- how to take screen captures from your Android
- how to install new software on your mobile device

1) First thing after you unbox your device, you need to download a set of tools provided by google.
These tools are for developers, and come as an SDK package, but anyone can install and use them.
So go to this link and click the latest version for the Windows SDK (at the time I wrote this, it was android-sdk-windows-1.5_r1.zip)
2) Once you got the file, unzip it to a local folder on your PC. You should have a folder like android-sdk-windows-1.5_r1.
3) Connect the Android to the PC using the USB cable. When notified that a new hardware has been detected, instruct Windows to look for drivers into the SDK folder: android-sdk-windows-1.5_r1/usb_driver/x86
If you have a micro SD card in your Android, it will appear as a new drive on your PC. Sweet.

Things you can do now: install new software, remove unwanted packages, get a shell on your Android (yes, it’s an embedded linux box), or take screen captures (useful for reviews).

So to take a screen capture of your Android, go to the SDK folder and enter Tools. Start ddms.bat .
This utility will allow you to perform various control tasks:

To take a screenshot, go to the Menu, click Device and select “Screen Capture” or directly hit Control+S. Here’s what you get:

You can save the file as a PNG image file, and you can also see that the screen has a resolution of 480×320.

To install new software, make sure you’re in the same Tools folder of the SDK package (using Total Commander), and type cmd and hit enter. You’ve just opened a command prompt. Make sure you know where the application installer is (the .apk file) then type:
adb install [APK_FILE_PATH]

And here is the installed software running on the Android G1:

In a similar way you can perform other commands:
adb devices should list the ID of the Android connected to your PC.
adb push [LOCAL_FILE_PATH] [REMOTE_FILE_PATH] will upload a file from the PC to the Android
adb pull [REMOTE_FILE_PATH] [LOCAL_FILE_PATH] downloads a file from the Android to the PC
adb shell a very neat command, actually opens a shell on your Android linux box:

To uninstall software from the Android you can use the device’s GUI:
Home->Settings->Applications->Manage Applications or directly the adb uninstall command.

Hope this helps for a start,

Radu Motisan

May 5, 2009

Homemade Flyback secondary

Filed under: Hardware, High Voltage — Tags: , , , — radumotisan @ 5:50 pm

While the Flyback transformers can be salvaged from old/damaged TVs, they prove to be rare components, and finding a quality Flyback secondary is often a great challenge.

On the other hand, a good Flyback secondary can get easily destroyed , it the voltage level inside gets too high (the insulation is punctured internally).

This is why I’ve decided to build one with proper insulation from scratch, since the whole thing is merely a multi-layer coil. Using 0.2mm CuEm wire and a PVC pipe for supporting the coil, I’ve created a 2500 turns flyback. The winding was deployed on multiple layer, insulated with PVC tape.

This video shows a test run with this flyback secondary. Bottom line, I encourage you to try making your own Flybacks, since it’s quite easy. More on the ZVS driver here.

Radu Motisan

April 2, 2009

Tesla Coil #3

Filed under: Hardware, High Voltage — Tags: , , , — radumotisan @ 12:07 pm

Since most of the things I build are modular, and often get disassembled to use parts in other projects, I decided to make an exception for my ZVS Tesla Coil and leave it in a form easy to plug and play.

I already had the ZVS module, a good flyback transformer with built in HV diode, and lots of HV cables. Time to put everything together in a final form.

A light bulb “powered” by my Tesla coil

To my previous design I’ve added a second deck, to contain the power source (ZVS+flyback), the capacitor bank and the spark gap.

The tesla transformer has a secondary of 1500 windings (Cu 0.2 mm on a PVC pipe diameter 5cm/length 30cm), and a primary with 16 windings (Cu 4mm on PVC pipe diameter 11 cm/ length 10cm):

The primary has several plugs, used to make the primary and the secondary resonant at the same frequency.

The rest of the setup:

Photo 1:The small PVC pipe contains the capacitor bank (9x10nF/6KV, connected for 10nF/18KV), and a small filter.
I’ve used a ceramic bulb socket to contain a static spark gap and limit the noise. It also has a lid, not shown in the photo
To the right you can see the ZVS module.
Photo 2: the ZVS Heatsink, and the power-in/ground connector. It might be a bad idea to have the ground so close to the low voltage connector. I’ll need to check that.
Photo 3: the flyback transformer, and the rewound primary (blue wire 4+4 windings). When powered by the ZVS driver at 30V the sparks start at 1.5cm and can be stretched to almost 4cm. Quite powerful.
Photo 4: front view, the flyback , a small filter connected on the ‘cold’ wire (black) and the capacitor bank again.

The complete schematics:

This setup needs further improvements, so I’ll update this post soon.

Radu Motisan

March 22, 2009

Robo Evolution – how to build a better robot

Filed under: Electronics, Hardware, Research, Software — Tags: , , — radumotisan @ 3:51 pm

This topic will try to sum up my work related to robotics, and provide as much pictures an videos as possible for those of you interested in this subject.

Perseus 1, 2005-06-29
General:I’ve worked on this one for about 2 months, with lots of interruptions and having only little continuous work time.
It was my university graduation project and major research work was on artificial vision.
Platform: modified RC truck, with servo controlled direction on front wheels, and geared (weak) motor on back wheels for propulsion.
Hardware: video camera, powered on 2 AA batteries, 2.6GHz video transceiver powered on 8xAA batteries, original car 35MHz RC control board connected to car’s motors running on 4xAA batteries, remote PC running custom image processing software, that I’ve created at that time.
Block Schematics:

Functionality:
The performance was very good, the robot being capable of recognizing and following a laser spot projected in front of it (in the camera’s view port).
Here are a few pictures of the robot vision itself:

Pictures

Resources:
Front cover of my license work: cover.pdf
Snapshot of desktop application:

Perseus 2, 2007-12-04
General: in an attempt of continuing the perseus 1 project, the first improvement I’ve tried was to eliminate the need for a remote computer
Platform:
modified RC truck, with servo controlled direction on front wheels, and geared (weak) motor on back wheels for propulsion.
Hardware:
Mini ITX D201GLY2 motherboard with 1.3GHz Celeron CPU, 512MB RAM, IDE2CF and CF2SDCard adaptors for a 2GB SDCard based DOC (disk on chip), M2-ATX DC-DC PC power supply 160W, 4×8 AA rechargeable batteries connected for 10.4V @ 10.4Ah .
Block Schematics:

Functionality:
This design was a failure. The heavy batteries overloaded the motors, and the original H Bridge circuit transistors vaporized. The platform is too weak for the robot’s mass.
Additional problems: motherboard resets when motors are triggered since there is only one common power source. Some high capacitors or separate power sources would have solved this.
project was abandoned – seeking for a better platform.
Pictures

TwinMotion 1, 2009-03-01
General: Since I needed a stronger platform, but didn’t want to spend 300-400$ on commercial offers, I’ve built my own, strong, customizable robot platform FROM SCRATCH!
Platform: Big 28 cm diameter light wooden wheels, two geared (30rpm) strong motors , some metal pieces and screws. To fix the wheels on the motor-heads, I’ve created a custom bearing, out of some tick small diameter metal pipe.

Hardware: Robot “brain” under development, currently I’ve used it with my AtMega8 H-Bridged board, available here.
Block Schematics: Not yet available.
Functionality: Not yet available.
Pictures and videos




This video shows the platform in action, controlled by a simple ATMega8 microcontroller brain, that was only giving simple movement commands : forward x cm, turn left, move backwards x cm, turn left/right, etc.

TwinMotion update #1, 2009-03-22
General: Wheels needed better adjustment on motor axis, and I’ve decided to add a third wheel for stability, since running on two wheel can make the fixed-body turn upside down – and would create problems when using various environment sensors.
Platform:
A third wheel has been added.
Hardware: Currently the experimental setup is running on the same Atmega8 board.
Pictures and videos
Here’s a demo showing this platform, you can easily see how powerful it is, considering the complete setup is ~2 Kg weight.

To be continued…
Radu Motisan

A simple H-Bridge design

Filed under: Electronics, Hardware — Tags: , , — radumotisan @ 1:23 pm

Normally I wouldn’t a topic about such a simple device, but since there are many sites offering wrong information (for eg. this one short circuits your power source), I had to do it.

An H-bridge is an electronic circuit which enables a voltage to be applied across a load in either direction. If you need to learn more, read here.

Now, assuming you know what a hbridge is, let’s choose a topology for our implementation. You already know we’ll be needing transistors or mosfets (if not, please read the docs above), what you might not know is that these transistors will have to handle a high enough currents, especially when the motors they control are overloaded.

Some time ago, I’ve build a robot on a RC-truck, the load was so high because of the heavy batteries, that when the motors got the command to move forward they overheated and died.

So it’s important to use heat sinks, to dissipate the heat. So, for a h-bridge we will be needing 4 transistors, working in pairs at a time. If we use 2xPNPs and 2xNPNs we can have common collectors, and so, using a single heatsink per pair. For the topology this is the only requirement I will impose, and here is one possibility:

You will need to place the left side MJE2955 and MJE3055 on the same heatsink since they have common collectors. A separate heat sink for the right size transistors must be used.

These components support up to 10A current, so they will work well for small to medium motors.
Remember, a H-Bridge only controls 1 motor. So if you’ll need to driver the servo motor and also one main, propulsion motor you will need two separate h-bridges.

Here are some of the h-bridges I’ve created. On a board I usually create 2, since I mostly use 2 motored robots.

And here is a nice board having an ATMega8, a MAX232 for serial communication with a PC, and two h-bridges for controlling two big gear motors. Again I’ve used MJE2955/3055 pairs, but feel free to use any transistors/mosfets you have.

It runs well and it doesn’t heat up much. In case anyone needs further details on how this works, or other things like why we need the D1-D4 diodes, feel free to ask.

Also the R3,R4 resistors can be adjusted to suit your needs. For me, they are used to limit even further the current given by the microcontroller on the output control pins. Not really required in my case.

Radu Motisan

Older Posts »

The Silver is the New Black Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.