featured, Technology

Raspberry Pi Security Monitor Project – Take 2

So this is my second attempt at working on a security system project with my Raspberry Pi.

Unfortunately, my first attempt was abandoned due to holidays and I never picked it back up after coming back. So here goes attempt 2!

As before I’m using a Raspberry Pi Model B 256MB RAM (old model) with Raspbian OS. I’m still going to use OpenCV but this time updating the version to 2.4.3 . I chose to build OpenCV from source rather than getting the pre-built packages from aptitude.

Compiling the library was simple but long process. you can follow either the guide on OpenCV wiki or from MitchTech blog. The Mitchtech blog has a cleaner easier to follow instructions as it deals only with Raspberry Pi (Unix install).

The process to compile took several hours so I suggest you let it run overnight or go watch a movie in the mean time.

After it successfully¬†compiled, running “make install” didn’t take long. then you are pretty much ready to go.

Initially, I looked at using Python for working with OpenCV but soon I found limitations as the python wrapper hasn’t been updated since OpenCV 2.1 (I believe). I have read elsewhere on the internet that an updated wrapper is coming soon. So I’m going to use C++. This is exciting because I get to use pointers. Nowadays with C# and Java and other languages developers don’t use pointers and don’t perform memory management themselves. This is good opportunity to further my knowledge of pointers and get familiar (again) with C++.

I have installed this last night and today I’ll be playing around to get basic image manipulation working. I need a refresher as it has been 2 years since I last used OpenCV and C++!

Will be posting an update soon!

featured, Technology

Raspberry Pi Security System Project

Earlier I posted my intention to build a simple security system using Raspberry Pi and a webcam. I had a bit of time to think about it now so here are my thoughts.

For hardware, I will be using USB Webcam for video capture. In terms of software, I’m aware there are a few open source webcam viewing and recording applications which I could port, but I want to develop an app for recording and playback of video. I will be using OpenCV for capturing and recording.

I chose OpenCV to give me flexibility in my recording and playback. I have previously used OpenCV for my masters’ thesis for detecting motion of people. So I am fairly familiar with the framework. For this specific project my first aim is to simply capture video and to assess the highest frame rate achievable.

So the requirements in short:

Phase 1: Application should be able to capture video using USB webcam and store on network share. Application should also playback the recorded videos.

Phase 2: If the frame rate of video is fast enough, enable motion detection. If motion is detected, recording should start.

Today I will be installing OpenCV and looking for drivers for my Labtec webcam 2200. I am hoping once everything is installed and ready to go, I get time to sit down and punch out the code.

I will keep posting my updates here. Any small updates I will post to twitter. You can follow me @atharvai.

featured, Technology

My first Android app

Hello all

Today I finally started some Android development. I’m not a Java developer and have never done mobile development before but I was keen to get started. So as usual, Hello World was the first app I had to build.

I started off with AppInventor, which I found was great for drag-n-drop GUI and programming. This was great to start off with and get familiar with some of the GUI components. However, I wanted to see and write code. So I headed over to http://developer.android.com and clicked on getting started. To be honest I skipped the “What is Android?” section and moved to “Application Fundamentals”.

Android SDK installed, Eclipse configured, Android Virtual Device setup and we are GO. New Android Project created and compiled. A blank screen ūüôā . It was time to add a couple of UI controls a TextView and CheckBox. I could have used the friendly UI to drag components onto the device “screen” but I thought I should go straight for XML.

A TextView followed by a CheckBox underneath. Switch to the Graphical View tab and we get a visual confirmation of these two controls. Simple stuff so far.

Now we want to change the text of the TextView. We can add android:text="caption" to the above XML but that’s static text and boring. Let’s go to the source code in our HelloWorldActivity.java file. The following two lines of java get the TextView control and sets its text property:

final TextView tv =(TextView) findViewById(R.id.textView1);
tv.setText("changed Text");

Similarly for the CheckBox:

