The Power of a microcontroller is its Pins and Ports by which it communicates with the external world. In the figure below, you can see a pictorial representation of an ATmega8 microcontroller.

Atmega8 Pictorial Representation
LED_Pin ConnectionAtmega8 has 3 ports PB, PC and PD. PB & PD (short for Port-B and Port-D) has 8 pins associated with it. PC (Port-C) has 7 pins associated with it. Few AVR variations can have as few as 3 pins in a Port.

For this project, we will use Port-C (Green color coded). If the voltage in any pin (PC0-PC6) is set to High (5 Volts) and connected to positive lead of LED in series and further connected to ground, your LED should turn on. Set it to Low (0 Volts) and your LED should turn off.

On the other hand, if you connect negative lead of LED to Port Pin in series and further connected to 5 volts, then the LED turns on. Set the Pin to High (5 Volts), your LED should turn off.

This concept is simple. In the first scenario, current flows from Pin to LED to ground. In the second scenario, current flows from 5V power line to LED to pin, which is 0 volts. This is all the electronic knowledge required to turn on, or off a LED. Since I mentioned that entire port will be high, or low, you can connect the LED to any of the Pins in Portc.Programmer Connections

But how do we connect these electronic components together? For the LED tutorial, let us take the KISS approach. i.e. Keep It Simple & Stupid! We will use a breadboard, couple of wires, battery, LED and a programmer. No soldering, no burning. The circuit may look like a complex set of irregular connections. Refer to the figure in the right for programmer connections, or the Schematic

Tutorial index:

  1. Introduction:
  2. Electronics:
  3. Breadboard-Programmer Setup:
  4. Programming:
  5. Blinking LED:
  6. Bitwise Operators:
  7. Assignment Operators:
  8. Bitwise Shift Operators:

Do you have anything to say?
Visit the Forum to discuss, learn and share anything related to robotics and electronics !!

rss feeds

Featured Videos


Recent Articles

Atmega8 Development Board

A great step-by-step tutorial on building your own Atmel AVR based Atmega8 development board. The board is ideal for beginners with detailed explanation and pictures More...

L293D Motor Driver

For robots to do work, you need to know how to control a motor. L293D is a cleverly packed IC which can control two DC motors in both directions: forwards and reverse. Here is a detailed explanation of building a board based on L293D ICMore...

Hobby Servo Tutorial

Servo Motor is a device which uses error-sensing feedback signals to determine and control the position of a motor shaft. The term "servomechanism" closely relates to servo motors..More...

Blinking LED Tutorial

This is similar to what we achieve in any "Hello World" program. However, it is not just limited to blinking LED but scratches the surface of AVR-GCC programming... More...

Kindly Donate

If this site has helped you, then kindly consider a Donation to say "Thank You!!". Donation might help us keep all this information available for free and also pay for the resources.

If that is difficult, then a simple "Hi" in the forum would still do good :)