Wednesday, 12 August 2015

Effect of Modi's foregien visits

Prime minister Mr. Narendra Modi has visited many countries since he took oath almost a year ago. Many of us criticizing him for his so many foregien trips including opponent parties. But believe me friends his foregien trips are quite beneficial for the country. Opponents are just misleading by saying his foregien trips are worthless. I will give you some statics given by a leading newspaper and you will be amazed.
Read carefully-

India received $19.78 billion foreign direct
investment (FDI) from 12 countries visited by Prime Minister
Narendra Modi in financial year 2014-15, Parliament was
informed today.
During the period, Indian companies invested $3.42 billion in
these countries which include Bhutan, Brazil, Nepal, Japan,
the US, Myanmar, Australia, Fiji, Seychelles, Mauritius, Sri
Lanka and Singapore.
The total outflow and inflow of foreign investment in general
for 2014-15 fiscal was $6.42 billion and $75.71 billion,
respectively, Commerce and Industry Minister Nirmala
Sitharaman said in a written reply to Rajya Sabha.
In 2014-15, FDI in India increased by 27 per cent to $30.93

So you can analyze now that his foreign trips are worthwhile and can boost our economy fastly.

Tuesday, 11 August 2015

Know Google's new CEO- An Indian

As Google's third CEO, Pichai is taking over a
company in flux. In a massive corporate
restructuring, Google has become a subsidiary of
Alphabet, a new company run by Google co-
founders Larry Page and Sergey Brin.
Pichai, 43, was born in Tamil Nadu, India. After
graduating college in India for metallurgical
engineering, he came to the United States to study
at Stanford University -- the alma mater of the
Google founders and so many other early Googlers.
Pichai got his start at Google in 2004, building the
now defunct Google toolbar. The toolbar allowed
Internet Explorer and Firefox customers to make
Google their default search engine .
In the next few years, he took over Chrome,
Google's Web browser. When he introduced Chrome
to the world in 2008, the world reacted with
puzzlement: How could it compete with Internet
Explorer and Firefox?
Yet Chrome eventually became the world's most
used Web browser. Chrome even became a
successful operating system for Chromebook
laptops, used mostly by schools.
Pichai eventually became vice president, then senior
vice president in 2013 when he added Android to his
growing portfolio.
Last year, he became Google's product chief,
overseeing virtually all Google software products
not named YouTube. He runs Google+, Google
Wallet, Android Pay and Google's Apps services for

Pichai also runs the Google I/O developers
conference, where he serves as the public face of
Google for eager customers waiting to know what
the next versions of Android and Chrome will do. He
also shows off the company's biggest new products
and services, including kicking off this year's
massive Google Photos announcement.
Subdued and generally quiet, Pichai is admired at
Google not just for his obvious engineering talents
but also his general likability.
"Sundar has been saying the things I would have
said (and sometimes better!) for quite some time
now, and I've been tremendously enjoying our work
together," said Page in a blog post announcing the
As CEO of Google, he gets one more feather in his
cap and adds a few more products to his now giant
kingdom -- search, ads, maps, apps, Android,
Chrome and YouTube will now all be under his

Saturday, 1 August 2015

swami vivekananda thoughts

Swami Vivakanada's top 10 quotations that inspires you the most

1)Take up one idea. Make that one idea
your life - think of it, dream of it, live on
that idea. Let the brain, muscles, nerves,
every part of your body, be full of that
idea, and just leave every other idea
alone. This is the way to success.
2)We are what our thoughts have made us;
so take care about what you think.
Words are secondary. Thoughts live; they
travel far.
3)You have to grow from the inside out.
None can teach you, none can make you
spiritual. There is no other teacher but
your own soul.
4)The moment I have realized God sitting
in the temple of every human body, the
moment I stand in reverence before
every human being and see God in him -
that moment I am free from bondage,
everything that binds vanishes, and I am

5)Arise! Awake! and stop not until the goal
is reached.
6)You cannot believe in God until you
believe in yourself.
7)Our duty is to encourage every one in his
struggle to live up to his own highest
idea, and strive at the same time to make
the ideal as near as possible to the
8)The more we come out and do good to
others, the more our hearts will be
purified, and God will be in them.
9)The whole secret of existence is to have
no fear. Never fear what will become of
you, depend on no one. Only the moment
you reject all help are you freed.
10)Condemn none: if you can stretch out a
helping hand, do so. If you cannot, fold
your hands, bless your brothers, and let
them go their own way.

Saturday, 11 July 2015

what is good education

when we heard the word education, a picture series runs on our mind in which we see schools, teachers, students or if if we are already done with our schooling then we thought of our school days. These whole things which I have described was part of our education. Education in all sections of this world defines by all these parameters schools+ teachers+ students.

 Apart from these many other things may be there but these three things most important and must be their to get education. Some of you may think why I have described schools as essential part of education as to get education students means you and teachers means anyone who teaches you is sufficient. I have described schools as important part of proper education because we must have a class room so our infant from his/her very beginning in schools can learn how to interact with others means he learns how to be social in schools, but without schools knowledge he can gain but not education as being social is part of good education.

 So now you can imagine that a good education just not to get knowledge of particular subject but good education teaches us to be practical, be social, be friendly to everyone and so on. Only this good education can make you excel in your life, getting only knowledge is not sufficient to live in this world.

