Monday, August 13, 2012

Scientific Instrumentation Using Python

Why?

Its Free and Easy to learn
You can use it in Linux, Windows and Mac. For this tutorial we are going to use windows

You must have VISA installed before hand (I used NI VISA)
Steps

1 - Download and install Python Installer from http://www.python.org/

2 -  Download and Install PyVISA from http://sourceforge.net/projects/pyvisa/files/latest/download

3 - Run the following command


That's it. Its this simple.





Tuesday, July 31, 2012

Joomla Webpage Design


First crate a Menu

Go to Menu manager from Menu -> Menu manager -> Add Menu

Then add a module to it.

In Menu List go to right most colom to add module and click it. This will ask you to create a module that will correspond to this menu. You can also add sub-menu to this menu.

Select the pages where this module will be displayed in module settings.

Create category of article and link them to menu items.


1) Hiding print, email Icons

Go to Article manager -> Options and set settings


1) Adding HTML page to an article

Go to code toggle in article editor and copy paste following code

<p><iframe src="http://www.patilprashant.com" frameborder="0" width="100%"height="100%">
    <p>Your browser does not support iframes.p>
    iframe>p>



2) Adding readmore button in Joomla ARticle

In the article editor navigate the cursor to the position where you want to have readmore and click the "readmore" button located at the bottom of the page. 


Tuesday, July 3, 2012

Using USB datacard in Ubuntu

If you are in India and want to use Internet on move you need an USB modem. You can insert the sim of your choice,  activate the "data plan" for that operator and start using the Internet.

Unfortunately, all the network provider in India provide driver for these modems only for Windows operating system. If you are an Linux user, there is absolutely no support for these modems.

Below is the detail procedure of how I used my USB Modem ( MTNL 3G JADOO) with Ubuntu 12.04LTS


Step -1:

I used Sakis3G script to use this modem. You can download it from here.

http://www.sakis3g.org/

The version I downloaded was "All architects - Binary free version  (144K)". Unzip and save the "Sakis3g" on Desktop.


Step - 2:

Open terminal and exceute the following command




Step - 3:

Following window will open after executing these commands

Select "Connect with 3G" option from the list and hit OK.





Step - 4:


Select "USB Device" and hit OK




Step - 5:

Select "HSPA Data Card" and hit OK. If you have different data card that will be listed here.




Step - 6:

Select the Kernel module. Depending upon your datacard you will have different options. You need to try all of them. For me "option kernel module" worked perfectly fine





Step - 7:

Select the APN. Depending upon your network provider APN will change. You can find the APN by looking into the settings of these network provider in the corresponding windows software. In my case, I used the datacard in Windows machine. The software for datacard in windows machine had an option called profile. In there, APN was listed. 

For Vodafone and Reliance, it was simply "www" for BSNL it was "bsnlnet". You can also try your luck by calling customer care. As I was using Reliance 3G SIM, I simply selected "Reported by your modem (www).


Step - 8:

Most of the network provider don't have any username and password. But script requires it, So simply put any text for username and password.




    


Step - 9:

If the modem is able to connect you should see the message box similar to below. In my case for Reliance the message was "connected to unknown operator and for Vodafone SIM, it detected the network and message was "connected to vodafone"


Step - 10:

Once you hit OK, following window will appear and you should be able to use Internet. When you want to disconnect simply select Disconnect and hit OK.

s


Note - I have successfully used this script for Reliance 3G GSM and Vodafone. I could not use it for BSNL SIM. Also note that this script is only useful for GSM network provider. I tried to use it with CDMA datacard with no success.

Wednesday, March 17, 2010

Noiseless measurement of Optical Signal and Laser Pulse generation

After one week of thinking my project is finally decided its "Noiseless measurement of Optical Signal and Laser Pulse generation". Deciding the project was tough job, not only I had to consider that the project should be complited in three weeks it should also not very complicated as well as not very simple. I had many thoughts in mind like making "MP3 player", "USB pen drive", "Touch screen " or "Laser guided robot" but I did'nt like any of them very much since they are mostly electronics gadgets, available in market ( and if you respect chines they can be really very cheap) also I am Physicist not an electronics engineer. Electrnics is just happend to be my hobby but Physics is my passion. So I wanted to decide some project which will reflect my Physics background and finally came up with this Idea.


Motivation-
Often during optical measurment background light is a big problem (still remember the complite blackout of optics lab ). I decided to come up with the idea to remove this background light noise. The idea is as follows-
  1. Light from the light source ( usually laser , monochromator ) is allowed to pass through sample and chopper on to the detector. The job of the chopper is to periodically allow and block the light from the light source. In this way the detector will receive two kinds of signals one with (laser + background ) and other with only background light. Now I just need to subtract these two signals to remove the noise.
  2. Second part of the project is generate laser pulse of desired pulse width of order of millisecond. The idea is to control the speed of chopper motor using PWM method. A feedback mechanism is used to continuously monitor the speed of the chopper motor and then use this data and the set value of pulse width to control the speed of motor.
