Voltage and Current

Building your first 6502-based project? We'll help you get started here.
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Voltage and Current

Post by sburrow »

Hello everyone!

I feel like my question deserves to be here in the Newbie section. I don't mind that, I am still new to all of this.

Been trying to configure my new color scheme for VGA output. Nothing new there for me. I use resistors to bring 5V down to a range of 0V to 0.7V, super straight forward.

What I never considered was the current. I am using falstad.com for simulation purposes, and I'm seeing that even my most basic circuit to display a white color is taking around 25mA. All of this coming from a single 74HC166. Here is a link to the datasheet, https://assets.nexperia.com/documents/d ... HCT166.pdf. According to the datasheet (if I'm reading this correctly) it is only able to supply 25mA of output current. Is this correct?

So then, I'm barely within margin! That is not good.

My new planned configuration that is more complicated and using diodes seems to take around 40mA. If I am understanding all of this correctly, then that would not work at all. Right? Not just to a monitor, but what in general are the effects of not having enough amps to power something? Sporadic behavior? "Always off"?

Likewise that would be 40mA going through a 1N914 diode. I see on it's datasheet that it is rated up to 200mA, I think, so this shouldn't be a problem, correct? If I am pushing margins on current supplied to a diode, would it just get hot? Could it explode?

I am not an electrical engineer, obviously. This is 101 material for most of you. Any help and clarification is much appreciated.

Thank you everyone!

Chad
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: Voltage and Current

Post by SamCoVT »

Hi Chad,

Can you post a schematic of your "resistor" and your "diode" versions of your circuit? The monitor has 75 Ohm resistors to ground on the signal lines, so to get 0.7V you shouldn't be sending more than about 9mA into the monitor on any given signal line.

-SamCoVT
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Voltage and Current

Post by sburrow »

Sure!

Here is my falstad.com link, for the white output using only resistors:

http://falstad.com/circuit/circuitjs.ht ... irUc4yS2EA

Attached is a picture of my 'diode' setup. I ran that through falstad.com as well, but I didn't save a link.

Thank you!

Chad

EDIT: I realize that I don't have resistor values on that picture. I found some configuration to make it work, but again it was showing 40mA of current usage on falstad.
Attachments
DiodeSetup.png
DiodeSetup.png (9.71 KiB) Viewed 2048 times
Last edited by sburrow on Wed Aug 03, 2022 7:57 pm, edited 1 time in total.
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Voltage and Current

Post by BillO »

25mA is the absolute maximum for that chip. It probably won't last very long at that kind of current out.

What is the frequency of the output? You could probably use a 2N2222 in an emitter follower configuration to amplify the current.
Bill
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Voltage and Current

Post by sburrow »

BillO wrote:
25mA is the absolute maximum for that chip. It probably won't last very long at that kind of current out.

What is the frequency of the output? You could probably use a 2N2222 in an emitter follower configuration to amplify the current.
The 74HC166 has a clock speed of 25.175 MHz, though it doesn't change high-to-low or low-to-high each time.

