Go Down

Topic: Is 0 equivalent to Ground? (Read 513 times) previous topic - next topic

Andy_Cool

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.

dc42


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).
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.

Andy_Cool

#2
Dec 12, 2012, 08:25 pm Last Edit: Dec 12, 2012, 08:27 pm by Andy_Cool Reason: 1
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.

dc42


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.
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.

Andy_Cool


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

Go Up