Spyke
ece·Electrical and Computer Engineeringbydragontamer

Circuit Discussion: +0.01V with a Wildar+Peaking current mirror and an OpAmp

I have difficulty in imagining the ideal audience for this discussion. An absolute beginner might not know how to use OpAmps yet, while a more advanced electronic engineer will probably find this post too elementary for them.

Nonetheless, I set off with the goal of adding 0.01V to a part of my circuit, and have decided that this particular configuration is ideal. So I'll discuss my reasoning and hopefully other engineers here can comment.

Motivation

I'm configuring a constant current sink (0mA through 500mA) when I started to calculate some "worst case errors". Lets assume the input is varying somewhere between 1V to 5V, and I'd like to program a DAC + Constant Current to subtract a (configurable) voltage off of the input.

For the beginners: the OpAmp sets the voltage at R1 very accurately to the DAC_Output voltage. Because R1 is connected to Ground, this means we very accurately control the current flowing down through R1 (with the NMOS in voltage-follower configuration, the voltage at the source follows the voltage at the gate).

Because R2 is connected on this circuit, the current configured at R1 is innately the same as the current flowing through R2. And now we have an accurate subtraction operation configured with the DAC

Looks straightforward, except for one thing. OpAmps like the MCP6006 have an unpredictable Voffset of 0.003V. Across my circuit, there's three OpAmps this calculation goes through, so I'd like to add 0.009V (aka: three times the Voffset) so that I have enough "wiggleroom" for the DAC to trim-away all possible errors.

Adjustment Circuit

I did switch to MINDI as Microchip's MCP6006 OpAmp is only accurately simulated in MINDI.

As the title implies, its just a combination Wildar+Peaking current mirror to generate a constant current, and then an OpAmp to subtract 0.01V from the feedback (which causes the output to "negate" and become +0.01V).

Basic Current Mirrors

https://wiki.analog.com/university/courses/electronics/text/chapter-11

Analog.com has a great wiki which goes over the Wildar + Peaking current mirror. Although they call it the "Stabilized Current Source".

The original current mirror is as follows:

A matched-pair BJT serves as the basis. (such as the BCM847B by diotec, diodes or many other manufacturers. The "M" is important with guaranteed matching specs). The left transistor converts a current into a voltage... specifically the exact voltage that is associated to the current.

Ex: 500uA current probably turns into 0.53V or so, it all depends on temperature and manufacturing, and Beta... but guess what? The two transistors are guaranteed to match (within 0.002V base offset, and within 10% Beta).

So when you take this voltage from the left transistor, and apply it to the right transistor, the right transistor now "copies" or "mirrors" the current. IE: the right transistor converts 0.53V (or whatever it was) back into 500uA or so.

This switching from Current input -> Voltage in the middle -> Current output is possible only because BCM847B has guaranteed matching specs. Alternatively, you can manually search through a pile of transistors for matching Vbe and/or Hfe/Beta (and in the 80s, people would manually measure and search for matching specs out of a box).

Peaking Current

Ah, but I don't have a basic current mirror in my circuit, do I?

This here is the "Peaking Current Mirror". Analog.com's wiki has a reasonable explanation, but this other article has a better explanation that worked for me: https://www.edn.com/peaking-current-source-has-high-rejection/

The conversion from Current -> Voltage is far more complex with the "peaking" circuit. The gist is that the additional resistor (R2 in this case) serves as negative feedback against VCC. As VCC increases, Q1 will pull pull Vce down, towards 0V (ground). And as VCC decreases, that also pulls Vce down towards 0V (because VCC going down is uhhh... just voltage dropping).

These two dropping effects create a "peak" at exactly Vcb == 0.026 Volts (assuming room temperature of 25C). I've configured the 10k resistor and 59 ohm resistor such that this peak occurs around 5V-input, the operating point of my circuit.

Now why do this? Well, this makes Q1's output voltage more independent of VCC. Or in other words, this "creates" Power-supply rejection. If VCC has noise or other regulation issues, this creates a "Zero-gain amplifier" effect where changes to VCC "refuse" to propagate down to the rest of my circuit... or at least are mitigated slightly at this juncture.

For example: a classic current mirror would output 50% more current as VCC moves from 4V to 6V. However, in this improved "peaking" circuit, the circuit barely changes between 4V and 6V.

Green is a traditional current mirror between 4V and 6V. Notice how its exactly proportional to the input voltage!!

