A layman explanation on how a micro controller turns on and turns off a single led

Status
Not open for further replies.

nullexception

Junior Member level 2
Joined
Sep 23, 2014
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
154
Hello,i am getting started on micro controllers and i need to get a layman view on how a micro controller operates.



Lets say i have the arrangement as the one shown,how does the micro controller actually help in turning off and on the led?.

Does it like act as a bridge such that only when a specified current reaches the led that's when the led shall turn on or what normally goes on?.
 

Hi,

In that condition the micro acts as a simple timing device; exactly how it performs that function is down to the program code you give it.
It controls the led by turning one of its output ports high or low which allows the current to flow, via a current limiting resistor, to the led.

There are many tutorials / books out there to give you a better understanding, though we can better help you if you say what make of Micro your intend to use and also what programming language you want to learn.

Have a look at this Pic tutorial on how to Light a Led to get a better understanding of how a micro works.
**broken link removed**
 
By output port high or low,do you mean 0 or 1. And secondly,what if i wanted to control the brightness of the led,will i use the micro processor to control the high and the low or is that the work of a variable resistor?.

I am using the avr microcontroller.I want to learn what goes on to turn on or off an led from a micro controller and also to control the brightness of the led possibly from a microcontroller.

Thanks for your wonderful answer.
 

Yes, high and low level means 1 and 0 logic and also 5V and 0V in digital circuits. 5V is logic high if it is a 5V logic device. Brightness of LED can be controlled using PWM of microcontroller. The more the duty of the PWM pulse more bright the LED will glow. Some compilers like mikroC PRO AVR have built-in PWM libraries and you can set PWM duty between 0 and 255. For 0 duty the LED will be off and for 255 the LED will have max brightness.

The MOSFETS controlling the output pin act as switches and they either source or sink current. They can source or sink current through LED connected to it. Read about transistor and mosfet switching circuits.
 

Hi,

For varying the brightness / voltage to a Led then you use the PWM feature of the Micro.

When you say you are using a avr, is that in the form of an Arduino or some other dev board ?

Like that Gooligum Pic tutorial there are lots of beginners avr / arduino tutorials on Ytube etc .

I don't do AVRs as such but plenty of other members here will help you get going.
 
I only got a breadboard,a programmer and an avr micro controller,no arduino.

With your guidance on PWM and other tips,i shall get into the literature and see what i gather.

Thanks so much for your help.
 

I only got a breadboard,a programmer and an avr micro controller,no arduino.

With your guidance on PWM and other tips,i shall get into the literature and see what i gather.

Thanks so much for your help.

Hi,

Using a breadboard, AVR chip and programmer does work but its not the easiest of ways to start for a complete novice imho.


Assuming you are wanting to use some form of C programming then my choice would be to go down the Arduino Uno route.
The reasons for this are that you get a complete microboard thats usable the instant you plug it into your USB port and it has masses of ready made program examples and tutorials plus its own extensive forum.

Your current kit will be a perfect match as you can use the breadboard with the Uno for your experiments and later you can burn your Uno proven program code onto your own chips with your programmer.

A genuine Uno cost about GBP £20 but you can buy very good clones for around £6, I bought one the other month as it was cheaper than building the equivalent circuit .
**broken link removed**

If you want to see how the Arduino is set up then have a look at this video which really does take you every step of the way (a lot of other tutorials can assume you already know quiet a few things )
https://www.youtube.com/watch?v=kLd_JyvKV4Y
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…