Its not the responsibility of only schools or government to make you infant social its parents who teaches him or her to be practical to be social to be gentle to everyone. If someone is good in his academics but not gentle not social he will find hard to live on this earth because we human beings are somehow social animals.

So when you think good education think other parameter also apart from knowledge is to make your child social, gentle and practical.

Pankaj Pathak

Friday, 10 July 2015

Reservation in Education

Reservation in our education system , is considered to be a backbone to certain communities. These communities are Schedule Casts, Schedule tribe and OBC ( creamy and Non creamy). So why government is given these communities such special reservation in education as compared to general person.

it all start with untouchablity, means in past schedule casts were treated to be untouchable. They didn't have rights in society same as upper caste peoples. They worked for upper caste people, in overall they were badly treated at that time. Due to which trend started that a person who is of lower caste can't eat, live or even get education with upper caste people. As time passed they lower caste people were so harreshed that they were mentally and socially get neglected.
After Independence, because we live in Democratic country where everyone has right to live equally, it was realized that these lower castes peoples whose percentage was very less in all sectors as compared to upper caste peoples should be increased, so only we can talk about equality. The overall thought according to me was right because as a human being if you think whatever lower caste people faced during post independence was inhuman act. In starting Parliament implemented this for 10 years but after every 10 years it was increased and even now we have reservation in education system.
according to my view what I observed regarding reservation is that at starting the reservation rule was absolutely right because at that time lower caste people percentage in all sectors were so less. Still lots of areas are such where untouchability exists for which I totally support reservation. But what I observed regarding reservation system is that a person who needs it more is not getting this. Let me give you an simple example, a person from lower caste who don't have anything in his childhood achieved great success in his life with getting reservation in every field. According to me it is right if he gets reservation. But now think that his son or daughter giving any exam getting reservation is right or wrong. It is wrong because his son or daughter have everything now just because they are from lower caste they are getting reservation is wrong. Now a days what I observed is that maximum number of peoples whom are getting reservation don't require it. But some of areas in India have peoples , must have reservation which I support.
one thing I want to add here is that now reservation should not be given in name of caste. Because according to me lots of people just to get reservation in India make their false certificates though they have enough money but getting all facilities just because they are lower caste in papers. This I observed in my college time.

Another thing which I want to add in not to give reservation in name of caste is that, think of a poor student. His father don't have enough money so he can get proper education. Just because he is from general category he can't get any such reservation. It seems totally wrong. Though the concept of reservation was right but now I think amendments should be done. Reservation earlier during just after independence can be understood based on caste, but now after 6 decades still giving reservation just in name of caste didn't seem proper, reservation I totally support but it should be given due to financial conditions of one. Poor must get reservation because poor is poor we can't decide him in terms of his caste as upper caste poor or lower caste poor or Hindu poor or Muslim poor.
give your views also.

Pankaj Pathak

Thursday, 9 July 2015

Education system in India

India is a country of around 1.25 billion peoples of which 65% population is young, means india is young nation. To progress we must focus on youths because they will decide future of the nation. Education is primary and most important criterion for better india as if everyone in younger generation will get proper education than only India will prospected.

In this direction from very first election till now government of India has done some great work. Presently around 990 billion rupee budjet is alloted for this. HRD ministry is responsible for higher education system as of primary education state government along with center is responsible.
At present 75% ( round figure) of population in India is educated. Let us now analyze thing rather than going to facts. I will took point by point analysis  but all regarding Government schools and colleges.

1) the very first thing to boost primary education government of India has already started Mid Day Meal scheme, so our children will get better health also.

2) books, dresses etc are free up to 8th standard.

3) the fee in government schools are so less and we compare this with private schools it is about 1/50 or more also. So government is taking less but giving more.

4) still we people don't choose government schools for our child. We are ready to pay 50 times fee even teacher who is teaching in private schools not even qualified any of the exam whereas all government teachers are well qualified.

 5) even what I observed that a government teacher prefer private schools for his infant. It simply shows that they don't have believe in their own system.

6) in reality government schools have very less number of students present there in most of the places.

7) let us now think of higher education. For graduation many options are present in India like engineering, doctor, law, science etc.

8) but what I observed is that Indian education system works only for a good degree.

9) when I say that "works only for good degree" it means we do graduation to get only degree not some knowledge or for skill development in us.

10) for this government is not responsible because they already have provide us all facilities but it is us that we want degree only not proper knowledge.

 11) like for example South Korea and India started building their education system in same year. We focused on Degree based preparation and they focused on skill development. you can analyze where they have reached in technology.

 I am not criticizing totally the education pattern but somehow to become world power we can't work with such education system. We must change it. When I say we it means Government+ we people of this great country.

Pankaj Pathak

Wednesday, 8 July 2015


When we heard this " inner peace", some positiveness comes automatically. In this busy and hectic life most of us are not happy; but we all wanted to be happy. So the question arises in our mind automatically; how to be happy. Is there any tool or machinary or government sceheme. The answer is NO. But let me tell you a screat, there is always a person who can make you happy and that special person ( or say great person) is YOU
you are the one who is key to make yourself happy. We all know happiness is the key of peaceful life and vice versa peaceful life leads to happy life.
when I say peace it means inner peace.

I met lots of people, they are earning enough money, they wanted something in past which they have acheived already but they are not happy with their life, still searching for inner peace.
during my undergraduate program I met a gentleman Aveshy Witkow, he was from Is real. He told me that he came India to get inner peace because He is not happy with his life. While returning I asked about what he got and he said he still not happy.
The question arises why he was not?

