hello kind people....i am tryin to build a bicolored led cube in 4x4x4 format.....i have 4 daisy chained 74HC595s running fine and switching the 32 anodes for the cube...but i am stumped with the layer switching.....the anodes of my cube are connected to high side switches through 100E current limiting resistors.....the cathodes are to be tied to the collectors of the 2n2222 with the emmiters of the transistors going to ground....i am not sure what resistor to use for the base since i tried a 1K which doesnt work....um sure this a typical noob issue but would be really greatful if someone could help me out....thanks.....
Do you know how much current the transistors have to switch? I'm guessing 32 times 20mA or so, which is .64A - rather high for the 2N2222, its absolute max is .8A (it will run rather hot and with poor DC gain). At 10mA the 2N2222 has gain of 75, at .64 A I'll guess its gain is more like 20, so you'll need 32mA on the base (times a factor of 1.5 to guarantee saturation, so 48mA)
That's too much for the Arduino.
So I think the 2N2222 isn't a good choice here. However its easy to fix - use two 2N2222's in parallel, each takes .32A, gain will be about 40 say at this lower current, so bases need about 8mA each, call it 12mA for saturation. A single pin can drive 2*12mA fine.
Base resistors need to be about 330 ohms each.
So wire the emitters and collectors in parallel, but each base goes through a separate 330ohm resistor to the common pin.
Now you need to redo the calculations using the actual current your LEDs take - I don't know what you mean by 100E resistors, and without knowing the forward voltage of the LEDS and the high-side voltage I can't know this.
thanks Mark....actually i plan to light up one layer only in one color at any point in time so the max current i guess should be .32....the high side voltage is 5v (coming from a 7805)......the fwd voltage of the diodes is 2.5v.....
Even better, replace the 2N2222 by something more suitable for the job, such as ZTX851 (minimum hfe 100 at 10mA and at 2A, and low saturation voltage), and use a 220 or 330 ohm base resistor.
I usally use a 1 K for the base resistor, sometime, a 4.7 K. I normaly use a 2N3904. I did use a 2N2222 and I use a 1 K resistor for the base. In theory, it should work, as long the base resistor "see" a 1 or close to 5 V, it should place the transistor into saturation. That is if you connect everything properly. I NEVER use a resistor well under 470 ohms for a 2N2222 or 2N3904 for a base resistor.
Or
It is possible you have a "bad" transistor.
Its important to saturate the transistor so the base current needs to be more than that which the current-gain equation suggests (otherwise the transistor isn't properly on and can drop a noticeable voltage (and vary between devices) - I'd suggest calculate the base current from the gain parameter and then double it.
Saturated transistors switch off a bit slower, but this shouldn't be an issue with most LED setups.
thank you so much gentlemen for all the suggestions.....but it turned out to be a sheer lack of understanding on my part...i wish i could stop making these rookie errors....i had the base hooked up to the analog pins....guess these can’t be used this way.....although i do have a few questions regarding the next steps....i plan to now setup a standalone arduino to use with the cube.....i plan to use the arduino on Breadboard tutorial....just two quick questions...
- Are there any particular issues that i should keep in mind before trying to boot-load the fresh chip in this tutorial (guess i have a 328PU version)......
- I already have a 7805 in the circuit that is powering my cube and is currently connected to a 12v 1Amp supply via the Vin pin on the board.....would it be ok to now hook up the 7805 directly to the 12v wall wart and power the ATMega from the output....would i use a current limiting resistor for the purpose....i already have decoupling caps on the 7805....
- Could someone please suggest a schematic to prevent the chip from an accidental incorrect polarity of the wall wart....
Much appreciate the help....
actuallu i just figured out the answer for the 1st question...i have the 328P-PU variant which per Atmel's website has a device ID of 0x1E 0x95 0x0F....so i think i should be fine without modifying the config file....the only thing i need to figure out on this is if would need to disable the auto reset and the correct way to do it (i read that this can be done by either using a resistor on pin 1 to +5v or using a capacitor)....much appreciate any help.....
nitinarora:
3. Could someone please suggest a schematic to prevent the chip from an accidental incorrect polarity of the wall wart....
Much appreciate the help....
I've found the Sparkfun Beginning Embedded Electronics #1 (Beginning Embedded Electronics - 1 - SparkFun Electronics) has some very simple and easy to understand info about setting up a 7805 and powering a microcontroller, as well as using a diode for polarity protection.
And I'm not sure I understand your comment about the limiting resistor, but if you're asking if you can power your cube and 7805 both from a 12V/1A wall-wart, I'd think so, depending upon the power usage of the cube that is. A custom Arduino board shouldn't use much power.
I hope this helps,
Brad.