Go Down

Topic: I need help selecting a transistor (Read 11820 times) previous topic - next topic

PaulRB

I think I understand about using common anodes with the max. I assume you would also have to do some slightly tricky bit-twiddling in the sketch, because the pattern for each single digit would have to be spread over the max's 8 data registers?

Paul__B


I assume you would also have to do some slightly tricky bit-twiddling in the sketch, because the pattern for each single digit would have to be spread over the max's 8 data registers?

That is true but - it's only software!  A few lines of code (using pointers) - can be done while sending the code to the MAX7219, either by performing a lookup for every bit, or pre-assembling the pattern into an array and shifting out bits from that array one at a time.  (Dead easy in assembler ...)

Again, you are reaping a huge advantage in code and performance by removing the need to do this continuously to multiplex.

PaulRB

#32
Aug 22, 2014, 02:30 pm Last Edit: Aug 22, 2014, 02:47 pm by PaulRB Reason: 1
Well, red913 will have to decide between his current design and these two suggestions from opposite sides of the globe!

Paul__B's recommended solution of max7219. This could be driven by tiny85, if your switches are made part of a simple resistor network and connected to an analog input.

PaulRB's recommended solution of mega328 with 4 npn for the display  anodes. If your Uno is an R3, you could buy a replacement mega328 with bootloader installed. Once your sketch is working, just swap the chips!

Pelleplutt

After some google, an solution who not needs multiplexing from the uC, just write BCD and select digit.
4543 can be used with both common anode AND common catode (just change Ph)

Pelle

Paul__B


4543 can be used with both common anode AND common catode (just change Ph)

Yes indeed.  A whole - let's see - three milliamps or so per segment.

{Datasheet}

Pelleplutt

Oh well i give up, stopped reading after the truth table.
But a few mA can be enough with a super bright display.
I have a small project with 2 small displays and 3 mA are more than enough.

Pelle

PaulRB

#36
Aug 23, 2014, 12:50 am Last Edit: Aug 23, 2014, 12:58 am by PaulRB Reason: 1
Schematic for mega328 solution.

red913


Looks great!
Also attach a resistor between base and emitter on all 2N3906, 10 kOhm will be OK.
But using 74LS....?What century are you from.

Good luck

Pelle

Edit.
IF you power everything from 5volts, you do not need the NPN transistors, just connect R12-R15 directly to the arduino.
You also have to invert the code for this outputs.


I forgot to change the part's name. I don't know what a 74LS is, mine is 74HC595.
What's the purpose of the resistor between base and emitter?
I'm not sure if what he said is correct or not, which is why I posted it here. But the website I linked suggested it. Something about the i/o pin's voltage never really being low enough to keep the PNP from turning off, so the NPN is there to help it stay off.

red913


Hi red913,
...

1. Easiest first: use a 5V (or less) supply so you don't need a regulator. If using batteries, use 3 or 4 rechargeable AA or AAA cells instead of a 9V battery. Nothing in your circuit needs 9V, and that regulator will just waste four ninths of the 9V battery's charge.
a single battery just seemed easier to manage vs a large AA holder... but 3 AA isn't so bad. Perhaps I will go that route. Less parts is always better.
2. Connect the switches to ground and use the Arduino's internal pull-up resistors, saving 4 resistors.
This will still work even if I'm only using Arduino code right. I know the chip in the Arduino has them onchip but I couldn't find it being on chip for the Tiny.

3. Your tiny84 and 74hc595 are two 14/16 pin chips. There is a single 28 pin chip that could replace them: a mega328. The '595 has a maximum current source/sink of only 70mA, whereas the '328 can handle 200mA for a much brighter display. You won't need a crystal for the 328 because it will run at 8MHz just fine without. You can buy a blank 328 without a bootloader and program it using your Arduino exactly as you planned to do with the tiny84.

Ya, that's a good idea. It would definitely make the code a lot easier as multiplexing has proven more difficult than my rudimentary coding skills can handle. Although I've found some stuff online and with help from my brother I have almost finished the code. Maybe I'll just save the register for another project. AlsoI'll still need to source current from VCC, via a transistor, as a single digit pulls over 60mA and in total the display should exceed 240mA.