Part List-
  1. Any 80C51 core micro-controller (I am using P89V51RD2).
  2. LDR ( Light dependent resistor ) as detector.
  3. Chopper and opto-coupler (soon going to post the picture of my opto-coupler ).
  4. LCD.
  5. Keyboard.
I will keep posting the development in the project. I have got three weeks to complete this project lest see how I do .


Update 16 April :
Finally got some time to write.
I started with interfacing LDC to microcontroller. I have written a nice code library for interfacing it. Then I switched to interfacing ADC. I used 8080ADC. Instead of  using external clock using say 555 I used the clock generated by the uC itself. The ADC worked perfectly fine. I landed up in making a simple voltmeter by interfacing the LCD and ADC together. Till now everything was fine but later I observed that ADC is too slow for my use (data sheets says 100us for each conversion ) so I had to ditch the entire Idea of using ADC and I switch to atmega16 which has internal ADC with 15ksps. It was frustrating as my design was completly ready and now I have to start from scrach. Any was I switched to atmega16 all the software development is completed and its working fine atleast in simulation. I will implement it in hardware later.

Sunday, March 7, 2010

What really happened on Mars?

I remember when I was a kid probably in 6th or 7th grade our principle ma'am gave as a example in our daily morning assembly program. Since I was very tall among other class mates I was standing at the end of the line and was really strugling hard to listen her. She was talking about some billion dollar project which was failed just because of some error of 1 and 0. She further told as that Nasa has sent a spacecraft to mars and the robot is male functioning just because of some mistake in 1 and 0. Well at that time I was thinking how come a signle sweep in the digit of 1 and 0 can cause the whole project to crash. Although I didn't understood anything at that time but I was very much fascinated by the whole Idea of sending a bot to Mars. I read each and every article I found in paper regarding the Mars Project but most of them didn't satisfied my needs.
After very long time when I was in 12th standard and my physics teacher taught me digital electronics I understood something what my principle ma'am was taking about. Now I understood what she was talking about I knew that it has something to do with the Boolean condition. Now I am in fourth year of my graduation in IIT Bombay and It took me almost 12 years to understand what really happened in Mars.

So here we go-

The Mars Pathfinder mission was widely proclaimed as “flawless” in the early
days after its July 4th, 1997 landing on the Martian surface. The spacecraft has to gather the meteriological data and send them back to earth. The spacecraft has one processor and has to do many process at time. The engineers decided to in manner called "preemptive priority scheduling of tasks". By tasks I mean process like gathering data or communication with earth.
The operating system is designed such that It after every fixed amount of time (time slice ) the OS will look for all process and assign priority to every process in every cycle and execute process with highest priority.

Pathfinder has mainly three tasks low priority "meteorological data gathering" which run infrequently , medium priority "communication task" and high priority "information bus management task" which run very frequently. The information bus can be assumed as the common memory used by every tasks to exchange information and hence bus management task should run very frequently. Access to the bus was synchronized with mutual exclusion locks called mutexe which will insure that bus is locked to a particular task and other tasks can't access the bus.

How it works-

The meteorologica task will run , it will collect data and while communicating with earth It will access the information bus through mutexes which will lock the bus. Now if an interrrept occur and Information bus is needed to be accessed the Bus management task will wait till the bus is unlocked by mutexe. Once bus is released the Bus management task will use it.

The bug-

Suppose the Bus is locked by the meteorological data task and bus management task is waiting for the bus to be released. At this point of time if interrupt occur that causes the "communication task" to be scheduled with high priority. The OS will keep the "meteorological task" at hold (waiting ) and will start running slow "communication task". Now the communication task is running and "meteorological task" is waiting which has unfortunately locked the Information bus and the highest priority "Information bus management task " is still waiting to access bus. After some point of time if Information bus management task didn't get to access bus "watch dog timer" thinks that something is terribly wrong with system bus and call for Total System Reset.

So where is 1 and 0's-

Now the mutex object accepts a boolean parameter that indicates whether priority inheritance should be performed by the mutex. The basic idea of the priority inheritance protocol is that when a job blocks one or more high priority jobs, it ignores its original priority assignment and executes its critical section at the highest priority level of all the jobs it blocks. After executing its critical section, the job returns to its original priority level. Before launching the pathfinder mutex was initialized with this parameter OFF. So here comes the 1 and o mistake if had it been initialized with this parameter ON the mutex could have released the information bus locked my meteorological task for bus management task which in turn could have prevented watchdog timer from invoking total system reset.

So was it debugged ?

During the development stage of Pathfinder the OS has a C language interpreter intended to allow developers to type C expressions and functions to be executed on the fly during the system debugging. Fortunately Pathfinder was launched with this feature still enabled. A C program was uploaded to the spacecraft, which when interpreted, changed the values of the initialization variable of mutex form FALSE to TRUE. There was no system reset after that.

Saturday, March 6, 2010

Mountain First Aid

Note-For educational purpose only, professional advice should be taken before going to life threatening situation
First Aid person should be experienced

Seven steps to follow after accident -

Step-1:Take the charge of the situation.
  1. If more then one person is injured the order of priority,
    1. More injured but good change of survival should be given first priority.
    2. More inured but can wait.
    3. Who can do safety treatments.
    4. Less chance of survival.
  2. Climb leader should survey the seen immediately.

Step-2:Approach the patient safely-
look for rockfall, avalanche, fast water flow and physical limits.

Emergency rescue and fist aid-
Shift the person if he is in danger or the rescuer is in danger otherwise first inspect the injury. Watch for -
  • Alertness
  • Response of your call.
  • Responsive of pinching (semiconscious )
  • Unconscious.
If semiconscious or Unconscious check for ABCD-
A- Airways ( see nose and mouth ). If there is clothing of blood in nose or swelling in mouse. First clear the airways.
B-Breathing - put hand in front of nose or put small peace of cotton in front of nose.
C- Circulation - normal is 60-90 pulse rate. Pulse rate increases during unconsciousness and can go up to 180 . Observe the pulses from neck since hands will be covered with gloves etc.
D- Deadly bleeding -
External bleeding or internal bleeding.
If internal bleeding check for important sites
  1. Abdomen -
    tightness and swelling at abdomen.
  2. Thai -
    -swelling , blueish color and stiffness at thai.
    -Pulse rate will be very high but less powerful pulse or low pulse pressure.
    - Due to internal bleeding patent can go to comma . Immediately shit patient to hospital.
Step-4:Protect patient-
CPR http://depts.washington.edu/learncpr/quickcpr.html and Cardio.

Step-5
Provide dry clothes, pain killers, shelter and psychological support.

Step -6:Check for other minor injuries-
From head to legs- ears , eyes , teeths , redness at eye or readness at the bottom of eyes, check head, spinal injury (important - if injured stifness ), discolour of skin any defromity (visible fractures ) , swealing ( don't take chance it can be fracture )

Important thing to note-
fracture , spinal and head injury.

Fracture-
-don't move patent too much.
-tie with stick, thick clothes, newspapers since it give painless moment to patient.

Step-7:Carry out plan-
First aid leader will plan for further treatment and climb leader will plan for rest of party.If needed shift the person to base camp with a note detailing his injury . Strong person should shift the patent. Climb leader will decide whether to go further , wait for rescue or come back.

Mountain Manners

Set of rules and regulations that a tracker should follow.

1) Greetings-
Respect other trackers and local peoples, wish them in there local languages say hi, hello.

2) Walking Manners-
-single line don't overtake.
-rythmatical walk- All team should reach at time
-Week person must be in middle of line

3) Judging distance-
1 hour or 2 hour walk according to our capacity.

4) Passing Information-
through arrows or cairns ( heap of stones ) for people coming behind you so that they will not miss the track.

5) Noise Behavior-
-snow bridge can collapse.
-wild animal can attack because of fear.
-Avalanche.
-Rock fall may happen.

6) Hut manners-
When using forest guest houses or huts maintain cleanliness and don't leave any sigh after you leave.

7) Conservation of flora and fauna
-Respect wild animals.
- vegetation ( don't plug flowers etc because they can be dangerous.)

8) Camping manners-
-Camps and tent's must be near drinking water.
-Tents shouldn't be very near to river. ( because in some area river level changes in 5 min also (flash flood )).
-Should not be very near to rock fall area.
-Should not be very near to avalanche prone area.

9) Rescue and search-
Rescue for living person and search for dead person.

Do's and Don't-

1)Do's-
  • Planning (transport, food , climate, rescue ) and preparation.
  • Layout all the equipments (List of equipments ).
  • Select experienced leader accepted by all.
  • Management of rescue
    - chopper ( helicopter arrangement )
    -Bone break arrangement.
  • Greeting.
  • Walk in single line and rythmatical walk.
  • weak or injured person in middle of line.
  • Respect culture and religion of the place and local peoples.
  • Keep survival kit (dry foods etc used if lost ) and first aid kit with you.
  • Follow hut manners.
  • Conservation of flora and fauna.
  • Respect wild life.
  • Passing massage (use bushes to show direction or cairn ).
  • Pass bridge one by one.
  • Construction of bridge if needed.
  • Obey the order of leader and respect the leader.
  • Proof of ascent like photographs or videos.
2) Don'ts-
  • Don't go alone.
  • Don't make noise
  • Don't put too heavy load.
  • Don't disturb wild life, flora and fauna.
  • Don't through stones.
  • Don't thorough waste materials.
  • Don't smoke and use alcohol.
  • Don't pollute water resources (as you will drink that water in future).
  • Don't neglect minor injuries.
  • Don't make loose talk ( in mountain sickness you loose your temper, abnormal behavior ).
  • Don't touch unknown flowers.
  • Don't be over confident.
  • Don't disturb public or private properties.
  • Don't rest (during walking ) from where you can't see your partners.
  • Do not avoid week persons.