1
\$\begingroup\$

I am looking for a ciruit which allows switching an LED according to a digital (bus) signal. The actual signal should only be minimal affected (rise time etc.).
An example: Light up an LED when a SPI device is selected by ~CS. I dont want to use another digital pin of the master for this. What circuit would be appropriate?


My thought was using a Darlington transistor as it is available in arrays in an IC (e.g. ULN2003D) and should work with low currents to switch Q1:

schematic

simulate this circuit – Schematic created using CircuitLab

Is this a good approach and how large should R2 be? Note : The SPI ~CS Example needs an additional NOT gate to flash the LED when the Slave is selected.

\$\endgroup\$
  • \$\begingroup\$ How much current do you need for this LED? See for instance the schematics of the Arduino 2009, where the low-power LED on pin 13 is directly connected to SCK pin. \$\endgroup\$ – Damien Aug 23 '15 at 12:08
  • \$\begingroup\$ I am using LEDs with 20 mA nominal current, but I dont need maximum brightness. In your linked schematic, the current is limited to <5 mA. I thought a higher current draw on the digital line could affect bus performance especially rise time. \$\endgroup\$ – Grebu Aug 23 '15 at 20:27
1
\$\begingroup\$

Aside from @Oka's suggestion, you could also use a pair of common NPN 2n3904.

schematic

simulate this circuit – Schematic created using CircuitLab

R1 and Q1 act as a simple inverted switch, so when the SPI chip select is enabled (i.e. logic low/grounded), Q1 turns off, allowing Q2 and the LED to turn on. This is smaller/simpler than a ULN2003D and a Not gate.

Honestly though, the CS pin is not a high speed data line. Any delays in the line would happen after the resistor. You would still be connecting the CS pin directly to the IC.

\$\endgroup\$
  • \$\begingroup\$ Seems the ~CS pin was a bad example. My aim is to show activity on a bus, that could aswell be I2C or UART based. But aside from the inversion the concept should be similar. \$\endgroup\$ – Grebu Aug 23 '15 at 22:32
  • \$\begingroup\$ @Grebu I'm thinking your wondering about the capacitance or inductive effect on the line? An led would induce 50pf or less typically. The resistor and trace/wire a trivial amount as well. You could model it, but unless you are going very very high speed it should affect much. In any case the transistor would reduce that as well. \$\endgroup\$ – Passerby Aug 23 '15 at 22:53
  • \$\begingroup\$ I was wondering if the source runs into its limits if it has to drive a higher current. This could be due to reactance or just be thermally limited. Thanks for the clarification on the effects in the line. \$\endgroup\$ – Grebu Aug 23 '15 at 23:19
1
\$\begingroup\$

Any transistor will work. If you need 7 transistors, using transistor array is a good choice. Note that your above circuit will turn on the LED when the input in a positive logic (~5V), however, ~CS pin selects the chip with low voltage.

Consider using PNP transistor switch that turn on the LED with low logic input (~0v)

enter image description here

R2 limits the base current. Make sure the transistor turn on when input voltage is low (<2v), but the transistor is not turn on when input voltage high (>3v). With this design, base current approximately -0.13 mA when input connected to 0v.

Alternatively, you may use a hex buffer 7407. enter image description here

\$\endgroup\$
  • \$\begingroup\$ Thanks for those low current solutions. So I conclude, if I use transistor logic, the main issue is to size the resistor at the base large enough. \$\endgroup\$ – Grebu Aug 23 '15 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.