CheckBox chkEnable = (CheckBox)findViewById(R.id.checkBox1);

We can compile and run this. You will see the “changed Text” at the top and right underneath it a check box.

Hello World


The next step for me was to add some functionality to the Check Box. Here’s the code:

chkEnable.setOnClickListener(new OnClickListener() {

      	  public void onClick(View v) {

      		if (((CheckBox) v).isChecked()) {
      			Intent in = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
           		 	   "Enable GPS" , Toast.LENGTH_SHORT).show();  			
      		else {
      			Intent in = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
      			Toast.makeText(HelloWorldActivity.this, "Disable GPS", Toast.LENGTH_SHORT).show();



Here we add a onClickListener to detect when the Check Box has been clicked/tapped. In this we have a onClick() method which defined the actions to take when the check box is clicked. Here I am opening the Location settings of Android and showing a toast notification. I should mention here what an “Intent” is. An Intent is a message for a specific activity, ¬†service or broadcast. For Activities, this could be the action to perform, and for Broadcast this could be a message. Above I’m using an Intent to perform the action of starting the location settings Activity. I then use Toast.makeText to show a notification.

So far so good. This wasn’t a big challenge so I set out to add Google Maps. I already had the functionality to open Location settings so I thought this follows on nicely. This is where things get complicated. I won’t post the whole code here but I will link to the tutorials I followed.

[1] http://developer.android.com/guide/topics/location/index.html

[2] http://developer.android.com/resources/tutorials/views/hello-mapview.html

[3] http://developer.android.com/guide/topics/location/obtaining-user-location.html

These give a step by step tutorial to add Google Maps and also acquire a position fix using either network or GPS. So here’s one I made earlier:

Hello World with Maps, Notification and Location information

Here I have taken the location information and displayed it in my TextView. The little Android shows the current position and the Toast notification is triggered by checking the “Enable” check box.

You can get this apk here. This is for devices with Android 4.0 and above. I have only tested this on Samsung Galaxy Nexus and with a help of a friend on Samsung S II.

Disclaimer: This software is provided “as is” with no warranty. (I have always wanted a chance to write that ūüėõ ).

Articles, featured

TEDx Imperial College

On 24th March 2012, Imperial College London students hosted their first TEDx event. It was my first time attending a TEDx event too! I have to say it was great fun listening to innovate new ideas. being a graduate from Imperial College, it was great to go back for the day.

The event was 6 hours long and split into 3 sections with 12 speakers. The sections were as follows: Changing Perspective, Breaking Boundaries and Improving Lives.

The first talk was presented by Manel Torres called “Spray-on Fabrics“. Manel Torres talked about his research on fabrics sprayed from a can. He has achieved this and was wearing a t-shirt that his colleagues sprayed on him.Other than the fact that the fabrics were sprayed onto the body, what was amazing was that if the fabric was cut or ripped, you can simply spray on a layer over the rip and it is mended. The dry out time is fairly quick and it doesn’t stick to skin or hair!

Next up was Nick Sireau who spoke about rare diseases and how they are fundamental to understanding some of the common diseases. He spoke at length about Alkaptonuria (AKU) and how it has no cure but advances have been made to treatments and support for the patients.

The first session ended with Andrew Morley talking about “Music from the Genome”. It was the process of taking the DNA and translating it to music; mapping the bases to musical notes and creating a choral piece.

The second session focused on breaking boundaries, but the talk by Michael Korn created  boundaries or walls. KwickScreen is a product designed by Michael which is essentially a retractable room partition. It is a portable device which creates a screen or a partition when pulled out. This has currently been used by the NHS to create partition between patient beds and sections. The idea is simple and why it works.

Alexander Schey presented Racing Green, a student team at Imperial College set out to change the electric vehicle scene. They built a fully electric car with a top speed of 200 kmph and range of 400+km on a single charge. The most impressive feat is the endurance drive on the Pan American highway from Alaska to Ushuaia about 26000km. The technology is very promising.

Aldo Faisal spoke about breaking into the brain and helping people with paralysis or some form of disability to interact with computers. He explained how the eye and it’s muscles are connected directly to the brain and so even with any spinal cord injury (which causes paralysis) , the eye can still move at will. Using this fact, he built a cheap and affordable eye tracking device allowing people to interact with the computer through simply looking at the screen and blinking.

Aleks Kolkowski played the old Victorian sounds of the Great Exhibition of 1851 through the use of wax cylinders and gramophones. Sophie Scott showed how laughter is the emotion which is shared among all cultures including the tribes of Africa who have had no contact with any other civilisation. Interestingly she states that rats “laugh” as well.

John Graham-Cumming talked about Charles Babbage and his Analytical Engine, the first computer. Interestingly, this was never finished and the design remains on paper. Now a project is under way to construct this machine and bring it to life.

Andrew Shoben is THE public art professor in the UK. His work revolves around integrating public art with the public. His art came in the form of tuned railings so when struck in order played a tune; a project in Cambridge where benches and bins were robotic so when called, they would move towards the people.

Joanis Holzigel spoke about e.quinox. A student initiative to help improve the life of villagers in remote parts of Africa by providing cheap and clean electricity. The project has already had an impact on over 2000 people in Rwanda and Tanzania. e.quinox provides battery boxes charged through solar energy and sold cheaply with LED bulbs.

Last but not the least was Junior Smart. Junior has set up a St. Giles’ trust Southwark Offenders Support (SOS) aiming to reduce re-offending by ex-offenders. He helps by providing a holistic and tailor-made support to each ex-offender in the programme. In the 5 years of running the re-offending numbers have gone down from 75% to under 10%.


This TEDx event at Imperial College London was a good experience in terms of learning about the new technologies,  social and entrepreneurial initiatives.

featured, Photography

Long Exposure Shots using Military Shooting Techniques

A couple of weeks ago I went on a night photography tour around London with a few friends. I knew most if not all photos I will be taking would be long exposure shots. I faced a real challenge as I wasn’t armed with a tripod. I thought I would use ledges or park benches or something like that to rest my camera on for these shots. This only worked in cases where the position was right for the framing of the shot, but there was still some vibrations from the shutter clicks.

When holding the camera, I knew some basic techniques like holding my breath for a few seconds to get my body stable. This wasn’t enough even for exposure of 2 seconds. So I started researching about how to stabilise the body (mine and camera’s) for these shots.

I came across a great article written by an officer in the US Army. He details the shooting (firing) technique used for rifle shooting and how this can be applied to photography. His explanations are clear and are illustrated. There are “four fundamentals of marksmanship”: Body posture, Breathing control, Aiming and Sight, and Trigger (shutter) squeeze.

This is worth a read (link below) if you want some great long exposure shots without a tripod. Although I wouldn’t recommend a 30s exposure with this technique!

SOURCE: PentaxForums , image

featured, Technology

Google Chrome (beta) for Android

Early his week Google released a beta version of their Chrome browser for Android 4.0 (Ice Cream Sandwich). You can download the beta from Android Market.

The native web browser in Android has shared the webkit with the desktop version of Chrome for a while now. The performance improvements are related to JavaScript execution and it feels well optimised for a mobile environment. The UI is very simple and similar to the desktop version. Some nice features like tab organisation are well implemented.

Instead of talking about the UI, here are some screenshots.

Try out Chrome and let me know what you think.

BI, Business, featured, Technology

A new direction

I know my blog has been quiet for a while and I’ve been very busy. Now I aim to write a post on a fairly regular basis.
My topic of choice is Business Intelligence and Data Warehousing. A completely different topic to what this blog has been about.

However I will start off easy with basic concepts and hen dice deeper with more advanced topics and implementation examples.

The first post in the series will be published soon.

Keep checking or follow me on Twitter for updates.