Friday, December 31, 2010

Installing Android on a Virtual Machine running inside Windows using VirtualBox

Operating System: Windows 7 Ultimate 64 bit

  1. Download VirtualBox (filename: VirtualBox-4.0.0-69151-Win.exe) from
  2. Download a ISO image of Android-x86 built for installation on a virtual machine (filename: froyo-vm-20100812) from 
  3. Install Virtualbox.
  4. Download "VM VirtualBox Extension Pack" (filename:Oracle_VM_VirtualBox_Extension_Pack-4.0.0-69151.vbox-extpack) from
  5. Install "VM VirtualBox Extension Pack" by double clicking on the file.
  6. Start VirtualBox
  7. Create a new Virtual Machine named "Android-x86-froyo" for OS "Linux" and Version "Linux 2.6" with RAM as 256 MB and dynamically growing IDE (not SCSI) Harddisk of 2 GB Capacity. Enable both the serial ports (COM1 and COM2) but leave them in "Disconnected" mode.
  8. To the above Virtual Machine, attach "froyo-vm-20100812.iso" as CD image to the IDE controller to which the above Harddisk is also attached.
  9. Start the above Virtual Machine and when it boots from the ISO image, select the option "Install Android to harddisk"
  10. When asked to choose partiton, select "Create partition" to enter the cfdisk utility. Within this utility select "New" and create a "Primary" partition of the default selected size (2146 MB).
  11. Select the option to "Write" the partition table.
  12. Set the just created partition to be bootable
  13. Again select the option to "Write" the partition table.
  14. "Quit" the partition utility.
  15. Select the "sda1" partition and press "OK" to install Android to this partition.
  16. When presented with the filesystem options to format sda1, select "ext3".
  17. Select "Yes" when asked about installation of GRUB bootloader.
  18. Select "Run Android-x86" at the end.
  19. For the currently running "Android-x86-froyo" Virtual Machine window select "Disable Mouse Integration" from Machine menu of virtualbox. Once that is done, click within the window so that mouse pointer is captured. This will enable you to click and drag the mouse pointer to unclock the Android homescreen. To release capture of mouse pointer press the "Right Ctrl" key on the keyboard.
  20. To shut down the Virtual Machine send an "ACPI Shutdown Signal" from the Machine menu of Virtualbox then switch to the Virtual Machine screen and select "Power off"

Saturday, December 25, 2010

Setting up toolchain for developing applications for Android on a Windows PC

