A Travel Through History with Lahore Sightseeing Bus

A government based red, open top double decker bus called Lahore Sightseeing Bus with its surprisingly amazing staff is probably the best and cheapest way to explore the city of Lahore. Especially for starters, it is the best way to avoid creepy traffic and yet explore history of Lahore from present day Lahore to Mughal Lahore.
Lahore Sightseeing bus on its terminal
Picture credit https://www.theguardian.com

The best way is to book your tickets beforehand, especially if you are planning a trip on a weekend. Individuals, as well as group tour bookings are possible.You can also have a trip for your school or corporate company. For more details of schedule and booking, visit this page
Sunday, 10:00 A.M. would be great if you want to see the real beauty of Lahore with less honking horns and traffic creeping around.
Morning rides  are peaceful, mostly.

While if you want some hala gulla, book a tour after 12:00 P.M. Tour are available as late as 9:15 PM. Booking is possible through phone only. But the staff is very professional contrary to Government employee attitude in Pakistan. For example, they even replied me on facebook at 3 A.M. That's why their "Typical time of reply" even on facebook is one hour.
 The trip I took was surprise after surprise. I wasn't expecting a guidance at 3 A.M. and than next day when I called at exactly 9 A.M., staff not only responded but was kind enough to tell me that some seats are available due to cancellation. And as we were late, they even called me to confirm our booking. So 5 stars for their customer service. 
Starting point of Lahore sightseeing bus is Qadafi Stadium Lahore terminal of the bus.



Alhamra Art Council situated within Qadafi Stadium


The journey starts from newly built Lahore or what we can call as "Modern Lahore", time travels through "British Lahore" and ends at the Old Lahore (You may call it Mughal Lahore). So in a way, you can almost see  all colors of Lahore through this four-hour  journey.
A better, more interactive map;
http://www.sightseeinglahore.gop.pk/new/route/

The biggest perk of this journey is ticket price. It only costs RS 200 and if you have a student card, you will get 50 % off. Childern below 5 are free. Booking for the complete bus is also affordable.

Tour guide was great with her work. She was friendly, started with a joke and also told about the history of the city. Although her commentary was great but I think it should be in Urdu as this is the city of Urdu with most of the literary work done here Urdu. In fact, Urdu is in the history of Lahore as well. While the last one is at the backside of Badshahi Masjid near food street, Lahore grand Park and walled city.
 Bus stops there for 1.5 hours. As the bus is parked near historical attractions as well as food street so you can have great time there. Delicious food, a rickshaw ride of walled city , a visit to Greater Iqbal park is to name a few. This stop is full of enjoyment and you may spend all day here. 




Overall It was one heck of a trip. Thumbs up for the management of Lahore sightseeing bus.
Following video and articles would help you dig more deeper;



Proposal for The Solar Cell in IEEEP

This Saturday,  I had a meeting with Voice President Engr. Suleman Najib Khan of  IEEEP and other prestigious members including Engr Shahid Asalm (NESPAK) and some others. I presented them this document for the proposal of Solar Cell in IEEEP.


[Abstract]

In our last meeting of IEEEP held at Lahore Office, it was decided to take the idea of The Solar Cell to the real level. Several options were considered and it was concluded that solar  has a great potential and it is future of Pakistan. Among the renewable, it is most suitable for the country especially for off-grid distributed generation applications for smaller customers as of its ease of installation and lower costs. But it was noticed that Pakistanis don't have required literacy about this important renewable resource and they are still being robbed by amateur dealers. So IEEEP decided to step forward and start a cell  both for literacy of solar and Design of small systems. It was decided that This solar cell will not only propagate knowledge about solar but also it will also help people design and install durable solar systems. In the light of the meeting, following is the proposal of our roadmap.

[The Solar Cell]

The Solar Cell will work under IEEEP and it will have following priorities. 
  • To literate people about solar with common, layman language.
  • Help people design robust and durable solar system for their homes.
  • Survey Local markets for solar related products and make a general list of equipment that is available locally.
  • Survey requirement of people and try to do make cell activities as people friendly as possible.

[Literacy]

It is one of the most important things that we should realize people about the potential and benefits of using renewable energy resources. Environmental issues and load-shedding are two most crucial issues for our country and both have sub-solution via using distributed, home scale, environment-friendly renewable energy resources. This can only happen if we literate people about these resources and their long-term impacts as well as short term benefits. It is also necessary to educate them in easy layman language. So following are some steps that can be taken to do this.
  • Making a website dedicated for The Solar cell. It could be a sub-domain of already available IEEEP site. 
  • The website will contain all the literature in both Urdu and English Languages.
  • Literature will include both technical things like how to install, basics of solar etc and why to use solar and how will it impact long term.
  • A news section will have important news of solar from all over the world. This may contain links to the news from different websites and also some from the cell.

[Design]