4. Pelleput is right about using only the pnp and not needing the npn. Alternatively use only the npn and then you don't even need any base resistor. See earlier discussion about emitter-followers between me and the other Paul.

Oh, I thought I needed a PNP to do high-side switching. Also I'm not sure I'm clear on the emitter-follower thing. This is what I put together from what I gathered on wikipedia.



So if this schematic is right I could ditch the pnp's in favor of just a single NPN. That would be nice.

5. As the 74hc595 is limited to 70mA, you could replace it with a tpic6c595 which has the same pinout but can sink up to 100mA per output (but not source at all - not a problem with your common anode display).
When checking with my DMM my current is just under 10mA each pin, which is pretty much the Shift Register's limit;as you pointed out; once I add in the remaining 6 pins that is. So using a Mega instead is sounding more appealing.
Thanks for the suggestions
...

Paul__B


Also I'm not sure I'm clear on the emitter-follower thing. This is what I put together from what I gathered on wikipedia.[/color]



"R1" is superfluous.  Note PaulRB's diagram above.

PaulRB

Quote
a single digit pulls over 60mA and in total the display should exceed 240mA.


It won't, because you will be multiplexing. Only one of the 4 digits will actually be on at any instant in time, so the max current would still be 60mA.

In my schematic above, I show 150R series resistors. This was a guess as I dont know the forward voltage or max current of your display's segments are.

When multiplexing, the display will appear dimmer than when a single digit is being driven, because each digit is actually only being driven one quarter of the time. To reduce this dimming effect, you can put more current through the segments, as long as you dont exceed the maximum for the segments or the driver chip. I calculated the series resistor assuming 20mA per segment, so 160 mA for the digit. I then spread that over two of the mega328's ports so they are sinking 80mA per port vs. the limit of 100mA per port.

PaulRB

#41
Aug 23, 2014, 12:24 pm Last Edit: Aug 23, 2014, 12:30 pm by PaulRB Reason: 1
Schematic for max7219 approach. Paul__B please check I got this right.

Paul__B

Ah! So I'm the MAX7219 expert now, eh?   :D

Oh well, so be it.

OK, I have checked your pinout on the MAX7219 and it appears to be correct.  I clearly cannot speak for your display.  Note in terms of programming, that the "DP" pin is (MSB) bit 7, "segment A" is bit 6, "segment B" bit 5 and so on.

Bypasses noted.

Red LEDs would be around 2V drop, so Rset should perhaps be 12k but that probably will not cause harm.  You might as well hook up the colon (and even the PM indicator) while you are at it - no penalty, just another "segment".

I will criticise your pushbuttons.  They should all return to ground, with the "value" resistors going from them to the analog pin and a pull-up from it to 5V.  A 1k resistor in series with S1 will allow you to determine multiple simultaneous button presses rather than S1 always taking priority.

I prefer not to use a library - or SPI - to control the MAX7219.  If I can see all the code in the sketch, I can figure out what it is doing.

PaulRB


Ah! So I'm the MAX7219 expert now, eh?   :D

Well, on this occasion you suggested it first! Also I had never even considered using it with common anode displays. That's 2 things you taught me on this thread.

I clearly cannot speak for your display. 

It was just one Eagle had in the library. We don't know if red913's display has colons or whatever.


while you are at it - no penalty, just another "segment".

I will criticise your pushbuttons.  They should all return to ground, with the "value" resistors going from them to the analog pin and a pull-up from it to 5V.  A 1k resistor in series with S1 will allow you to determine multiple simultaneous button presses rather than S1 always taking priority.


How about now:

red913


Schematic for mega328 solution.


Thanks PaulRB, I think I'm going to pretty much copy what you did here.  That looks good to me.  :D I do have colons and I'm just going to keep them on the entire time. pin 12 to 5V and 4 to 0V. 150 resistors was a good guess. I calculated 145.  Thanks for doing the work and separating the digits over the respective ports.  2 questions:

1) pc6(reset) get's 5v, why is that? What exactly is this pin doing?
2)A lot of transistors suggest here all have gain on them and I believe you can buy them without having any gain at all. Would that not be advantageous for me as I don't really need to amplify anything as the BC337's do.

Go Up