Operating System: Windows 7 Ultimate 64 bit
  1. Download "Java Platform,Standard Edition JDK" (filename: jdk-6u23-windows-i586.exe) from
    When asked to select the platform, select "Windows" and not "Windows x64" because we want the 32 bit software and not the 64 bit one eventhough our OS is 64 bit.
    No special installation instruction, just keep clicking next on the installation wizard dialog boxes that pop up.
  2. Download "Eclipse IDE for Java Developers" (filename: from
    Use the 32 bit Eclipse eventhough your OS is 64 bit.
  3. Extract the folder "eclipse" from within to C:\
    Rename this "eclipse" folder to "eclipseandroid" in case you want to distinguish it from other installations of eclipse.
  4. Run C:\eclipseandroid\eclipse.exe
  5. Rename the workspace path from "C:\Users\Anurag Chugh\workspace" to "C:\Users\Anurag Chugh\androidworkspace" and before pressing "OK" check the box "Use this as the default and do not ask again"
  6. Close Eclipse. Check the box "Always exit without prompt" before pressing "OK"
  7. Download "Android SDK Starter Package" (filename: installer_r08-windows.exe") from
  8. Install installer_r08-windows.exe. No special installation instruction, just keep clicking next on the installation wizard dialog boxes that pop up. At the end uncheck the box to prevent running the "SDK Manager" before clicking Finish.
  9. Create shortcut to "C:\eclipseandroid\eclipse.exe" on the Desktop and name it "Eclipse - Android"
  10. Download "ADT Plugin for Eclipse" (filename: from
  11. Start Eclipse using shortcut placed on the desktop and go to Workbench.
  12. Click on "Help > Install New Software" .
  13. Click "Add"
  14. Click "Archive" and browse to point to "" and install everything related to Android. You will have to accept the license agreement before proceeding.
  15. Restart Eclipse when asked to do so.
  16. Close eclipse.
  17. From "Start Menu", right click "SDK Manager" listed under "Android SDK Tools" and click "Run as Administrator".
  18. Install all packages listed under "Android Repository". Select "Accept all" Radio button. Internet is required for this step. (takes lots of time to complete)
  19. If it throws an error, check the "Force https:// to be http://" checkbox listed under SDK Manager "Settings" and try again
  20. Within SDK Manager, go to Virtual devices and create a new "Android 2.3 - Level 9" Virtual device named "A2.3L9Hello". Set SD card Size to 64 MiB. Close the SDK Manager.
  21. Start Eclipse.
  22. Go to Window>Preferences>Android 
  23. Browse for SDK location and make it point to "C:\Program Files (x86)\Android\android-sdk-windows" and click Apply.
  24. Click OK and come out of the preferences.
  25. File>New>Project
  26. Select "Android Project" and click next.
  27. Project name: HelloWorld
  28. Build Target: Android 2.3 (API Level 9)
  29. Application Name: Hello, Android
  30. Package name: com.example.helloandroid
  31. Create Activity: HelloAndroid
  32. Click Finish
  33. Open HelloWorld>src>com.example.helloandroid>
  34. Replace all the code in there with:

    package com.example.helloandroid;
    import android.os.Bundle;
    import android.widget.TextView;
    public class HelloAndroid extends Activity {
       /** Called when the activity is first created. */
       public void onCreate(Bundle savedInstanceState) {
           TextView tv = new TextView(this);
           tv.setText("Hello, Android");
  35.  Press the "Run" button (one with "Play" icon on it)
  36. When asked for a way to run the application select "Android Application"
  37. Whe asked to "Save Changes" click "Yes"
  38. Virtual device will boot up (takes lots of time). First textual animation appears and then Graphical Animation appears.
  39. When the home screen appears, the application will run and display "Hello Android". If it doesn't press the launcher icon on the screen (one with the small square grid on it) and run the "Hello, Android" application by click on its icon.
Explore Further: 

Monday, October 4, 2010

50 Hz AC Mains

So the waveform collection wouldnt be complete without the 50Hz AC Mains. Since the oscilloscope I am currently using is USB powered PC based, it can't handle high voltages such as the 230 Volts AC/Hz available in India.

So I stuck my probes onto the secondary of a AC/DC step down adapter..

..connected the oscilloscope to my laptop and observed the waveform and more specifically, its frequency:

Just to be safe, I operated the laptop on battery and disconnected the laptop charger from the mains.

Next I loaded the AC/DC adapter with a 47 ohms resistor...

.. and observed the signal (note the distortion):

If you are wondering if (and why) the utility frequency ever changes then the following articles would interest you:

Sunday, October 3, 2010

10 Mbps Ethernet

Waveforms of signal on a 10 Mbps Ethernet CAT5 cable (captured differentially on the RX+ and RX- wires):

For the info regarding how I managed to captured this waveform have a look at the usenet discussion here and the supporting info here.

Click on the image below to know how I forced my network card to operate in 10 Mbps mode only:

Dual-Tone Multi-Frequency

Whenever we press the keys on our touchtone landline phones, it transmits two sine waves simultaneously. The interface at your telephone exchange recognizes the frequencies of both of these waves and hence identifies the key pressed. This is known as Dual-tone multi-frequency signaling. The various combinations of the frequencies of each of the keys are as below:

DTMF Frequencies in Hertz
1    697    1209
2    697    1336
3    697    1477
A    697    1633
4    770    1209
5    770    1336
6    770    1477
B    770    1633
7    852    1209
8    852    1336
9    852    1477
C    852    1633
*    941    1209
0    941    1336
#    941    1477
D    941    1633

Here are how the waveform of DTMF signals corresponding to various key presses look like:

Digit 0
Digit 1
Digit 2
Digit 3
Digit 4
Digit 5
Digit 6
Digit 7
Digit 8
Digit 9
Hash (#)
Asterix (*)

And here is what the FFT of DTMF signal for Digit 5 looks like - note the peaks near 770 Hertz and 1336 Hertz:

Here is the 20Hz Ringing Signal which appears on the line to indicate an incoming call:

And finally this is a capture of a waveform during a conversation:


Here is a printout of screen capture of A and B signals of an RS485 Bus as captured on an oscilloscope (Agilent 54621A). The RS485 Bus usually consists of a twisted pair cable connected to an RS485 Transceiver. In the case, below, a twisted pair cable has not been used - the signals were directly observed at the A and B pins of DS75176 loaded by a 120 ohm resistor and biased by two 560 ohm resistors. The bus is bein operated in half-duplex mode. DS75176 (which is equivalent to MAX485) was connected to the UART of Atmega8 AVR Microcontroller. The data being transmitted were the characters: 'a' '0' '1' '2' 'K' 'Q' - in that order. The UART frame format is 8-N-1 and the baud rate is 38.4 kbps. The signals A and B were captured on two different channels both referenced to the common system ground.

This waveform was captured while me and my classmates were working on our final year project at the end of our undergraduate engineering course. The reports of this project titled "Multi-Utility Sensor Network" are here.

Related Links:


How to observe Spectrograms of various signals or latest pop/techno songs:
  1. Buy a Nokia phone - specially the ones like Nokia 5800 or Nokia X6 or any other which are labelled "comes with music" or "music unlimited"
  2. Install the nokia support software on your computer - especially the Ovi Player
  3. Validate your music coupon and download a few songs from using Ovi Player. This is completely legal.
  4. Install Winamp 2.95 (older version). You can get it from here.
  5. Start Winamp, go to preferences, set the visualization plug-in to "Spectrum Analyzer + Voiceprint" which is present in the "Nullsoft Tiny Fullscreen 2001" Library
  6. Load the song in winamp, play it and press "Ctrl+Shift+K" to watch the live spectrogram of the song. The Spectrogram is updated from left to right. Press "Esc" key to get out of fullscreen mode.
  7. If you want to see the voiceprint of your voice, "add a URL" to playlist and type "linein://" into the textbox asking for location. After this is done, double click on the entry in the playlist which says "Line in" and set the recording control to Microphone, switch back to winamp, press "Ctrl+Shift"K" and speak or whistle into the Microphone to view the spectrogram. Instead of the microphone, you can set the recording control to "Line in" and apply any signal to your sound card's "Line in" and observe its spectrogram. If you are worried about frying your computer's sound chip, try this.

Setting up the preferences for visualisation in Winamp

Spectrogram of a song. The instantaneous spectrom is displayed using the bars at the bottom of the screen. This spectrum is translated to pixels of varying colours depending on the amplitude at the frequency and displayed as a vertical line in the voiceprint (or spectrogram). Within the spectrogram, the frequency increases vertically from bottom to top.

Setting the recording control to microphone for "linein://"

Whistling into the microphone and observing the Spectrogram

Frequency Modulation

Here's a GIF Animation of the modulating signal (top) and the corresponding frequency modulated signal (bottom) captured on an analog Cathode Ray Oscilloscope.
The modulating signal is a very low frequency sine wave fed from signal generator to an ICL8038 FSK trainer kit. You can see the frequency of the carrier wave change as the voltage level of the modulating signal changes slowly.

The video was shot using a digital camera. The location is VESIT, Mumbai's Communications Laboratory.

Here's how the GIF animation was created on a Windows based PC using free tools:
  1. The video was originally in .MOV (Quicktime) format. It was converted to uncompressed AVI using Rad Tools (free version of QuickTime must be installed on your system before you can convert the MOV to AVI).
  2. The uncompressed AVI was then loaded into VirtualDub and Image Sequence of a selected duration of video was exported. This particular time period of the video consisted of a sequence of 14 frames. The frame sequences were selected such that the waveform in the start frame and the end frame were almost in phase (i.e. looked the same) so that when the 14 images when displayed one after another should give an impression of a continuous loop.
  3. The exported images (or frames) were converted in a batch job from BMP to GIF using IrfanView.
  4. The GIF animation was created using Microsoft GIF Animator.The GIF images were imported into it, the animation was set to loop forever and the delay between each image was set to 3/100 seconds since the video was originally shot at 30 frames per second.
  5. The GIF animation was saved and ulpoaded to Picasa which now supports GIF images with animations.
The above steps can be used to convert any AVI file to GIF Animation. You do not need to used RAD Tools in case your video is not in MOV format as VirtualDub can directly import video files encoded with popular Codecs like MPEG or DivX or XviD. Now days are many websites which help you create a GIF by uploading individual images for each frame. Some of these are:
GIFup (can import images from flickr) 
gifninja (allows conversion of video to GIF)

Thursday, September 16, 2010

Electroluminescent Strips

Electroluminescent strips are available in all shapes and sizes. They can even be cut to whatever shape is required as long as the end terminals are left unscathed. These strips find use as backlight for watches and other devices having LCDs. High voltage AC signal is required to turn on an EL Display and special drivers are available to achieve this. Typical AC voltages applied to the EL display are 50V to 250 VPK-PK, with a frequency of 50Hz to 1KHz. The current consumption depends on the area of the display - a display having an area of a few (< 5) square inches would draw somewhere around few tens of (< 100) microamperes.
So the job of the driver is to essentially draw a few tens of milliamperes at 3.3/5.0 volts DC and convert it to around 100Vp-p AC at a few hundred hertz and supplying a few tens of microamperes of current.

Information Regarding ELs:

Inside Electret Microphone

Electret Microphones come in all kind of sizes. Let us look inside three of these:

Type 1

Type 2

Type 3

Few useful links explaining the construstion and use of Electret Microphones:
These Microphones are available in Mumbai, India from Visha Electronics Corporation

Breakout Boards

So what do you do if you want to assemble a prototype of a project based on an IC which is only available in Surface Mount Package like one of these?

You make use of an appropriate Breakout Board (BoB). Lets look at some of these:

Quad Flat Package (QFP)| upto 64 Pins | 0.8mm Pitch

Quad Flat Package (QFP)| upto 160 Pins | 0.5mm Pitch

Quad Flat Package (QFP)| upto 160 Pins | 0.65mm Pitch

Shrink Small Outline Package (SSOP)| upto 40 Pins | 0.65mm Pitch

Small Outlined Integrated Circuit (SOIC)| upto 28 Pins | 1.27mm Pitch

All the above breakout boards are available in Mumbai, India from Visha Electronics Corporation

Make sure that before you solder your IC to the breakout board, you do remove the extra tinning from the tracks using a soldering iron and copper desoldering braid as shown in the photo below. Use of soldering paste while doing this is recommended. This will flatten the tracks and the you would be able to easily and accurately position the SMD IC before soldering it.

Eagle design files of a few other breakout boards are also available here.
Please note that breakout boards are not recommended for use with ICs which deal with high frequency signals (i.e. those above a few megahertz)