One of the major problem faced by common Pakistanis is lack of  professionals that can educate them the real situation of solar. This void can be filled with a solar cell consisting of experienced and young blood eager to work in the field. Following are some points to highlight it.
  • Solar Cell will first design a template that will be used further for specific designs of systems required for people.
  • The team will design both DC and AC system design templates.
  • It will also design a simple pre-design template that will help people decide what type of system they want. This template may contain a calculated guess of expenses and output. Kind of a requirement document.
  • All the designs will be supervised by experts. 
  • The team will be divided into sub-categories according to work.
  • All the design will use local equipment easily available.

[Surveys]

Surveys of both local markets for available equipment and installed system will be done on regularly basis as they are necessary to get a know how of what is going on and also to update yourself. These surveys will be arranged by prestigious members of IEEEP

Better Back Up Your Work

Losing your data and starting again from point blank in a new hard disk or Laptop. If you use your laptop to save your important data, you may have came across this problem a couple of times. In fact a lot of people, including my self have face this problem in one way or the other. Reasons are different, may be your hard disk blown up or your laptop was stolen or something else but end result is same, a lot of tension and doing again all the work you have done already . Also starting from point blank where you don't have anything you used to help yourself is itself a big problem, isn't it?
Losing your data means all those hours you have spend working on a project or thesis or probably on an office assignment has gone into waste. And also all your important files from pervious assignments or your books or your collection of movies are just gone. You have to do that all again.
In cause of movies or some publicly available data, you may be able to download it but what if it is your thesis or your research work or anything that is private? It means you have lost it and you will have to do it again.
A famous post  that hits the social media  last days with a lot of people sympathizing  with the victim also state a similar problem. Apparently some woman scholar from Punjab University lost her five years of research 'cause of her laptop misplacing.
Now the question is what is solution of this sort of problems? You have to backup your data in order to avoid these kind of incidents. There are actually two ways you can backup your data. Either use a cloud service like Google Drive  or buy an extra portable hard disk often called passport and backup your data regularly.

Cloud services like Google Drive:


Google drive is a cloud service provided by google. It offers 15 Gbs of free storage and you can but unto tera bytes of storage for external use as well. There are two options to back up your data, either using manually uploading or using google drive software. Later is rather an efficient way of backing up your data as it automatically backs up all the files that are in a spefic folder. There are couple of other cloud services as well that can be used to do that. For further details about google drive..

Portable Hard Drive or Passport:


This is a better option if you are not connected with internet  most of the time or if you have slow internet connection. Portable hard drive is available in market for up to eight thousand rupees. Or you can also shop it online from Amazon or some other local online store like

Cockcroft–Walton Voltage Multiplier Simulation on Proteus

CW multiplier is basically consists  of n stages of a voltage doubler. A n stages CW converts Vpp (peak to peak) source voltage into n*Vpp or 2*n*Vp. Using only diodes and capacitors and cascading basic block, we can convert small AC voltage into high DC voltage. So a N stage CW voltage multiplier converts input with following way.
 V_o = 2NV_p = NV_\text{pp},
