PDA

View Full Version : anyone knows how to calculate muslim prayer time?



luqman83salleh
- 2nd September 2004, 08:57
hello.. anyone knows how to calculate muslim prayer times using picbasicpro.. the problem is to calculate muslim prayer times, complex formulae needed like :



(R-L) T
Z = 12+ ----- + --- ........1
15 60




1 {sin(-0.8333-0.0347(H)^0.5)}-sinD.sinB
U= -- arccos -------------------------------------- ........2
15 cosD.cosB




1 -sinG-sinD.sinB
V= -- arccos --------------- ........3
15 cosD.cosB




1 sin{arccot(1+tan(B-D)}-sinD.sinB
W= -- arccos -------------------------------- ........4
15 cosD.cosB




1 sin{arccot(2+tan(B-D)}-sinD.sinB
X= -- arccos -------------------------------- ........5
15 cosD.cosB




where

B= latitude of place
L= longitude of place
R= reference longitude (i.e. TIME BAND x 15)
H= height above sea level in metres
D= declination angle of sun from celestial equator (-ve in southern hemisphere)
T= equation of time
G= twilight angle

Fajr = Z-V
Sunrise = Z-U
Zuhr = Z
Asr1 (Shafi) = Z+W
Asr2 (Hanafi) = Z+X
Maghrib/Sunset = Z+U
Isha = Z+V

such formulas above are very complex to implement in picbasicpro.. any help to implement in pbp those formulas will be very appreciated..

Dwayne
- 2nd September 2004, 14:54
Hello Luq,

I think it can be done without too much work... A few subroutines to do the Arc* formulas. In Calculus, you can use Series on the Arc* rountines. PBP does do floating calculations.

The only problem you may have, is the Accuracy. If you want just a rough idea, that is fine...If you want to have exact, or close to exact, you will not achieve this. Especially since Dividing in PBP will leave you (at most) a 16 bit number that is usuable. And when you Multilply and Divide so many times, that 16 bit number becomes a rather rough number.

Dwayne

Melanie
- 2nd September 2004, 14:55
Add-in a GPS so the PIC knows where you are, GyroCompass so you know which way to point to Mecca, and a $1999.95 price tag for sale in Saudi Arabia, and you're a self-made millionaire... you saw the idea here first folks! What a forum...

Already got a whole range accessories planned, leather carrying case, roll-up Bluetooth wireless prayer mat that detects when it's in use and automatically silences the reminder alarm...

I just knew I should have gone into sales rather than engineering...

Dwayne
- 2nd September 2004, 15:07
Hello Melanie,

Melanie>>Add-in a GPS so the PIC knows where you are, GyroCompass so you know which way to point to Mecca, and a $1999.95 price tag for sale in Saudi Arabia, and you're a self-made millionaire... you saw the idea here first folks! What a forum... <<

too late! I have already called my Patent attorney...I am not going to admit that I got the idea from this forum.....<g>

Dwayne

carl_schell
- 3rd September 2004, 05:31
luqman salleh -

One other possible option for you to consider...

I would assume that the sunni muslim religion would have tables available for all prayer dates for the comming year(s)...or...

These dates could be calculated very accurately and very easily on a calculator or computer, and then placed in a lookup table. Hook up an RTC (Real Time Clock) device such as the DS 1307 that Ralph recently turned me onto, that has very nice accuracy and even keeps track of leap years, and you could simply call the appropriate prayer time based on this. I do not mean to sound like this is a flawless method, but it is a different possible approach and may offer you added comfort of accuracy.

As you are interested in this, I have attached a very cool program I found on the internet a few years back for calculating the phase of the moon...used in calculating Ramadan. I have many Muslim friends that would be very excited about your idea! Best of luck to you and let us know how your project goes...we are all happy for you!

Best Regards,

Carl


-------------------------------------------------------
PIC Development Boards with Bootloader!

www.schellelectronics.com

e-mail: [email protected]

Free shipping worldwide
-------------------------------------------------------

Ioannis
- 3rd September 2004, 08:37
You people are unbelievable! Especially Melanie (with the hidden preference in leather is suspect...!).

Well to answer the mans problem (!) may be a table in a external EEPROM would be more quick to retrive the data than calculate them?

Excel could help in calculating the data.

Ioannis

Melanie
- 3rd September 2004, 09:02
*smiles*

Dwayne
- 3rd September 2004, 17:45
Hello Ioanus,

I>>You people are unbelievable! Especially Melanie (with the hidden preference in leather is suspect...!).

Well to answer the mans problem (!) may be a table in a external EEPROM would be more quick to retrive the data than calculate them?<<

Could you upload the exact formulas for your idea?
I just may get a wild hair, and make a program on the chip for this.

The reason why, is because I used to do a LOT of satellite communications from both low orbit and Geo-stationary Sats. Ran many different modes of communication through them. And in order to communicate with Low orbit Sats, you had to use a program to see if it is in "Line of Sight" for communication. The same principal can is being used in your religious prayer time.

Dwayne

luqman83salleh
- 4th September 2004, 08:04
thank u all of member who support me....
i will try my best to make it done well...
ok
thank for the information
if any member from malaysia plz contact me...
we can study together....
see u next time...
bye...

Ioannis
- 6th September 2004, 07:08
Well Dwayne, I do not have something ready right now. But you can use the formulas at the top of the thread, put the results in an EEPROM after some rounding and I guess you are ready to run.

This is a good solution when you have to calculate some data based on a complicated formula with MCUs. Like the Sinewaves, you calculate the numbers, put them in EEPROM, and after that on run time, values are retrieved and output, filters and voila ... a close sinewave signal in no time! (Well the distortion may be a little more than analog oscilator but... nobody is perfect).

Ioannis

Acetronics2
- 6th September 2004, 09:54
Hi, everybody,

For complex math calculations ... i've seen co-processors on Melabs site, called PAK XX...
That's not the fastest solution ...but it's an easy solution to use !!!
Floating point is there usable ...

Alain