I think the answer is inner peace to get happy life cannot be achieved by travelling far. The place you have to visit, is your own hearth. Ask yourself what you want? If you do what your hearth says then you must be happy because now you are listening to yourself not others.

Pankaj Pathak

Tuesday, 7 July 2015

Effect of technology on education

In the words of "Nelson Mandela"- " education is the most powerful weapon which you can use

to change the world".

thinking of this deeply, when we thought changing the world by education, what does it mean?

Simply it means, education teach people to think critically, positively. So the world can change.

technology from some past decades is also changing; so is it right to say technology is changing

the world? Yes of course. Technology has changed the way we live, travel, and affect all of us

somehow. If this technology is changing the world and change in world can be done by

education we can think of that technology has changed the education.

 But as it said every coin has 2 sides, effect of technology on education also have 2 sides.

thinking of negative side, think of calculators. Though it makes calculation easy and fast, but

making our capability of thinking is decreasing. Games are also considered to be part of good

education, but when we say games it does it mean graphical games. No, it means physical

activities so we can be fit to be learn everything. Video games are attracting new generation

though they are colorful, interesting but they make us physically imperfect.

as it said noting has only bad in it. Technology has changed our education system a lot. Distance

learning, e- education, smart classes, computers are those examples where we see positive

impact of technology on education. And there is many more latest technologies in education

system now a days. Technology has made our education very fast and advanced, so thanks to


Pankaj Pathak

Monday, 6 July 2015

[How to] Block Facebook Game Requests

Not everyone likes getting constant game requests from friends. This is a simple most effective way to completely block Facebook game requests.
This tutorial is to be followed using and android or iPhone.
1. Open the Facebook app and tap on More on the bottom right, then scroll down and tap on Account Settings.
2. Scroll down and tap on Apps.
3. Now tap on Platform.
4. Finally under “Game invites and App Notifications” select NO or OFF. From now on you will never get any game invites.

Saturday, 4 July 2015

Line Follower Robot using Arduino

This line follower robot is basically designed to follow a black line on a white surface. Any way the same project can be used to follow the opposite configuration with appropriate changes in the software. The entire hardware of this simple line follower robot using arduino can be divided into three parts. The sensor, arduino board and the motor driver circuit. Lets have a look at the sensor first.


The sensor consists of two LED/LDR pairs with appropriate current limiting resistors. The resistance of an LDR is inversely proportional to the intensity of the light falling on it.  The circuit diagram of the sensor is shown in the figure below.
arduino line followerResistors R1 and R2 limits the current through the LEDs. Resistors R6, R8, R3,and R5 forms individual voltage divider networks in conjunction with the corresponding LDRs. When the sensor is correctly aligned, both LED/LDR pairs will over the white surface. In this condition sufficient amount of light gets reflected back to the LDRs and so their resistance will be low. So the voltage dropped across the LDR will be low. When the robot is drifted to  one side , the sensor in the opposite side falls over the black line and the intensity of light reflected back to the corresponding LDR  will be low. As a result the resistance of the LDR shoots up and the voltage dropped across it will be high. The voltages dropped across the right and left LDRs (nodes marked R and L in the above circuit)  are given as input to the analog input pins A4 and A3 of the Arduino board. Right and left sensor outputs observed while testing the above circuit is shown in the table below.
line follower robot using arduino

Arduino uno board.

The arduino board has to be programmed to keep the robot in correct path. This is done by reading the left and right sensor outputs and switching the left and right motors appropriately. Output of the right sensor is connected to the analog input A4 of the arduino and output of the left sensor is connected to the analog input A3 of the arduino. The voltage range that can be applied to a particular analog input of the arduino is 0 to 5V. This range can be converted into a digital value between 0 and 1023 using  analogRead () command.  For example if 3V is applied to A3,  the following code will return 3/(5/1023) which is equal to 613 in the variable leftValue.
int leftInput = A3;
int leftValue=0;
void loop ()
leftValue = analogRead (leftInput);
From the above table you can see that the voltage across a particular LDR will be 4.4V when it on white and 4.84V when it is on black. The digital equivalent of 4.4V will be 900 and that of 4.84V will be 990 as per the above scheme.  The median of these two values is 945 and it is set as the reference point for the program to check the orientation of the sensor module.
The program identifies the position of the sensor module by comparing the sensor readings with the reference point that is 945. If the reading of a particular sensor is greater than 945 the program can assume that the particular sensor is above black. If the reading of a particular sensor is less than 945 then it is assumed that the particular sensor is above white. If both sensor readings are less than 945 then it means both sensors are on white. If both sensor readings are above 945 it is assumed that both sensors are above black (the same thing happens if we lift the robot off the track). Based on the above four conditions, the program appropriately switches the left and right motors to keep the robot following the black line.

Motor driver.

The motor driver circuit is based on two NPN transistors Q1 and Q2. Each transistors are wired as a switch with a resistor at its base for limiting the base current. The motors are connected to the emitter terminal of the corresponding transistors. A 0.1uF capacitor is connected across each motor  for by-passing the voltage spikes. Back emf  and arcing of brushes are the main reason behind the voltage spikes. If these voltage spikes are not by-passed it may affect the Arduino side.   Circuit diagram of the motor driver is shown in the figure below.
arduino line follower motor driver

Circuit diagram.

Full circuit diagram of the line follower robot  is shown in the figure below.