First of all let's analyse it fundamental building block to understand how it works.
Here source is connected to a capacitor and a diode in parallel with reverse bias condition then there is another diode in forward bias configuration and then there is another capacitor. This Circuit Works in a following way.

  • In fist cycle of the input, _Vp, Capacitor C1 is fully charged with diode D1. Then in positive cycle this capacitor charged up to 2Vp. Then capacitor C5 charged with diode D2 up to 2*Vmax and in next stage whole cycle repeated it self.



  • Design of 100 kV CW with 10 kV source and 10 mA load current

    Now to multiply voltage by factor of 10 we have to cascade this fundamental circuit into 5 stages this way we will get 100kV with 2*5*10kV.
    So number of stages =5
    Second important thing here is capacitor values and rating. Voltage drop formula for this circuit is as follows
    Now this formula describes that for a n stage cascaded CW multiplier, with frequency f and load current of I with C capacitance will have voltage drop of Delta V across output. From here we can find value of capacitance for our circuit by assuming a fair value of voltage tolerance. This C also effects time constant and ripples in this multiplier. So we are supposing a 
    del V=1V
    f=50Hz
    I=10mA
    So capacitance value for this case would be 20mF capacitor. 
    Now we need to calculate ripple in this circuit. Formula for ripple calculation would be

    So in our case ripple voltage would be .15% of total voltage.
    Rating of the capacitors and diodes are one important parameter. As all the capacitors are stressed with 2Vmax of their stage so Capcitor and diode rating should be greater that 2Vmax of that stage which means second stage will have rating of 20kV, third will have 40 kV and it goes this way.

    Proteus Simulation:

    So following is a five stage voltage multiplier circuit. 
    All the stages are labelled. Highest stage is labeled as V1 and V1'. Working of this circuit is resembled to fundamental block with a difference that when charged V5' is charged up-to 2*V max in next cycle it charges c2 and so on and so for. Vn' are points where voltage will oscillate while on Vn voltage will be constant eventually. 
    Following are different graphs for as described. 

    Output Voltage vs Source Voltage :

    Output Voltage vs Input Voltage: Output V eventually constant

    Load Current:

    Load Current curve initially have some ripples which eventually becomes zeros at the end

    Voltages at V n' points:

    Voltages are very oscillating but are double in each stage.

    Voltages at V n points:

    Voltages at Vn points. They have less ripples at quite stable. Also they are double on each stage

    With High load

    As circuit is designed for smaller currents (load), so for higher loads voltage drop will increase tremendously. One such example is given following with a load of 100ohm inspite of 10M

    Download Simulation:

    Password of rar file is UETianBLogger

      My interview at Mentor Graphics

      Mentor Graphics  is a US based multinational company that deals with electronic design and electrical and hardware based software  related services. I was recently called for interview in its Lahore office after being short listed. It was a technical interview and for job related to Embedded system so most of the questions were about either embedded systems or C language and hardware.hh
      Their email described following things


      You will be assessed as per following criteria:
      1.  Good programming experience in C and or/Java
      2. Good understanding of hardware Architecture (x86, ARM or MIPS) and Operating Systems Concepts 
      3. Hands-on experience with either of following embedded development environment would be a plus – Keil, RealView MDK, IAR Embedded Workbench, Code Composer Studio, Sourcery Codebench

      Following are some questions and answers asked form me by interviewer.



      1. What is Cache memory?
        It is a faster type of memory used in computers while CPU is processing. So contents of memory is first fetched in this memory so that future requests can be served faster.
      2. What is its difference with other memories? Why don't we use RAM as its faster too.
        Cache is much faster than RAM and its is used to make the process fast. It is much costly than other memories. RAM is primary memory and different from RAM.
      3. What are Registers in Embedded systems?
        Registers are type of memory that is used to hold the contents that are going to use in processor. They may hold instructions, variables and things like that.So if CPU wanted to add two numbers, instructions will be first loaded into registers and then given to CPU.
      4. How many registers are there in ARM Cortex M3?
        It has 12 general purpose registers out of which 6 are called low level and other 6 are called high level. Than 4 Control registers PC, LR, SP and . Then two Special purpose registers like Program status register.
      5. Suppose we have a 32 bit register whose first and second bit are used to on and off UART. So if bit 8 is 1,Tx channel is on and if  10 bit is 1, Rx is on. How will you do it?
        By and ORing that with a number. So to set bit 8, we will and that register as follows.
        UART_Reg |=h0000100; // for 8th bit
        UART_Reg |=h0000400; // for 10th bit
      6. How can you do in same instruction?
         UART_Reg |=h0000500; // for 8th and 10 bit
      7. Suppose we have a 32 bit register showing status of a 32 interrupts of 32 ADC channels. Now Suppose a battery is connected at an xth channel. Write a efficient C program that can detect channel Number and return it.
        1. int ChannelFinder(int INT_Reg)
        2. {
        3.     int ch_No,i,temp;
        4.     temp=INT_Reg;
        5.     for(i=0;i<=31;i++)
        6.         {
        7.           temp>>i;
        8.           if(temp==1)
        9.             {
        10.             ch_No=i;
        11.             break;
        12.             }  
        13.            
        14.         }
        15.         return ch_No;
        16. }

      8. Now suppose that more than on interrupts are occurring . Also in the if condition call another routine that will call ISR with Ch_No. Calling this routine will also clear previous Interrupt.
        1. int ChannelFinder(int INT_Reg)
        2. {
        3.     int ch_No,i,temp;
        4.     temp=INT_Reg;
        5.     for(i=0;i<=31;i++)
        6.         {
        7.           temp>>i;
        8.           temp |=1;
        9.           if(temp==1)
        10.             {
        11.             ch_No=i;
        12.            ISR_funct(ch_No);
        13.             break;
        14.             }  
        15.            
        16.         }
        17.        
        18. }
      9. This program is checking for interrupt even if there is no interrupt, change it in such a way that it only checks when there is  some interrupt?
      1. int ChannelFinder(int INT_Reg)
      2. {
      3.     int ch_No,i,temp;
      4.     temp=INT_Reg;
      5. if(INT_Reg>=1)
      6. {
      7.     for(i=0;i<=31;i++)
      8.         {
      9.           temp>>i;
      10.           temp |=1;
      11.           if(temp==1)
      12.             {
      13.             ch_No=i;
      14.            ISR_funct(ch_No);
      15.             break;
      16.             }  
      17.            
      18.         }
      19. }
      20. else
      21. break;
      22.        
      23. }
       
        10. See following program

               const int x=9;
              What will happen if i tried to change value of x?
               It will give and error.

         11. Now see this
                  int *p;
               p=&x;
              *p=10;
             What will happen in this case?
            Again same error.

         12. What will be output of following?
            
      1.       int *p;
      2.       sizeof(p);
      3.       double *p1;
      4.       sizeof(p1);
            Both pointer will have size of 4 bytes as size of addresses in 32      bit machine is 4 bytes.

        13. If both have same sizes, why can't we use int type pointer for        double type?
           'cause a double type pointer is pointing a double and int type is        pointing int. [Not sure]

        14. How you configured timer in your project?
             In data sheet of the controller, sequence to set bits of relevant          register were given. There were  some parameters like                      overflow  value etc were to be set to start that timer. 
             That registers   were set and it was configured.

        15. How you used timer?
            Timer was used to produce delays and also to sample data at             regular intervals. So We used Sys Tick timer which is 24                   bit timer. We used 80Mhz clock. It was count up timer. Each bit       was count  up after the delay of (1/80M)s so routine was                   made to produce of specific intervals.

       16. What if you can't set value of a timer and you have to produce          some specific interval?
             Then we can set it Reload value. So every time overflow                  occurs,      it will reload with a value relevant     to our delay.

      17. Following is a c Code
           
      1. struct A{
      2.      int var1;
      3.      int *p1;
      4.      int *p2
      5.      };
           How can i declare array of struct A type?
           struct A a1[4]; [He was suspicious about this, he said it will be       then struct of struct, I think he was confused with Cpp]

       18. Now what will happen if i do following a1++?
             [I was confused here, We had argument. He tried to convince           me something may be he was  trying to trap me.                               Unfortunately, I got into trap and I think answered wrong ]
            It will be a compiler error.

       19. What is pipeline in MCU's?
            It is a concept that while one instruction is being loaded, other         will also be loaded to save time.  He asked another                           question but  I said that I dont know deep about this so...

        20. What is const int *p and int int const *p who will be constant           in these?
            It is a famous question in interviews of C. It can be found here.
            http://stackoverflow.com/questions/1143262/what-is-the-                 difference-between-const-int-const-int-    const-and-int-const

      21. By what steps program is compiled? [He asked it differently but       I don't remember exact words]
          http://stackoverflow.com/questions/3996651/what-is-compiler-linker-loader

      21. What is difference between big endian and little endian?
             Both are ways of storing memory. In little endian, LSB is                  stored in smaller address place and MSB is placed in higher              address places. Vice versa is true in other.

      22. Suppose we have a system, a black box, we don't know                     anything about it. How can you know weather its big endian or       little endian?
           We can write a simple program as following
                  char var=1;
           int c;
           c=(int) var;
           As we know int is a 4 byte and char is one byte. Now when type     casted, c will have 4 bytes. So if it will be equal to 1 it means      little endian other wise big endian.

      23.What is interrupt and what happens when it occurs?
         An interrupt is blockage in flow of main program. I told him               whole process of interrupts what  I          have read in ARM       with all the details.

      24. So how NVIC know ISR address.
         I told him that it IPSR register where interrupt number is loaded      form NVIC. All the ISR's are            stored in a memory address       from 0 to top. So after this PC loads that specific  interrupt. But        he was    not convinced.

      25. Following is a program
        
      1.  if( Unknown Condition )
      2.       {
      3.      printf("Hellow");
      4.               }
      5.   else
      6.    printf("World");
       how to print Hellow world? What should we write in If condition.

      We can write  ~(printf("Hellow")). As return type of printf is number of bytes being printed. So what if condition will be false but print function will print Hellow and then it will go to else and will print World.

      1.  if( ~(printf("Hellow")) )
      2.       {
      3.      printf("Hellow");
      4.               }
      5.   else
      6.    printf("World");

      26. Suppose data of an automotive is stored in location like following
       Now suppose at location 0-3 car reg number is stored, on 4-9 something else is saved and so on and so far. Write a C program that takes starting bit, and size and extracts all of them and returns.


      1. int Extractor(int start, int size)
      2. {
      3.     int i,cutter=0;
      4.     int *adres;
      5.     adress=start/32;
      6.    
      7.     for (i=start;i<=size;i=2*i)
      8.     {
      9.         cutter=cutter+i;
      10.     }
      11.    
      12.     return ((*p)&cutter);
      13. }

      [I was a bit wrong in this. I told him right algorithm but I was failed to produce right c code for cutter]


      27. Suppose a MCU has only 12 registers while a C program is using 20 variables in it. All of them at once. How registers will manage it?

      Register are only there to speed up the process of CPU by providing immediate data. In fact these variables are stored in memory. One other way is pushing and then poping when required in stack. 

      It was very interesting interview. I imagined it as two nerds discussing most nerdy things. We argued a lot of time during interview. Overall it was best experience.