Red is the "peaking" current mirror between 4V and 6V. By using negative-feedback to force the Vcb voltage down (as VCC goes up), the red line is far more stable against changes to VCC. In the EDN article, they run the current through TWO of these "peaking" circuits to double up on the stability. But one-layer of stability is likely sufficient for my purposes.

Wildar Current Source

Wildar is the legendary electrical engineer who designed the 741 OpAmp. As it turns out, Wildar's primary "move", the addition of one more resistor on the emitter, is compatible with the "Peaking" current source from before.

So why not combine the two techniques?

https://en.wikipedia.org/wiki/Widlar_current_source

The Wildar Current Source has numerous advantages. The main tidbit is that it helps negate the Early Voltage in BJTs (making our current-output more resilient against changes in output voltage).

Note the scale. All of this graph is zoomed in between 9uA and 10.5uA. So the "original" current mirror is still quite good at current regulation (only a 10% difference of current despite the voltage swinging from 0 through 10 volts).

However, we can improve upon this current regulation dramatically by adding the resistor turning us into a Wildar Current Source. The regulation tightens much more, with a minimum 9.78uA current to 10.03uA (only a 2.5% swing). This is because the emitter-resistor is hampering the "Early Effect" (discovered by Dr. Early), which kinda-sorta makes the BJT look like a non-ideal current source.

Note: a Wilson current mirror would work even better, but that requires 1.2V minimum. My circuit actually goes down to 0.9V, which is much too low for the Wilson current mirror.

Wildar Current sources also have additional benefits that aren't too relevant. First they require much smaller resistors, which is a benefit in ICs like the 741 OpAmp (even today large resistors are difficult to build on modern IC processes. Small resistors are just easier to make more consistent). Wildar Current Mirrors also don't need as tight matching between Beta/Hfe or Vbe between the two transistors. The resistors help stabilize the circuit vs changing manufacturing tolerances of the transistors. Finally, the Wildar Current Source actually makes the "peaking" circuit better at rejecting input voltage swings... a bit of unexpected synergy between these two designs!

Questions? Comments?

Its a bit of a stream of consciousness but I hope you all enjoyed this breakdown. Please let me know if I forgot something or if something is unclear.

All in all, a relatively high quality constant current sink can be implemented with just three resistors and one matched-pair BJT, for a total of 5 components on your PCB. Or alternatively, you flip it all around and use PNP Transistors to create a constant current source. Hopefully you analog engineers out there can use this technique to build something cool.

Voltage regulators are commonly solved with dedicated ICs today. But current sources are actually quite easy to make yourself out of just a few resistors and a matched-pair transistor.

The standard current mirror is much easier to think about (configured with basically a singular resistor, or even with "nothing" if you have a signal already in the form of some kind of current-output). However, the "peaking" circuit improves input voltage rejection with only one additional resistor, while the "Wildar" circuit improves output impedance with another additional resistor.

The downside is ... you need to do far more math and simulations to "set" the output current correctly. A lot more math (the emitter resistor on the output transistor has a logarithm relationship to the input... and the two input resistors to the peaking circuit have non-intuitive calculations). But anyone going into this hobby is probably not afraid of a few logarithms or math subjects, right?

View original on lemmy.world
4
ece·Electrical and Computer Engineeringbyza_warudo_steve_freiheit

Analyzing USB

How do people use an oscilloscope to analyze USB packets and such? I saw a video by Ben Eater and the way he did it was by exposing the necessary wires of a USB cable and probing those. Is this standard or are there types out there that have this functionally built-in as some accessory or something?

Edit: logic analyzers are pretty interesting

View original on lemmy.world
10
ece·Electrical and Computer EngineeringbyA_norny_mousse

[Old laptop][Help] Portégé R600 will not accept additional memory module.

I was gifted this ~2010 Toshiba Portégé. Surprisingly small and thin for its age. I was hoping to revive it, but it has only 1GB of memory ootb.

Apparently it can be upgraded up to 5GB with one spare slot that currently sits empty.

I found 2 physically compatible identical 2GB modules but no matter which one I plug in, when I start the computer it just starts the fan on highest setting and nothing else happens.

Before I go into any more detail, I found this info online:

The Toshiba Portege R600 Laptop takes the PC2-6400 DDR2-800 200pin SDRAM SODIMM memory type

My sticks look like this:

Are they compatible to PC2-6400 DDR2-800 200pin SDRAM SODIMM? I honestly can't tell.


