Blinking LED Tutorial
Introduction:
This is the first project with a microcontroller and also a beginner’s guide to AVR microcontrollers. Basically what we do here is tie a couple of Light Emitting Diodes to microcontroller pins, connect it with a computer, program it and finally see them blink. Further we will see the different ways to make them blink, learn how to fade them etc.
This is similar to what we achieve in any "Hello World" program and I assume that you are already familiar with Microcontroller and AVR basics. If not, suggest you to go through AVR basics, Microcontroller basics and return.
Tutorial index:
- Parts List:
- Electronics:
- Breadboard-Programmer Setup:
- Programming:
- Blinking LED:
- Bitwise Operators:
- Assignment Operators:
- Bitwise Shift Operators:
Parts list:
- LED
LED: 1 or more (Red, Blue, White or whatever color you like) - Atmega8
Atmega8 : 1 - Breadboard
Breadboard - Connecting wires
Wire - Resistor
Resistor : 1 or more - 330 Ω (1 resistor for each of your LED) - Battery
Battery or any power source: 6-9 Volts - Male headers
Male Breakaway Headers - Programmer
Serial Programmer – Serial or Parallel - 7805
7805 - Voltage Regulator
The parts are of course expensive for this project. You may question the need to spend so much for a blinking LED. Instead, you can purchase a set of blinking LEDs for a fraction of this cost, connect it with a battery and resistor; make it blink. But what you cannot do is control them. You cannot make a LED switch on for 10 seconds and then switch off for another 5 seconds, or whatever period you choose.
Also the parts mentioned here can be reused again and again. The programmer which might burn your wallet is still a decent investment. Once you purchase / build a programmer, it is almost a lifetime investment (unless you burn it or destroy it for some odd reason).
The hardware requirement is complete. The software required is freely available over the web. Refer to Software requirements tutorial and install all software in the same order mentioned.
Do you have anything to say?
Visit the Forum to discuss, learn and share anything related to robotics and electronics !!