Pages: [1]   Go Down
Author Topic: LED on SS pin  (Read 1554 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hello,

I have question about connecting resistor to transistor.

In my project I want to have LED indicating device that is currently active.
I do it on SPI bus connecting led to SS pins, as you know, in such solution I have to invert login on SS pin. I also would like to have resistor for limiting power and brightness of led.

Which of solution shown below is correct and why?



Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 216
Posts: 13676
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


why not just

DATA ----[ R ] ----- [ LED ] --- GND

?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Online Online
Shannon Member
****
Karma: 206
Posts: 12113
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Neither of the circuits are optimal because they both take more current when the LED is off.  The transistor is being used as a switch in parallel with the load instead of in series with the load which is the preferred technique.

With an LED and series resistor the Arduino output can drive this directly if current is 30mA or less - and you can drive in either sense (active high, active low) as the Arduino sources and sinks current equally well.
Logged

[ I won't respond to messages, use the forum please ]

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 33997
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If the data line is going somewhere else you need a resistor in the base to limit the base current. That sort of switching is known as shunt switching and as was said is not very common.
Logged

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

I cannot connect led to ping becouse SS (Slave Select) from SPI works in inverted logic.

It is HIGH when device is deselected and LOW when we select device, so in order to lit led when device is working (is selected) I have to Invert logic (Led lit when SS is LOW).

I do not know other solution, if there is any I would appreciate any tips.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It is HIGH when device is deselected and LOW when we select device, so in order to lit led when device is working (is selected) I have to Invert logic (Led lit when SS is LOW).

I do not know other solution, if there is any I would appreciate any tips.

Yes, simply wire the external led such that it's anode pin is wired to ground and it's cathode pin is wired through a series current limiting resistor to the SS pin. When SS pin is low, led will light up.


Lefty
Logged

Western New York, USA
Online Online
Faraday Member
**
Karma: 36
Posts: 4305
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Yes, simply wire the external led such that it's anode pin is wired to ground and it's cathode pin is wired through a series current limiting resistor to the SS pin. When SS pin is low, led will light up.
Wouldn't the SS pin have to be less than 0 v (assuming ground is 0v) for the LED to be forward biased?

Isn't this an application for a PNP transistor?   +5v --> resistor --> LED anode.  LED cathode --> PNP emitter.  PNP collector --> GND.  SS --> resistor --> PNP base.


Don
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm sorry I kind of screwed that up. For a led with resistor to light up when a output pin (your SS pin) is low only requires you wire the resistor to the SS pin, other end of resistor to the cathode of the led, anode of the led wires to +5vdc pin. The led will be forward biased (and light up) when the SS pin is low.

Lefty
Logged

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

thanks!

I've tried your solution and it worked like a charm!
Now I have will have some space (left after deleting transistors) on PCB to correctly align parts.

I come out with something like this:



I put there potentiometer so I could adjust resistance in order to get correct voltage on SPI SS pin.

My device require 3v3 voltage on spi bus (for mosi, miso, clk and interrupt I user lever converter) so SS i must convert by myself.

And my second question is: Which is better for converting 5v to 3v3 .. a voltage divider built from two resistors (GND -- RES -- SPI SS -- RES -- DEVICE) OR one resistor with calculated value ( SPI SS -- RES -- DEVICE) ?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 33997
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Which is better for converting 5v to 3v3
Do not use a single resistor, that is a very bad solution and will not work reliably. A potential divider is a bit of a fudge but might work, the best way is to use a level converter FET.
Logged

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

Hmm is this required for one way conversion (5V->3v3) ?

I just looked at sparkfun level converter and for such conversion they use two 10k resistors
http://www.sparkfun.com/datasheets/BreakoutBoards/Level-Converter-v10.pdf

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 33997
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

[quoteis this required for one way conversion (5V->3v3)][/quote]
For maximum signal fidelity, speed and noise immunity then yes. However as I said a potential divider is a fudge that will work in most (but not all) circumstances.
Logged

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

Thanks for answer.

For this project I will go with wimple voltage divider (since I do not need to wory about noise).
In next one definitely will go with FET
Logged

Pages: [1]   Go Up
Jump to: