Depends on the LED:
(5V - Vforward_LED)/0.008 = Resistor needed
CrossRoads:
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000339.pdfSYMMETRICAL OUTPUT IMPEDANCE:
IOH = IOL = 6mA (MIN.) FOR QA to QHYou could get more out of them - for a little while anyway.
Depending on the LED, this can be quite bright (for a 4-5000 mcd LED), or it can seem kind of dim for a run of the mill 15mcd LED.
That 6mA limit is to guarantee the output low and high voltages. The actual rating given on that data sheet is +/- 20mA per output, and +/- 70mA total for the part. So if you're driving all 8 outputs, you need to limit the current to around 9mA each.
I've built a small scale (2x2) RGB matrix driven by the ShiftPWM matrix code and have run into a problem.
I'm powering my circuit with a modified wall adapter (15v, 350ma) and have it hooked up so that the +15v from the adapter goes to the source of the transistors as well as the Vin on the arduino. When I plug it in the lights go bright but will not respond to any code written from the arduino. When I unplug the adapter, however, and run it off USB power the code runs fine (but the LEDs are very dim). I'm assuming this is probably a wiring error which will be difficult to resolve without a proper schematic/picture of the circuit, but perhaps not. Any thoughts?
"I'm assuming this is probably a wiring error which will be difficult to resolve without a proper schematic/picture of the circuit, but perhaps not. Any thoughts?"
You assume correctly. Can you post one? Have the transistor specifics shown.
I'm guessing with 15V your arduino regulator gets pretty warm?
Not noticeably - i think there's something wrong with the way i've wired the adapter. The resistors from the LEDs to the register are hot though.
I'll clean things up and see if that works. If not i'll post a picture.
You have 15V to resistor to LED to what?
15v to arduino and
15v goes to transistor, which is gated from a shift register for a walking bit to the anode (rows) of the LEDs. the resistors are connected to the shift registers for the columns which take 5v from the arduino.
mschn:
I'm powering my circuit with a modified wall adapter (15v, 350ma) and have it hooked up so that the +15v from the adapter goes to the source of the transistors as well as the Vin on the arduino.
Sounds like you may be trying to use P-channel mosfets driven straight from the Arduino to switch +15v. That isn't going to work. Can you post your schematic so that we can see exactly what you are trying to do?
That is what i'm trying to do. Why wont that work?
The attachment shows my basic breadboard setup, although I have 2 more LEDs in a second row attached to the same shift register.
Your diagram isn't very clear, but I think what you are trying to do is what I have shown on the left hand side of the image I have attached. That won't work because the gate of the P-channel mosfet needs to be at about the same potential as the source (i.e. +15v) to turn the mosfet off.
The diagram on the right hand side shows one possible arrangement. The shift register outputs will need to be programmed in the opposite sense, i.e. HIGH to turn the LEDs on.
Ah, I see. Yes that was what I was trying to do. I thought that with logic-level mosfets the switching process was simplified a bit. Could you explain your diagram on the right? Are you dropping the voltage to the gate so that the register can interface with the transistor?
mschn:
Ah, I see. Yes that was what I was trying to do. I thought that with logic-level mosfets the switching process was simplified a bit. Could you explain your diagram on the right? Are you dropping the voltage to the gate so that the register can interface with the transistor?
I'm using the NPN transistor to both amplify and level-shift the 0 -> +5v signal from the Arduino to +15v -> 0v for the mosfet. The level shifting is the important part. The amplification is a by-product, and means that the mosfet doesn't need to be logic level. Make sure that the Vgs maximum rating for your mosfets is more than 15v, that is what they will get unless we add more resistors.
If your LED supply was +5v instead of +15v, then driving logic-level P-channel mosfets directly from the Arduino (with a 150 ohm or so series resistor between the Arduino pin and the mosfet gate) would be the simplest solution.
So would it be simpler then to just run my power supply through an external voltage regulator to the LEDs?
Also, why the series resistor from the arduino to the gate?
mschn:
So would it be simpler then to just run my power supply through an external voltage regulator to the LEDs?
Yes, if your P-channel mosfets are logic-level. However, all the power dissipated from dropping 15v down to 5v (i.e. 10v * the maximum total LED current) will be dissipated in the regulator, so you will likely need a heatsink. If you run from 15v instead, you will use higher value LED series resistors, and the power (and heat) will be spread across those resistors.
mschn:
Also, why the series resistor from the arduino to the gate?
Power mosfets have quite a high input capacitance. Adding a series resistor is kinder to the microcontroller, by keeping the peak output current from the Arduino pin within its 40mA rating when the pin switches state. You haven't said what type of mosfets you are using, but if they are power mosfets in a TO220 package, their input capacitance is likely to be of the order of 1nF.
I'm using some pretty nice logic level mosfets: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=MTP50P03HDLGOS-ND, so i think i'll go the route of the voltage regulator.
For my final project i'll be running it off of an 11v battery, so there won't be quite as much power dissipation, but i'm planning to incorporate several fans to keep things cool.
I'm running my external voltage (+15v) through a voltage regulator to the transistor. My voltage regulator is an adjustable one though, and with the resistors I have a was able to set it to ~5.04v. The gate of the MOSFET is at 5v from the shift register...are these more or less close enough for the transistor to be able to switch the current when driven high/low?
Yes, that should be close enough. You need to make sure that when the mosfet is supposed to be off, the gate-source voltage is below the minimum gate threshold voltage, and when it is supposed to be on, it is at least 4.5v or so (for a logic-level mosfet).
My matrix is going to be about 17x20 RGB and span (in total) probably a few feet of wiring per output. Will I need to amplify the signal from the arduino? If so, what is the best way to do this and where in the circuit should it be incorporated?
Would I also be able to use a step up dc-dc converter to level shift instead of downshifting?
so, shift register -> dc-dc up to unregulated voltage -> PNP ?
I dont really understand how to build the level shifting via transistor.
No, a dc-dc converter is much too slow for this purpose. If you want to level shift using a transistor, see the schematic I gave in reply #49.
I would put the transistors and mosfets near the LED matrix (along with some decoupling capacitors between the +ve supply and ground), and run the long wires from the Arduino to the transistors.