JizzaDaMan
Posts: 66
Joined: Sun Apr 07, 2013 2:14 pm

[SOLVED] Are these resistor values OK?

Thu Aug 28, 2014 10:04 am

I've done this circuit diagram and I was hoping you could check a few resistor/capacitor values that I'm not sure about. If you could also explain how/why you choose any of these values as well I would be very grateful.

[attachment=0]Circuit diagram_schem.jpg[/attachment]
(Apologies about the size, there are limitations on what the forum will let me upload. You'll have to zoom in on it to make anything out)

The chip is a package with 2 4-stage shift registers in it (CD4015BE if you're interested), hence the two reset pins. Both are active high and they require 100ns being high to reset the chip. I've pulled the reset pins to +5V with a 10nF capacitor, and to ground with a 10k resistor so that the chip resets at power on. Are these values ok?

I'm also not sure about the resistors clamping the bases of the NPN and PNP transistors to ground and high, respectively. I've used 100k because I've been told it should be an order of magnitude greater than the current limiting resistor on the base, but this seems a bit high. Thoughts?

Finally, I'm switching my data and clock lines using transistors because the chip uses 5V logic. I have a resistor tying these lines to +5V, and then when I want them low, I make the bases of the transistors high, thus tying the lines to ground. Those pull up resistors are 100k. Is that again too big?

Thanks for any help
Attachments
Circuit diagram_schem.jpg
Circuit diagram_schem.jpg (60.16 KiB) Viewed 1100 times
Last edited by JizzaDaMan on Fri Aug 29, 2014 12:46 pm, edited 1 time in total.

User avatar
Gert van Loo
Posts: 2482
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Are these resistor values OK?

Thu Aug 28, 2014 10:35 am

I don't know what you are trying to achieve but I made a 5x5 LED matrix without all the driver components and it works fine.
The disadvantages are:
- I use 10 GPIO pins versus you two.
- I multiplex the I/Os so the Pi has some work to do but using C-code I see no flickering
- I limit my current to 2mA/LED but then I use ultra-bright LEDs.

I selected LEDs which where >1CD and found that I made two errors:
A/ They where blinding and you could not really look into them.
B/ They had a very narrow angle so it did not look so great when you looked from the side.

Next time I would use >500mCd and 120 degree display angle.

(There was a front page post a while ago but I can't find it.)
Attachments
screenshot.gif
screenshot.gif (72.35 KiB) Viewed 1084 times

JizzaDaMan
Posts: 66
Joined: Sun Apr 07, 2013 2:14 pm

Re: Are these resistor values OK?

Thu Aug 28, 2014 10:46 am

Thanks for the reply. I'm aware that I could do it without the register, but I'm hoping to expand into multiple dimensions and larger matrices. So I want to experiment with shift registers (In future I will probably use an LED driver to remove the need for all those transistors)

User avatar
Burngate
Posts: 5967
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Are these resistor values OK?

Thu Aug 28, 2014 12:03 pm

When Gert says something, believe it. Me, less so.

First, the diagram - you've uploaded a jpg, and, yes, there's a file-size limit. It's worth looking at png instead of jpg, since it sometimes gives smaller files with better quality. But uploading to somewhere else (I use Google sites, YMMV) means you get round the limit.

The power-on reset. 10k, 10n gives 100us? (the question mark is because I tend to lose or gain orders of magnitude at random)
You need it long enough for the power supply to stabilise, and low-enough impedance so noise won't trigger it. Seems good to me.

There are three different areas in the circuit - Pi 3v3 GPIO into 5v logic, 5v logic into LED cathodes, and 5v logic into LED anodes.

The first isn't a problem.
The 5v logic doesn't need much current, so 100k in the collectors should work, though noise and speed might mean you may want to reduce those. I'd use 10k instead because I've got lots of them. You may think about 5k6, since you seem to have lots of those.
The 5k6 base resistors don't seem unreasonable - 2v7 across them gives about 0.5mA into the base, while the collector current will be only 50uA (or 0.5mA if you use 10k collector resistors) The 100k pull-down with 0.7v across it is almost redundant - when the GPIO is set to 0, it will sink more current through the base resistor than the 100k can. If you want to have a pull-down resistor, why not another 5k6? When the GPIO is high, there's 0.5mA from the GPIO, with 1/4 of that through the pull-down, so still over 0.3mA into the base.

The second, the 5v logic, also isn't a problem, though since the LED current is much larger, the hfe of the transistor needs to be considered, to make sure it's driven fully with only (now) 0.8mA into the base. Again, since the logic outputs will sink more current, I wouldn't bother with the 100k pull-down.

Finally, the anode drives. You're driving the transistors from logic that goes between 0v and 5v, while the transistor emitters are held at 12v. So when the logic is low, there's ~2mA into the base (with not much through the pull-up). When the logic is high, there's still 6.4v across the 5k6, so still over 1mA into the base. You may want to re-think this bit.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12117
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Are these resistor values OK?

Thu Aug 28, 2014 12:38 pm

Resistor values seem about right, yes this could have been done with less components, but essentially its fine to do it like this, and its expandable. There is the problem that the shift register cannot output 12V to close the PNP transistors though, but that can be solved by running the shift register at 12V too!
Obviously you will need to use a logic family that can run at 12V, and the data and clock inputs must probably be lifted to 12V too, instead of to 5V.

also, I took the liberty to increase the picture size, the forum system essentially creates more a thumbnail of your picture than an normal sized one, but you can increase the size by using size tags around it, they do not only work on text!

Also, to open a picture full scale simply right click on it and use the "open in new window", "open in new tab" or "view image" option (whichever your browser supports).

User avatar
Burngate
Posts: 5967
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Are these resistor values OK?

Thu Aug 28, 2014 3:59 pm

mahjongg wrote:... There is the problem that the shift register cannot output 12V to close the PNP transistors though, but that can be solved by running the shift register at 12V too!
Obviously you will need to use a logic family that can run at 12V, and the data and clock inputs must probably be lifted to 12V too, instead of to 5V ...
CD4015BE will run at 15v (and go a bit faster then) so just remove the 5v regulator and everything should work ...




And why hadn't I thought of that?

JizzaDaMan
Posts: 66
Joined: Sun Apr 07, 2013 2:14 pm

Re: Are these resistor values OK?

Fri Aug 29, 2014 12:45 pm

Thanks for all your help/advice, I've already built the circuit with a few modifications:
Removed the 5V regulator.
22k base resistors on led driver transistors (owing to the increase in voltage from 5V to 12V from removing the regulator - the shift register can only source/sink 1mA).
10k pull-up resistors on the transistors coming from the pi.

I also utilised both of the 4 stage shift registers separately, with the intention of using one for the 'x axis' and one for the 'y axis'. This would allow me to use persistence of vision multiplexing. (Or so I thought!)

Of course this is just a test run; I plan to do a bigger cube in the future. The main thing I discovered is I need the functionality of an output enable pin, because otherwise due to POV effects, it becomes impossible to just light one LED!

Thanks again for all your help!

Return to “Beginners”