int leftInput=A3;
int rightInput=A4;
int leftMotor=13;
int rightMotor=12;
int leftValue = 0;
int rightValue = 0;
void setup()
  pinMode (leftMotor, OUTPUT);
  pinMode (rightMotor, OUTPUT);
void loop()
  leftValue = analogRead (leftInput);
  rightValue= analogRead (rightInput);

   ( leftValue < 945 && rightValue < 945)
     digitalWrite (leftMotor, HIGH);
     digitalWrite (rightMotor, HIGH);

     ( leftValue > 945 && rightValue < 945)
      digitalWrite (leftMotor, LOW);
      digitalWrite (rightMotor, HIGH);
 else {
   if (leftValue < 945 && rightValue > 945)
   digitalWrite (rightMotor, LOW);
   digitalWrite (leftMotor, HIGH);
     if (leftValue > 945 && rightValue > 945)
     {digitalWrite (rightMotor, LOW);
       digitalWrite (leftMotor, LOW);

Setting up the circuit.

  • First of all remember that each LED and LDR has its own characteristics.
  • Carefully measure the voltage across each LDRs in both scenarios (on white surface and black).
  • A lot of parameters like individual LDR/LED characteristics, ambient light, clearance between sensor and surface etc may affect the result.
  • Get in to your own reference point for the program. In my case it was 945 but you may get a different value.
  • Use a separate power supply unit for powering the motors. Anything above 100mA will be hard for the USB port.
  • The motors used here are 9V/30RPM DC bow motors. If such a configuration is not available, choose the closest one.
  • While soldering up the sensor module, the gap between the two LED/LDR pairs must be selected according to the width of the black line. In my case it was 2cm.
  • Clearance of the sensor from the ground was around 1cm in my case.
  • The sensor LEDs used were 4mm bright green LEDs.
  • The sensor LDRs used were general purpose LDRs.

Simple LED Projects using Arduino

This article is another step forward in learning more about Arduino. We have demonstrated 5 simple led based projects using arduino, which will help you to learn its basic concepts.
1. Blinking Two LED’s using Arduino
As a beginner, if you have tried the “Hello World” program to blink an LED using Arduino; you can try to blink Two LED’s as next project. There are 14 I/O (input/output) pins in your Arduino uno board. These pins are numbered from 0 to 13. They can be configured as either input or output in the sketch you create for arduino. If you have learned the “Hello World” program carefully, you now know that input/output configuration of pins has to be done inside the setup() function. So here is the circuit diagram to blink 2 led’s using arduino.

Sketch to Blink Two LED’s using Arduino
const int LED1 = 12;
const int LED2 = 13;

void setup()

void loop()

The only difference in this sketch is use of 2 pins in output mode. I have used pin number 12 and 13as output. I have configured them as output inside the setup() function. Inside the loop(), I have written commands to blink LED’s alternatively. When LED1 is ON, LED2 will be OFF. After 1 second LED1 will turn OFF and at the same time LED2 will turn ON. Wait another 1 second and you will see LED2 turning OFF and LED1 turning ON. This cycle repeats.
I have added a photograph of the practical setup I made below.
You can watch video of the same circuit below.
2.Control LED with Push Button
If you observe carefully, so far we were just playing with some outputs. We made one LED blink and then we stepped ahead to make two LED’s blink. In both cases we wrote software commands to make our arduino blink led’s automatically at an interval of 1 second. What if we want to control led’s ON and OFF time based on a user input?  This means, I want to give an input manually and based on my input LED should turn ON and OFF. We can use a push button switch to give user input to arduino. In fact, we can use any type of a simple switch like Push to On or Push to Off or a mini push button switch. In this example I am using a “normally open” mini push button switch. A normally open push button switch will be in its open state by default. This switch will close for the time we keep its actuator pressed. If you want to know more about working of different push button switches, you can read our detailed article on push button switches.

I have added the circuit diagram to control LED with arduino using a push button switch.  To connect push button to arduino, we need one of the digital I/O pins configured as a digital input. In this example, I have set pin number 7 as a digital input. So we should connect the push button switch to pin 7 of arduino as shown in circuit. A reference voltage should be connected to one end of switch and the other end of switch should be connected to ground. To avoid a short circuit between pin number 7 and ground, you should connect a resistor (preferable a 10K ohm) in between. The reference voltage is used to detect ON state or closed state of the push button. Arduino board has a readily available +5 voltsreference on power pins cluster. When the push button is pressed, the reference voltage line will get connected to pin number 7.  This voltage will drop across the 10K ohmresistor. So when push button is pressed, a +5 volts is available at pin 7 and this will be considered as state HIGH. On the other hand, when the push button is released (residing in its normally open state), there is no reference voltage line connected at pin 7. On this state, the voltage across 10K resistor is 0 volts (ground potential). This same potential is at pin 7 as well and will be considered as state LOW. This is how ardunio distinguishes between closed (ON) and open (OFF) states of push button switch.
Lets get into the program side of controlling LED using push button switch. In this program, the highlight is instruction to read push button state. APL (Arduino programming language) has an instruction named digitalRead() – which reads a digital input given at the configured input pin. In our program, this instruction reads the status at pin 7 and returns a value according to what it has read. In our example this instruction reads voltage level at pin number 7; returns HIGH if its +5 volts and returns LOW if its 0 volts. Since it returns a value, we have to assign this instruction to a variable while we write the program. We have used the variable val to store the value returned by the instruction digitalRead(). The push button switch is connected to pin 7 and we have assigned this pin 7 to a variable named SW inside our sketch. Inside the setup()function, we have configured this pin 7 (the SW variable) as input using pinMode() instruction. So here is the program.
const int LED = 13;
const int SW = 7;

 int val=0;

void setup()
  pinMode(SW, INPUT);

 void loop()

3.Toggle LED using Push button
Lets get into next project which is even more interesting. Here we are going to toggle an LED using a push button switch. Toggle means to change state. Our objective here is turn LED ON with first push button press and turn LED OFF with next push button press. This cycle of ON and OFF should continue with each push button press.  The same circuit diagram given above is enough to do this project as we are not manipulating any hardware connection. We just need to change our software (sketch) to change the behavior of this circuit.
Here is the sketch to toggle an LED using push button switch.
const int LED=13;
const int SW=7;
boolean state = true; //declare variable state as boolean
int val=0;

void setup()
void loop()
  delay(120); // Software debouncing using 120ms delay


{state=!state; // Compliment variable state using ! operator

I used a “normally open” mini push button switch to implement the circuit. This means a push button press always gives us a “HIGH” state. In other words, we have to sense the closed state of push button switch to turn LED ON and OFF. Turning LED ON and turning LED OFF  both depends on a single event – the press on actuator of push button switch (its closed state – when the voltage at switch = HIGH). We can do this program in many ways. An efficient program always will have less lines of code. In this program, I used boolean instructions and a complement operator. In the program a variable namedstate is declared as boolean and I initialized it as true.  A boolean instruction has only two possible values, either true orfalse. The next highlight of the program is to use of complement operator ( ! ). This is the same negation operator we see in 8051 and other micro controllers. For example, we have an instruction called CPL in 8051 instruction set. This instruction compliments the values in accumulator (0’s with 1 and 1’s with 0’s). In digital electronics, a NOT gate performs the same task.
So here is the working of program. We initialized variable state as true.  Other lines of code are the same we used in previous programs. You already know what is written inside setup(). Lets come toloop(). We sense input of switch withdigitalRead(SW) and store it in an integer variable val. Now we check for the push button press by continuously checking if the variable val has ever registered aHIGH. If it ever registers a high, we compliment the status of state variable and save it to the same variable. Now if the state variable was TRUE before, it has been complimented to FALSE. We write the status of state variable to LED. Based on the value of state variable LED will turn ON and OFF. LED will turn ON if state variable holds a TRUE and LED will turn OFF if state variable holds a FALSE. This process of reading the push button switch and complimenting the state variable continuous.
Note:- In our program, the first push button press actually turns the LED OFF. It will turn ON only with second push button press. From then it will alternate between ON and OFF with each push button press. If you want it to turn ON with first push button press, you just need to make a change in the boolean declaration statement. Declare the variable as FALSE initially.
Note2:- You might have noted a delay(120); instruction just below the val=digitalRead(SW);instruction. It is calledsoftware debouncing technique. This a practical aspect of the circuit. If you are to write the program based on theory, you don’t need a delay instruction here. But there is a practical problem. You may upload the code with out this delay instruction and see the behavior of circuit. Some push button press will actually toggle and some other will not yield an expected result. This behavior is due to 2 reasons. 1) The push button is a mechanical switch. One push button press will yield a series of high pulses (bcz of the vibration created when 2 mechanical parts get in contact) in practice. 2) Arduino is a really fast prototyping platform. In fact its not arduino, its the micro controller used in the board that’s really fast. In an arduino uno, Atmega328 is used which is of 20 MIPS execution capability. This means the controller can execute 20 million instructions per second. It is very very fast than we can imagine. So arduino will sense all these series of high pulses created by one push button press. But we dont need arduino to sense all these pulses. We just need 1 HIGH pulse per push button press. This is a problem created by the bouncing switch and we eliminate this problem through a debouncing technique. There are 2 types of debouncing techniques. Here we apply software debouncing. You may read more about debouncing techniques in our article.

4. Toggle 2 LED using Pushbutton

Our next project is to toggle 2 LED’s using a single push button switch. Here we need one more LED and little tweak in the software. I have added the circuit diagram and program below.  I respect your intelligence. You don’t need an explanation for this circuit and program after learning this much.

I have added the sketch below. Read the sketch carefully. We just need to add a few lines to above program. Its really that simple.
const int LED1=13;
const int LED2=12;
const int SW=7;
boolean state = true; // declare variable state as boolean
int val=0;

void setup()
void loop()
  delay(100); // Software debouncing


{state=!state; // Complimenting the status of LED
I have added a video of the practically implemented circuit. You can watch it below.
Note 3:- I already wrote that there are different ways to create a program. This same program for toggling LED can be written without using a boolean variable. If we dont use a boolean variable, we can not make use of the compliment operator. This simply means we have to handle the task of switching LED states inside our code. I have added a sketch to toggle an LED without using boolean variable. If you take a closer look, you can see this program is very big and uses more variables and instructions than our previous program (with boolean variable). But both sketches leads the same desired output. So which program is more efficient ? The one with less lines of code!
const int LED1 = 13; 
const int LED2 = 12;
const int SW = 7;
 int flag;
 int val=0;
 int state=1;

void setup() 
  pinMode(SW, INPUT); 

 void loop() 

Fan Speed Controlled by Temperature and Arduino

I made this project because I wanted a way to automatically control the speed of a DC fan according to the temperature read by a LM35 sensor. I had a few problems with the PWM part mainly because the fan made a disturbing noise so I had to add a simple RC filter at the output of the PWM pin on the Arduino board.

Arduino Sketch
  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd(7,6,5,4,3,2);
  3. int tempPin = A1; // the output pin of LM35
  4. int fan = 11; // the pin where fan is
  5. int led = 8; // led pin
  6. int temp;
  7. int tempMin = 30; // the temperature to start the fan
  8. int tempMax = 70; // the maximum temperature when fan is at 100%
  9. int fanSpeed;
  10. int fanLCD;
  12. void setup() {
  13. pinMode(fan, OUTPUT);
  14. pinMode(led, OUTPUT);
  15. pinMode(tempPin, INPUT);
  16. lcd.begin(16,2);
  17. }
  19. void loop() {
  20. temp = readTemp(); // get the temperature
  21. if(temp < tempMin) { // if temp is lower than minimum temp
  22. fanSpeed = 0; // fan is not spinning
  23. digitalWrite(fan, LOW);
  24. }
  25. if((temp >= tempMin) && (temp <= tempMax)) { // if temperature is higher than minimum temp
  26. fanSpeed = map(temp, tempMin, tempMax, 32, 255); // the actual speed of fan
  27. fanLCD = map(temp, tempMin, tempMax, 0, 100); // speed of fan to display on LCD
  28. analogWrite(fan, fanSpeed); // spin the fan at the fanSpeed speed
  29. }
  30. if(temp > tempMax) { // if temp is higher than tempMax
  31. digitalWrite(led, HIGH); // turn on led
  32. } else { // else turn of led
  33. digitalWrite(led, LOW);
  34. }
  35. lcd.print(“TEMP: “);
  36. lcd.print(temp); // display the temperature
  37. lcd.print(“C “);
  38. lcd.setCursor(0,1); // move cursor to next line
  39. lcd.print(“FANS: “);
  40. lcd.print(fanLCD); // display the fan speed
  41. lcd.print(“%”);
  42. delay(200);
  43. lcd.clear();
  44. }
  46. int readTemp() { // get the temperature and convert it to celsius
  47. temp = analogRead(tempPin);
  48. return temp * 0.48828125;
  49. }
test setup
I used an LCD shield to display the current temperature and speed of the fan, but you can use the circuit without the LCD display. You also need to select the transistor by the type of fan that you use. In my case I used the well-known BD139 transistor and a 9V battery to provide power to the fan and transistor. The LM35 temperature sensor and red led are powered with 5V from the Arduino board.
How does the circuit works?
As you can see in the sketch on the first line I included the LiquidCrystal library (header) that includes useful functions to use when an LCD is connected to the Arduino board. Then I set the pins for the sensor, led and fan.
The most important part is to set the variables tempMin and tempMax with your desired values. tempMin is the temperature at which the fan starts to spin andtempMax is the temperature when the red led lights warning you that the maximum temp was reached. For example if you set tempMin at 30 and tempMax at 35 then the fan will start spinning at 30°C and reach its maximum speed at 35°C.
We store the temperature value in the temp variable and then use some if() functions to check if temp is lower than tempMin and if so let the fan OFF (LOW). The next if() is to check if temperature is higher than the minTemp and lower than the tempMax and if so then use the map() function to re-map the temp value from one value to another. In our case fanSpeed will have a value of 32 at tempMin and 255 at tempMax. These values are used to control the speed of the fan using PWM and the analogWrite().
The fanLCD re-maps the temp to allow the display of fanSpeed in a 0 to 100% range so you can say that the speed of the fan is directly dependent of the LM35′s temperature. When the temperature reaches the value set in tempMax the fan will be at its maximum spinning velocity and the LCD will display FANS: 100% even though the temperature might increase above tempMax.
The rest of the explanation can be read in the comments area of the Arduino sketch.

AVR Microcontroller (Atmega32) – An Introduction

Introduction to ATmega32 (AVR Series) 8bit Microcontroller

In our days, there have been many advancement in the field of Electronics and many cutting edge technologies are being  developed every day, but still 8 bit micro controllers have its own role in the digital electronics market dominated by 16-32 & 64 bit digital devices. Although powerful micro controller with higher processing capabilities exist in the market, 8 bit microcontroller still hold its value because of their easy-to-understand-operation, very much high popularity, ability to simplify a digital circuit, low-cost compared to features offered, addition of many new features in a single IC and interest of manufacturers and consumers.
Today’s micro controllers are much different from what it were in the initial stage, and the number of manufacturers are much more in count than it was a decade or two ago. At present some of the major manufacturers are Microchip (publication: PIC micro controllers), Atmel (publication: AVR microcontrollers), Hitachi, Phillips, Maxim, NXP, Intel etc.  Our interest is upon ATmega32. It belongs to Atmel’s AVR series micro controller family. Let’s see the features.
PIN count: Atmega32 has got 40 pins. Two for Power (pin no.10: +5v, pin no. 11: ground), two for oscillator (pin 12, 13), one for reset (pin 9), three for providing necessary power and reference voltage to its internal ADC, and 32 (4×8) I/O pins.
About I/O pins: ATmega32 is capable of handling analogue inputs. Port A can be used as either DIGITAL I/O Lines or each individual pin can be used as a single input channel to the internal ADC of ATmega32, plus a pair of pins AREF, AVCC & GND (refer to ATmega32 data sheet) together can make an ADC channel.
No pins can perform and serve for two purposes (for an example: Port A pins cannot work as a Digital I/O pin while the Internal ADC is activated) at the same time. It’s the programmers responsibility to resolve the conflict in the circuitry and the program. Programmers are advised to have a look to the priority tables and the internal configuration from the data sheet.
Digital I/O pins: ATmega32 has 32 pins (4portsx8pins) configurable as Digital I/O pins.
Timers: 3 Inbuilt timer/counters, two 8 bit (timer0, timer2) and one 16 bit (timer1).
ADC: It has one successive approximation type ADC in which total 8 single channels are selectable. They can also be used as 7 (for TQFP packages) or 2 (for DIP packages) differential channels. Reference is selectable, either an external reference can be used or the internal 2.56V reference can be brought into action.  Their external reference can be connected to the AREF pin.
Communication Options:  ATmega32 has three data transfer modules embedded in it. They are
  • Two  Wire Interface
  • Serial Peripheral Interface
Atmega32 pin diagram
Analog comparator:  On-chip analog comparator is available. An interrupt is assigned for different comparison result obtained from the inputs.
External Interrupt: 3 external interrupt is accepted. Interrupt sense is configurable.
Memory:  It has 32Kbytes of In-System Self-programmable Flash program memory, 1024 Bytes EEPROM, 2Kbytes Internal SRAM. Write/Erase Cycles: 10,000 Flash / 100,000 EEPROM.
Clock: It can run at a frequency from 1 to 16 MHz. Frequency can be obtained from external Quartz Crystal, Ceramic crystal or an R-C network. Internal calibrated RC oscillator can also be used.
More Features: Up to 16 MIPS throughput at 16MHz. Most of the instruction executes in a single cycle. Two cycle on-chip multiplication. 32 × 8 General Purpose Working Registers
Debug: JTAG boundary scan facilitates on chip debug.
Programming: Atmega32 can be programmed either by In-System Programming via Serial peripheral interface or by Parallel programming. Programming via JTAG interface is also possible. Programmer must ensure that SPI programming and JTAG are not be disabled using  fuse bits; if the programming is supposed to be done using SPI or JTAG.

AVR Studio 4 and 5-Overview for Beginners

if you are reading this you might be interest in our complete tutorial from beginning . if yes Start from : AVR Microcontroller (Atmega32) – An Introduction
For general purpose computers, programs written in one programming language can support different hardware configurations. But things are different for microcontroller.  Each family of micro controllers have its own unique type of hardware architecture, instruction sets, register configuration and memories.
So for each architecture of Micro controller family, there will be at least one compiler available, supporting that particular micro controller family or a couple of other families. Most of them support programming in assembly language while some of them support programs to be written in C language. In rare cases there are compilers that accept Java codes too. But I don’t recommend searching too much for a Java compiler, because most popular Integrated Development Environments (IDEs) don’t support it. AVR studio supports AVR series micro controllers. However the interesting fact is that, even AVR Studio doesn’t support all of the avr series micro controllers. I wrote it is “interesting”  because this IDE has been designed by the manufacturer (Atmel) itself. See release note of each version to know about supported micro controllers or the excluded ones.
So if you are a beginner, I’ll suggest you to begin with AVR studio 4. Later, when you gain experience, start using AVR studio5. They are much different from each other. We will provide a comparative table of their features.

AVR Studio 4

AVR studio 4 provides an integrated development environment(IDE), combined with two other supporting softwares, AVR Toolchain and WinAVR. AVR Toolchain installs the Library for AVR studio. AvrToolchain is a must to run AVR studio. If you install AVR Studio and AVR Toolchain, you’d be able to write program in assembly language. To write a program in C, you need to install WinAVR. If you are thinking to buy a development board from Atmel, it will be an even better decision because AVR Studio supports on board programming. You can write your programs in the AVR studio and you can instantly download & verify it too. Supported programmers are listed below:
  • AVR Dragon
  • AVR One
  • AVR Simulator
  • AVR Simulator 2
  • ICE 200
  • ICE 40
  • ICE 50
  • JTAG ICE mkll
Programming Languages:                           Assembly Language, C
Software requirements:                               AVR Toolchain 3.0.0, WinAVR 20100110
For supported devices, hardware and software requirement details, see release notes @
Helpful Features:   I/O view pane, multiple document editing in tabs, really good reference manual. Hex file generation.
Total Space Consumption:
  •  AVR Studio 4       307 MB
  • AVR Tool Chain   194 MB
  • Win AVR                 138 MB
  •  Total             639 MB (As calculated by Windows uninstaller)

AVR Studio 5

AVR Studio 5 is much better than that of AVR studio 4. The experience is pretty amazing with AVR Studio 5. It has auto suggestion facility, like, if you start to type a function name, it will look in the library and the C file itself for matches and will list them in a drop down list, from which you can select them. This reduces name conflict. Suppose you want to define a macro or variables or want to introduce a new function, this feature helps very much. This feature is really helpful for a new programmer for whom the library is almost unknown. In addition, using new functions and macros has been made much easier. But to do this, you need the help of Visual studio shell. All the library, compiler and linker are provided with the AVR Studio 5 installer. For rest of the information have look at the release notes.
Programming Languages:             Assembly Language, C
Software requirements: Microsoft visual studio Isolated Shell 2010, AVR Jungo USB, Microsoft .NET framework 4 client profile.For supported programmers, supported devices, hardware and software requirement details See release notes @AVR Studio 5 release notes
Helpful Features:    AVR studio 4 features + single compiler for 8 & 32 bit AVR controllers. In AVR Studio v5 there is no need of installing any additional tool chains. Another useful features of AVR studio 5 are, auto suggestion function, ready to use libraries, readily available examples, integrated online help,  integrated C Compiler,  Atmel AVR Software Framework, Standard APIs, Application Builder, Solution Explorer, In-system programming, JTAGICE3, I/O view etc and much more.
Total Space Consumption:    
  • AVR Studio 5                                          535 MB
  • Visual Studio Isolated Shell             533 MB
  •  .NET framework 4 client profile    182MB
  • AVR Jungo USB                                     2 MB
  • Total                                         1.22 GB (As calculated by windows uninstaller)
For Programming Guide and programming help, see my upcoming posts. For Help about installation, post your comments here.

ISP Programmer for ATmega32 Microcontroller

if you are reading this you might be interest from beginning , if yes start here : ATmega32 Microcontroller introduction
So far I’ve discussed about the micro controller basics and the compiler software. I’ve yet not written anything about programming.
ATmega32 series micro controllers support 3 types of programming
  •   Parallel Programming
  •   ISP Programming or serial Programming
  •   Programming via JTAG
Here ISP stands for In System Programmer. To burn a micro controller just the burning Hardware is not enough, it requires software also that would download the program present in a computer or memory device into the micro controller.
Now the software which I am talking about is named PONY PROGRAMMER 2.06. My circuit is adapted from the website of Pony Programmer. It uses PC COM PORT to download the program into the micro controller. It has a signal amplitude of +5 to +12 volt representing binary ‘1’ and -5 to -12 representing ‘0’.
The micro controller, ATmega32 is programmed using the pins meant for SPI communication. To enable programming, the microcontroller must be taken to the RESET state by pulling its reset pin LOW (Logic 0, or say 0 V). In this state, microcontroller is programmable in either mode (Parallel programming or serial programming). Micro controller always accepts 0 V as logic 0and +5 V as logic one.
The signals transmitted from PC is not in a form that could be accepted directly by the micro controller. Those signals from PC should be made suitable for micro controller. In the programmer, Zener diodes provide necessary conditioning for the signals. It is wired in such a way that it converts ±12 volt signal to +5-0 volt signal which is suitable for the micro controller.  A resistance is necessary to limit the current in the nodes of Zener diodes, without the which the Zener diode may burn off. And computer internal circuits may also receive harms.
A high signal (+5V) in the ‘Reset’ pin of micro controller brings it into operational state. A low signal (Ground) drives it into programming mode. Internal pull up resistors are provided at the reset pins and if nothing is connected to this pin, the micro controller tries to execute the program written within it. Designers can provide a resistance capacitance reset circuit, but it’s not always necessary. Whatever, a push button is used in most cases to provide reset facility. Here in the burner circuit an open collector output is provided to the reset pin and it is driven by the programmer through the port. This much is enough.
The necessary data transmission and reception work portion is handled by the pony programmer. Follow the links provided to download pony programmer. The following burner circuit can burn ATmega32 microcontroller. Connect the derived signals to the adjacent pins, attach the cable to com port, power up the device i.e. micro controller, and the micro controller is ready to be programmed.

ISP Programmer Circuit Diagram

Image:  Circuit diagram of the ISP Burner
ISP burner cable
ISP programmer connection arrangement
So that is how the circuit is set up. Now let me tell you that the micro controller runs upon the internal calibrated RC oscillator in the pictures. So that there is no crystal is attached. Yet the micro controller is programmable. Let us see the software settings. First of all, select the port, to which you have attached the device!  And the programming device from the menu “Set Up>Interface Set Up…”. Select “SI Prog I/O”, this one provides fastest programming speed. And about the ports, it should becom port for this programming cable! Now select the port you have the cable attached to.
Now come to the device selection menu. Here ATmega32 belongs to the AVR family. So it is listed under “Devices> AVR micro”. Select ATmega32 as your device. Auto detection will also do.
Now after this two vital things check out If your circuit is working or not. Choose “Command>Read All”
Now if you see that it is reading the micro controller without any error message, your programming cable is working and you can program the micro controller with it.
You can Burn your hex file with it (Compilers provide hex files to program micro controllers). Just open “File> Open Device File…” now an window will open, now browse for your hex file, load it into the pony programmer, and burn. Pony programmer supports click and drag operation too. That means, if you drop the hex file into the pony programmer, it will automatically catch it.


  • DB9 female connector
  • 2 X 1K resistors
  • 2 X 5.1 V Zener diode
  • 1 X 15K resistor
  • Vero board
  • BC 547 or any general purpose NPN transistor
  • Male Relimate connector (6PIN & 2PIN)

Links for Reference:

Note: 1. Make sure that you have a COM PORT in your computer hardware and your operating system recognizes it. Check it from “Control Panel > Administrative Tools > Computer Management”. In the cascaded list pane, find the following
“Computer Management > System Tools > Device Manager > Ports (com & LPT)”. If COM ports are present under this list, this circuit will work fine. Else, look for a USB based burner.
Note 2. This burner will work fine for ATmega16 too.  For ATmega8, you need to connect the signals to the respected pins.
Note 3 .You can omit the male 2-PIN Relimate connector