I went looking at the 2N2222 (datasheet here https://media.digikey.com/pdf/Data%20Sh ... itches.pdf)

I am ALL thrilled to be able to use transistors, in particular a common 2N2222 would be fantastic! But, seeing the datasheet, it has a 'rise time' of 25ns and a 'fall time' of 60ns. I do not know exactly what that means in my situation, is that 'switching speed'? What is the highest frequency a 2N2222 can go?

Thank you.

Chad
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: Voltage and Current

Post by SamCoVT »

sburrow wrote:
Sure!

Here is my falstad.com link, for the white output using only resistors:

http://falstad.com/circuit/circuitjs.ht ... irUc4yS2EA
That simulation is helpful as it shows the resistor values (470 Ohms series resistor on each line). In that simulation, I see the TOTAL current from the 5V supply in your simple simulation is about 25mA, however the 74HC166 will only be driving one of the three paths (eg. you will need one '166 for PIX1, another for PIX2, and a third for PALLETE (unless you want to use something simpler like a latch to control the pallete). In your simulation, you can see there is only 9.2mA going down a particular branch, and that's what the '166 will be sourcing for current (probably a tiny bit less, if you were to measure). That is comfortably within the limits of the part.

For your dioded version, having values on your schematic (even if you aren't sure if they are right) will allow a more thorough analysis. It looks like PIX1 and PIX2 will have to source a bit more current if PALLETE is low, but you should be looking at the branch currents rather than the total from the supply because that's what the IC driving that line will have to source (or sink, in the case of PALLETE with the diodes).
-SamCoVT
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Voltage and Current

Post by sburrow »

SamCoVT wrote:
That simulation is helpful as it shows the resistor values (470 Ohms series resistor on each line). In that simulation, I see the TOTAL current from the 5V supply in your simple simulation is about 25mA, however the 74HC166 will only be driving one of the three paths (eg. you will need one '166 for PIX1, another for PIX2, and a third for PALLETE (unless you want to use something simpler like a latch to control the pallete).
Actually that particular simulation is using a single '166 for all three lines. On my current board, I have the monochrome display setup like falstad is set up there. BUT, as you are looking ahead, yes, the PIX1 and PIX2 will be driven individually, along with PALETTE. Correct.
Quote:
In your simulation, you can see there is only 9.2mA going down a particular branch, and that's what the '166 will be sourcing for current (probably a tiny bit less, if you were to measure). That is comfortably within the limits of the part.

For your dioded version, having values on your schematic (even if you aren't sure if they are right) will allow a more thorough analysis. It looks like PIX1 and PIX2 will have to source a bit more current if PALLETE is low, but you should be looking at the branch currents rather than the total from the supply because that's what the IC driving that line will have to source (or sink, in the case of PALLETE with the diodes).
-SamCoVT
Exactly, I remember seeing a lot of load going through PIX1 and PIX2 when PALETTE was grounded. Like, 40mA was going through the system, and it was coming all from a pair of '166s. But when only one PIX is high and the other low, that 40mA has got to come from a single '166 which is just too much!

I can redo the falstad simulation for the diodes, but I really like BillO's suggestion to use transistors. I was looking online and some folks are saying the 2N2222 will go like 500 MHz or something crazy. Still, I didn't see that in the datasheet (though I don't think I looked terribly well either).

Thank you Sam!

Chad
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Voltage and Current

Post by sburrow »

Here is the link to the diode version in falstad.

http://falstad.com/circuit/circuitjs.ht ... vi3uxBWFAA

I turned off PIX2 and PALETTE, so that makes PIX1 needing to drive 45mA! I can adjust the resistor values some to minimize this, but then that affects my intended colors which I'm hoping to not do.

Chad
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Voltage and Current

Post by BillO »

Those rise and fall times are ~ 0V-30V. If you just going 0V-1V the rise and fall times are going to be much quicker. It should do fairly well at 26MHz driving the base @ ~15mA.

Let me do a test and get back to you.
Bill
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Voltage and Current

Post by sburrow »

BillO wrote:
Those rise and fall times are ~ 0V-30V. If you just going 0V-1V the rise and fall times are going to be much quicker. It should do fairly well at 26MHz driving the base @ ~15mA.

Let me do a test and get back to you.
I would *like* to use it for 5V signals if possible, but I'll take anything!

Thank you!

Chad

EDIT: Here (https://www.etechnophiles.com/2n2222-tr ... ent-specs/) it says that the operating frequency is 250 MHz. I just don't understand why the datasheet would have those values? I feel like I'm missing something in one way or another.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Voltage and Current

Post by GARTHWILSON »

sburrow wrote:
EDIT: Here (https://www.etechnophiles.com/2n2222-tr ... ent-specs/) it says that the operating frequency is 250 MHz.
The fT is basically the frequency at which the current gain would drop to 1, meaning it's pretty useless, like the gain-bandwidth product of an op amp. Several other things go into whether the transistor's gain will be adequate at a given frequency for a given application.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Voltage and Current

Post by BillO »

Well, here it is and it's not very promising.

This trace is using the 2N2222. The input signal (yellow) is 27MHz @ 5V p-p and the output is 2.5v p-p into 47 ohms. Base is being driven through 360 ohms.
MAP001.png
MAP001.png (9.44 KiB) Viewed 2026 times


This trace is using a 2N3904. A tad better with an output of 3V p-p.
MAP002.png
MAP002.png (9.55 KiB) Viewed 2026 times

A better transistor will be needed to get closer to your goal.
Bill
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Voltage and Current

Post by GARTHWILSON »

What's the transistor circuit? And wouldn't it need to do a squarish wave at 25MHz, meaning there will be frequency components ten times as high? It looks like it's about 55° behind at 25MHz.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Voltage and Current

Post by sburrow »

BillO wrote:
Well, here it is and it's not very promising.

This trace is using the 2N2222. The input signal (yellow) is 27MHz @ 5V p-p and the output is 2.5v p-p into 47 ohms. Base is being driven through 360 ohms.
MAP001.png


This trace is using a 2N3904. A tad better with an output of 3V p-p.
MAP002.png

A better transistor will be needed to get closer to your goal.
I honestly don't know how to read that properly. To me, it seems like it's delayed by 5ns with both of them. So I throw an 25 MHz signal into it, it has a propagation delay of 5ns, and so my color signal is delayed 5ns behind what I previously would have had. Monitors are flexible in where the 'start' and 'end' are, so if I started 5ns behind, it would actually think that is where I am starting!

But if you are saying there would be signal loss at 25 MHz, then indeed I would need a better transistor. I am sure I can handle delay, but I cannot handle signal loss.

@Garth: Yes, square wave. So are you saying it could only operate at 2.5 MHz with a square wave?

Chad
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Voltage and Current

Post by BillO »

GARTHWILSON wrote:
What's the transistor circuit? And wouldn't it need to do a squarish wave at 25MHz, meaning there will be frequency components ten times as high? It looks like it's about 55° behind at 25MHz.
Just an emitter follower. Driving the base through a 360ohm resistor with a 47ohm resistor as the load connected from the emitter to ground and the collector tied to 5V. My WFG sucks. That's the best square wave it can do at 27MHz. Someday I'll have $1000 for a decent one.

However, I did try running the signal through a 74HCT14 too, but the result was no better (worse, actually). So I'm not sure his 74HCT166 is producing perfect square waves either.

The 6ns delay is in line with the spec sheet for the 2N2222. It quotes a max delay of 10ns.
Bill
Post Reply