A realistic way of driving LEDs.

One concept which has existed for some time is, that LEDs can produce a variable amount of light, and this will be the case, regardless of whether that amount of light needs to be constant, modulated slowly, or modulated at very high frequencies. But, LEDs have as a property which many other components do not have, that they tend to produce a fairly constant, forward voltage drop (like any diode), but that, as the voltage increases only slightly past a certain point, current increases rapidly. And, in the History of Electronics, this has often caused circuit designers to put a resistor in series with the LED, to regulate its current accurately.

One big drawback of doing this is, that power gets wasted, as current flows through the resistor, and gets transformed into heat. The amount of power that gets wasted in that way, most strongly depends on what fraction of the supply voltage appears across the resistor, instead of across the LED. Another drawback is the fact, that the current which flows through a resistor, which has simply been connected between a supply voltage and an unpredictable component – such as the LED – is itself not constant, And, when supply voltages are low – such as 5V – small changes in supply voltage are large, in comparison to the only slightly smaller voltage-drop across the resistor. And so, technology does offer as alternative, a chip, with active components to regulate the current more precisely, and often, while wasting less energy. In principle, such a chip can also be installed by the manufacturer of LEDs, into the same package as the LED.

According to the schematic below, I have demonstrated such a circuit…

 

IMult_LED_1

 

What is happening here is, that A presumed control current is fed in to a presumed input pin, and this circuit actually doubles that current, resulting in an amount of current which will be drawn from the cathode of the LED. Additionally, more than one LED could be connected in series, to the current-sink.

Continue reading A realistic way of driving LEDs.

Inserting coupled inductors into NG-Spice’s netlists graphically.

I have spent quite a few postings, describing how the Open-Source circuit simulation programs “NG-Spice”, belonging to the “gEDA” suite, can be used. And one of the facts about them which I’ve recognized, is that they essentially come as three programs: The (non-GUI) engine which simulates Netlists; ‘gschem’, a graphical program which allows schematics and custom symbols to be edited; a third (GUI-based) program, ‘GSpiceUI’, that can import the schematic and export the netlist of a simulation to be run, as well as run the simulations.

What the first two programs do, isn’t always well-matched. ‘gschem’ can create schematics, with no regard for the fact that the Spice engine can’t simulate all the components.

But, One capability which NG-Spice has at the level of Netlists is, to simulate “coupled inductors”, which are denoted by a ‘RefDes’ which begins with the letter ‘K’.

Why is this potentially useful? Because, if the user simply puts the standard, library transformer, what NG-Spice will simulate, is a perfect transformer, which behaves as well at 60Hz, as it does at 60MHz. The user would have no way to specify any of that transformer’s parameters, then. It’s often more useful to simulate components, with built-in parasitic flaws, such as, coupling constants that are 0.99 or 0.9 instead of 1.0…

It would be nice, just to be able to drop such a coupling into a ‘gschem’ schematic, and have ‘GSpiceUI’ create its simulation ‘the easy way, via the GUI’.

Well, that can be prepared. And, the way to prepare it is, using ‘gschem’ in order to define a custom symbol…

 

coupled-inductors-1

 

(Updated 6/09/2021, 16h35… )

Continue reading Inserting coupled inductors into NG-Spice’s netlists graphically.

Simulating Lossy or Custom Transmission Lines, using NG-Spice.

One of the fun things that can be done using the Open-Source circuit-simulator ‘NG-Spice’ is, that transmission lines can be simulated, with the parameters ‘Z0′ and ‘TD’, which stand for the characteristic impedance, and the delay down the length of the transmission line. However, what some people have noticed, and recorded as a bug, elsewhere on the Web, is, that such transmission lines will appear to have ideal behaviour right down to ‘DC frequencies’.

Rather than to think of this as a bug, I’d categorize this as the behaviour, that if the ‘RefDes’ of the transmission line begins with the letter ‘T’, NG-Spice will always simulate a lossless transmission line.

What some people might prefer is, to simulate a lossy transmission line. And When using NG-Spice, this capability is available, but hidden. Basically, NG-Spice uses the same simulation engine, to simulate the Netlists, that other versions of Spice will use. But, the Open-Source version will be lacking in GUI support, as well as in the available libraries of components.

The key to understanding, how to simulate a lossy transmission line, is, that NG-Spice will only process them as being a different type of component, if their reference descriptor begins with the letter ‘O’. This is similar to how NG-Spice will require that the ‘RefDes’ begin with the letter ‘X’, if what is to be simulated, is some sort of sub-circuit. But, because this will stem from a modelcard, the model of the transmission line will actually need to be specified within the Schematic Editor, as the Value of the component, for which there also needs to be a Model entry in the schematic, that points to the file, which will define the model. This Model entry will have a reference descriptor, beginning with the letter ‘A’…

(Updated 6/07/2021, 2h25… )

Continue reading Simulating Lossy or Custom Transmission Lines, using NG-Spice.

Variable-gain amplifier, with good frequency response including 4MHz.

In an earlier posting, I had described a variable-gain amplifier that could be etched into a monolithic IC. But, that circuit had as its main drawback, that it would only seem to work well at a centre-frequency of ~500kHz, while most circuit designs expect Megahertz frequencies, when working in the analog domain.

The diagrams in this posting have been tested using the open-source simulation software named ‘NG-Spice’.

In order to achieve Megahertz frequency response, I needed to discover a little trick, which professional circuit designers – aka Electrical Engineers – probably already know. What the previous circuit had done, was to set (R4) to 32kΩ, while setting (R1) to 40kΩ. The reason I had done this was, the old-fashioned idea that the pull-up resistor of the amp should bisect the supply voltage, with the main transistor in series, in order to achieve maximum gain. Yet, the bias voltages were more likely to be in the vicinity of 1.8V. Thus, (R4) would bias (M2) to conduct a certain amount of current, and because both (M1) and (M4) are in saturation mode, they will both conduct the same amount of bias current between their Source and Drain, due to the resulting bias voltage at both Gates. Yet, that amount of current would cause a 1.5V voltage-drop through (R1), while causing a 1.2V voltage-drop through (R4).

Hence, with 2 voltage-levels, it was necessary to put a coupling capacitor, which in turn is a hassle on an IC.

The trick seems to be, that (R1) and (R4) can be set to the same value, so that the DC component of the Drain voltage, will equal the bias voltage. That way, as many circuits as needed can just be chained, with equal bias voltages, and No Coupling Capacitors. The bias voltage I now obtain, is (1.857V).

Additionally, I retuned the circuit, by reducing the width of (M1) and (M2) from 100μM to 25μM, which in turn reduces Drain-to-Gate capacitance, which in turn would hinder good, high-frequency response. (M4) now also has a width of 25μM, so that it can be biased in a matching way.

Yet, with the transistors so small, the output would need to be protected by that additional transistor (M4), so that to connect minor loads to it will not collapse the functioning of the main stage.

The result was, that with a control voltage of (2.0V) and a frequency of 4MHz, a gain of almost +40dB was obtained, while with a control voltage of (0.0V), a signal drop, and indeed inversion of the phase was obtained, because (M3) just bypassed (M1).

The following is the Netlist of the (2.0V) simulation:

http://dirkmittler.homeip.net/text/Default_NM_Gain_IF_13.net.txt

And these are the Modelcards of the transistors used:

http://dirkmittler.homeip.net/text/NMOS2.mod.txt

http://dirkmittler.homeip.net/text/PMOS2.mod.txt

 

This is an image of the schematic:

 

Default_NM_Gain_IF_13

 

(Updated 5/29/2021, 12h15… )

Continue reading Variable-gain amplifier, with good frequency response including 4MHz.