I read the manual which says the modules need to be "Toshiba approved" but it does not say which/what Toshiba approves.

Plus this, which I did follow (note the negative):

Do not try to install or remove a memory module under the following conditions.

a. The computer is turned on.
b. The computer was shut down in either Sleep or Hibernation Mode.
c. Wake-up on LAN is enabled.
d. Wake-up on Wireless LAN is enabled.
e. The wireless communication switch is turned on.

And this does not happen:

If you install a memory module that is not compatible with the computer, the Power indicator will flash (on for 0.5 seconds, off for 0.5 seconds) in the following way;
■ If there is an error: repeatedly flashes orange twice, then white or green once

The power indicator ⏻ stays white all the time and does not blink.


TIA

View original on piefed.zip
6
ece·Electrical and Computer Engineeringbyinquanto

Can someone explain why this wouldnt work

So i have these Rode Wireless Microphones at Work that you connect to your phone with a USB-C cable. Thing is the cable they ship with is absolute trash and breaks after about 3 uses. So i got the idea to try and build a 3d printed thingie with a protruding usb-c port that you could slide onto your phone sort of like the old iphone music docks. Then on the back you could slide in the rode receiver, thus eliminating any cable twisting. I thought this would be easiest if i had the pictured usb-c breakouts, because they have mounting holes that i could fix firmly into the 3d printed part. I picked a 24 pin version thinking this would cover all the necessary usb-c specs to get at least something like a usb 3.0 connection as I don't think the rode mics need super high data transfer or power delivery above 5v. Alas the pictured "cable" didn't do the trick and the mic wasn't recognized by the phone. So I'm wondering would it even be possible to build something like this with breakouts or am I missing things. Do usb-c cables usually have chips that negotiate voltage and transfer specs between devices? Am i missing shielding, or is my wire gauge totally off?

I can probably still build a mic holder thingy using a short premade silicone cable, but I'm still curious if this setup could work in theory or if there are other breakouts that could make this work.

Thanks for your help!

View original on lemmy.world
32
ece·Electrical and Computer Engineeringbydragontamer

Microchip June 2026: Released a new 8-bit AVR LA line

AVR is one of my favorite chips as a hobbyist. 8-bits, manuals in the less than 500 pages region (very small compared to Cortex-M0+ which are closer to the 1000 or 2000 page long regions if we include instruction sets and other details), etc. etc. So I'm happy to see Microchip continue to support simpler 8-bit chips for those who need them.

For those looking to use this chip exactly: it seems like AVR LA specializes in low-cost, low-power, and capacitive touch. Most components have been stripped out, the ADC is only 10-bits, there's no more dual power supply (like AVR DD, DB, or DA), there's no special features like op-amps (AVR DB), or programmable gain differential ADCs (like AVR EA or EB).

You do get event system, CCLs (AVR's feature of LUTs, functioning as useful "glue logic" that can implement a few simple XOR, AND, OR, NOT gates for those who need simple glue), RTC, and PTC (aka: Peripheral Touch Controller, Microchip's system of building capacitive touch).

At 1.62V minimum (and up to 5.5V maximum), this is seemingly the lowest voltage I've seen from AVR lines. For anyone with a buck or boost converter in their designs, this should lower power usage a fair bit over the 1.8V previous minimums.

Finally, the 5k unit pricing is around 50-cents or so. This is the cheapest AVR 8-bit you can buy, if anyone were doing a large scale mass manufacturing line. But for most hobbyistss, I don't believe we can sufficiently tell the difference between 50c chips and $2.00 chips.

So its very barebones outside of capacitive touch. Still, this shows a commitment from Microchip to continue to support AVR chips and their ecosystem. I would recommend beginners use the AVR DB instead (which come with 3x OpAmps and far more features), unless you really want a barebones capacitive touch controller.

https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/Brochures/AVR-LA-Family-DS00006246.pdfOpen linkView original on lemmy.world
7
ece·Electrical and Computer Engineeringbydurinn

What my whole life feels like

I ordered a MiniTools test clip to start experimenting with flashing EEPROMs. There was no information on the retailer's website regarding the width of the pins. This is what I got:

I asked MiniTools if they have any solution to this. They said "no". I then realized that this clip was probably meant for soldering. Which I haven't had the energy to learn yet.

I ended up buying the expensive Pomodo one.

The flashing went well.

View original on programming.dev
10
ece·Electrical and Computer Engineeringbydurinn
2