Wednesday, 24 July 2013

Turn your Raspberry Pi into an Azaan/Prayer clock

Recently I've been playing with the raspberry pi and given it's Ramadan, I thought I'd see if I could turn it into an Azaan (Islamic call to prayer) clock. Given the RPI is low powered I can leave it on and it doesn't need a monitor, keyboard, mouse, etc plugged in.

This is what I did:

1. Plug in a speaker into the 3.5mm audio output on the raspberry pi

2. Download python code from to calculate prayer times

3. Download azaan mp3 from again.

4. Write a python script to set jobs in crontab to play the azaan mp3 at the appropriate time (see code below or download here). The python code from has to be in the same folder for this to work.

My script utilizes the python crontab library. More info on setting this up available on the links below

Python crontab:
Installing modules:

The bits you may need to configure yourself are:

a) Longitude and Latitude (currently set to London UK)
lat = 51.5171
long = 0.1062

b) Timezone (currently set to 0+GMT and daylight savings =1 )
times = PT.getTimes((now.year,now.month,, (lat, long), 0,1) 

c) Location of azaan mp3:
strPlayAzaanMP3Command = 'omxplayer -o local /home/pi/Downloads/Abdul-Basit.mp3 > /dev/null 2>&1'

The code from is really configurable, so you can change the prayer time calculation method and a whole load of other adjustments. 

5. Add a job in crontab to run this script on a daily basis to update the azaan times:

# m     h       dom     mon     dow     command
0 1 * * * python /home/pi/Documents/ > /dev/null 2>&1

6. You're done. For each prayer , the raspberry pi will play the azaan mp3 via the speaker.

For All code and audio files I've used/written are available on the link below:

#!/usr/bin/env python

import datetime
from praytimes import PrayTimes

#Get Prayer Times
lat = 51.5171
long = 0.1062

now =

PT = PrayTimes('ISNA') 
times = PT.getTimes((now.year,now.month,, (lat, long), 0,1) 

print times['fajr']
print times['dhuhr']
print times['asr']
print times['maghrib']
print times['isha']

#Update Crontab with Prayer Times

from crontab import CronTab

#Function to add azaan time to cron
def addAzaanTime (strPrayerName, strPrayerTime, objCronTab, strCommand):

  job =,comment=strPrayerName)
  timeArr = strPrayerTime.split(':')

  hour = timeArr[0]
  min = timeArr[1]


  print job


system_cron = CronTab()

strPlayAzaanMP3Command = 'omxplayer -o local /home/pi/Downloads/Abdul-Basit.mp3 > /dev/null 2>&1'

jobs = system_cron.find_command(strPlayAzaanMP3Command)

print jobs

for j in jobs:



Thursday, 4 November 2010

Fix when Android Market cannot download

On my G1 running Android 1.6, I started to have problems with the Android Market. Any application that I tried to update or install resulted in an error message saying that the download was unsuccessful.

Luckily with a bit of googling, this is what I did to resolve the problem

1. Open Settings
2. Select Applications
3. Select Manage Applications
4. Select Market and the select Clear Cache
5. Repeat step 4 and clear the cache for Google Apps, Google Talk and Checkin Service.
6. Restart your phone

When you open the market it will ask you to login to your google account with your username and password. Once logged in , you will be able to download  and update apps.

These instructions are based on:

Thursday, 5 August 2010

Install Flash in Google Chrome Portable without Admin Rights

If you need to install Chrome and you don't have admin rights on your windows machine, then the best thing to do is to use a portable version, available from :

You can put this anywhere on your machine or even on a usb stick.

However if you want to use sites like youtube or google streetview, you will need Adobe Flash Player. As you don't have admin rights you will not be able to run the standard abobe installer.

This is what you need to do instead:

1. Download this file from Adobe:

2. Rename the file extenion from .xpi to .zip

3. Use an unzip program like winzip or 7-zip to extract the contents

4. Copy the files flashplayer.xpt and NPSWF32.dll from the contents of the zip to the folder \App\Chrome-Bin\5.0.375.55\Plugins

This will be where you installed Google Chrome and the 5.0.365.55 folder might be named differently.

5. Restart Chrome and enter this in the address bar: about:plugins . You should see Shockwave Flash listed as a plugin.

6. Try out

These instructions are kind of based on:

Friday, 23 July 2010

Run a command and read console output in VB6 / VBA

Needed to run a command line program from code and read the input. Found this useful code to do it:

Wednesday, 30 June 2010

Official Skype Install for Acer Aspire 1 (aa1)

Just got Skype running on my aa1 running Linpus Linux. There are a few blog posts out there with instructions, but I found an official download from Acer which is a lot more straight forward and worked for me where other methods didn't.

Just follow the instructions at:

There are also instructions too on how to install support for 3G USB sticks (Huawei 3G dongles) which I haven't tried out , buy let me know if it works for you:

Saturday, 8 May 2010

Half of LCD Monitor is Yellow

I have a 19" LCD Monitor from LG . A little while ago the right half of the screen had a yellow tint to it. I played around with the cables for ages but it was no use.

I considered buying a new monitor cable or even returning the monitor for repair until I tried out one thing. I went into the Monitor menu, went into settings and selected Factory Reset.... once I selected this, after a few seconds the screen was back to normal... yipeee ... hope this helps somebody else out.

Tuesday, 11 August 2009

Visual Studio Tricks

I am going to keep this as an ongoing post with whatever tips and tricks I come across when using Visual Studio.

Show Active File In Solution Explorer

When working with big solutions and projects this is so useful. By default visual studio doesn't highlight the file that is active (i.e the one you are viewing) in Solution Explorer.

To activate this do the following:

Tools – Options – Projects and Solutions – Track Active Item in Solution Explorer

Credit for this tip goes to Ronald Widha's blog .

Use the Command Window to Search for Files

In Visual Studio I really miss the equivalent of Eclipse's CTRL - T shortcut to search for classes.

The next best thing I have found is to open the command window ( View > Other Windows > Command Window ) and type:

>open file you're searching for

and a little drop down will pop up of files that start with whatever you have typed in.

More Tricks

Also check out any of my blog entries tagged with visual studio