Pages: [1]   Go Down
Author Topic: Is 0 equivalent to Ground?  (Read 398 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

Electronics newbie here. A few queries regarding Atmega8.

1. Does a 0 on the Digital Output pin of Atmega8 equivalent to Ground?

If I connect a LED  + Resistor betwen D-Out pins 1 & 2, with Pin 1 outputting '1'
& pin 2 outputting '0', will it light the LED?

If so, is it safe to do so instead of using Ground?
(I read something about considering the sink current & such!)

2. Will the following work?

My aim to control the gradual dimming & brightening of individual LED's.



Thank you.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1. Does a 0 on the Digital Output pin of Atmega8 equivalent to Ground?

Yes, with the proviso that the pin has some output resistance and a current rating of 40mA.

If I connect a LED  + Resistor betwen D-Out pins 1 & 2, with Pin 1 outputting '1'
& pin 2 outputting '0', will it light the LED?

Yes, provided the LED is connected the right way round.

If so, is it safe to do so instead of using Ground?
(I read something about considering the sink current & such!)

Yes. That is essentially how multiplexed LED displays are driven.

2. Will the following work?

My aim to control the gradual dimming & brightening of individual LED's.

Yes. Just be sure that you respect the 40mA absolute maximum current per pin limitation (for both the low outputs and the high outputs), and the current limitations per port and per device (e.g. 200mA Vcc or ground current for an atmega328p).
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for replying, dc42.

The max current sink capacity for the Digital Pin of Atmega8 is 40 mA?
What is the source capacity?

Considering the above image, will it work without any problem?
How many Ohms resistor should I use on each pin?

Lastly, I would be grateful if you can tell me  how to use NPN tansistors (BC548)
as switches in the above diagram? (including the resistor values)

Thanks.
« Last Edit: December 12, 2012, 02:27:14 pm by Andy_Cool » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The max current sink capacity for the Digital Pin of Atmega8 is 40 mA?
What is the source capacity?

Also 40mA.

Considering the above image, will it work without any problem?
How many Ohms resistor should I use on each pin?

That depends a little on your LEDs. Look up the forward voltage of the LED from its datasheet, also the maximum forward current. The decide on the forward current you want to use per LED. The absolute maximum is 20mA each because you are driving 2 of them from a single pin. Subtract the forward voltage from 5V, divide by the required forward current (Ohm's law), and that gives you the resistance.

Lastly, I would be grateful if you can tell me how to use NPN tansistors (BC548)
as switches in the above diagram? (including the resistor values)

See http://www.dummies.com/how-to/content/electronics-components-use-a-transistor-as-a-switc.html. If you want to switch the positive supplied to the LEDs, you need PNP transistors. The BC548 is only suited to switching low currents. BC337 is better for switching medium currents.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Thank you very much. I will let this info sink & post back here
when I bump into an obstacle.
Thanks again.
Logged

Pages: [1]   Go Up
Jump to: