There are two things to consider in trying to match the light output of multiple LEDs
- Controlling the current thru each LED.
- Compensating for light output variances between LEDs even when driven with the same current.
The first is not that hard to guarantee electrically. The brute force way to ensure the same current thru all LEDs is to put them in series. That will require the highest drive voltage, but the currents will be equal.
It is not clear if you also care about variations in light intensity between LEDs driven at the same current. If so, it gets trickier because these variations by their very nature are device by device and can not be known other than by explicit testing.
The first order answer is to simply string the LEDs in series with a resistor, using a high enough voltage source.
The second order answer is to do the same thing but specifically buy matched LEDs, or buy a large quantity and find matched ones yourself. LED manufacturers routinely measure the light output of individual LEDs and "bin" them according to brightness. Buying a set of LEDs binned to the same brightness is more tricky, and may require working with your distributor or directly with the LED manufacturer if the volumes are high enough.
The third order answer is to trim the light output of each LED separately. To do this you will need some means to measure the light from individual LEDs, and to adjust the current thru individual LEDs. This is obviously the most complicated approach and requires the most parts, but produces the best match.
There are various ways to trim the light output of each LED. Which one is appropriate depends a lot on parameters you haven't given us, like the number of LEDs and and how close "close" is. Also, how automated must the trimming process be? Is this something a technician can do laboriously once, or must it be easy to do by unskilled people at unforseen times?
Added:
We finally have a spec that says the light output of each LED can vary up to 5% of nominal. That is quite tight. A human wouldn't be able to see a 5% difference in intensity even when the two LEDs are viewed side by side. This is therefore tighter than I think you can get by buying binned LEDs. I may be wrong, so check with some distributors or manufacturers. However, I'll proceed here assuming you can't buy LEDs this close to each other in brightness, and therefore individual trimming is required.
You didn't say what kind of LED you will be using or a link to a datasheet, so I'll do this example for ordinary green LEDs with a maximum sustained current of 20 mA and a forward drop of 2.1 V. The same topology will work for other currents and forward drops, but of course will require different values in the circuit.
Here is a circuit per LED that should allow you to get what you want:
The "3.3V" supply is intended to be well regulated and is used as a voltage reference. The 5V supply does not need to be very accurate, and significant ripple can even be tolerated. The easy way to get both these is to go out and buy a 5 V supply, then use a linear regulator to make the 3.3 V from it.
This circuit works by using the bipolar transistor as a current sink. It is exploiting the fact that the collector current varies little as a function of collector voltage as long as that collector voltage is above some minimum, like 1 volt or so. The base voltage is adjusted by the R4-R3-R2 divider chain to keep about 1 volt accross R1, which keeps the LED current close to 20 mA.
With 1 V on R1, the collector should be at least 2 V to keep the transistor regulating the current nicely. In this example the LED drops 2.1 V, so the minimum the "5V" supply can be is 4.1 V. Higher voltages will work too, but cause increased dissipation. Any off the shelf regulated 5 V supply should work fine here. Since you want to support up to 22 LEDs and each will draw 20 mA, the supply must be able to source 440 mA for the LEDs alone. Leaving room for another 2 mA per LED for the control circuitry, the current requirement is close to 1/2 A. A 5 V 1 A supply can therefore easily do this. Fortunately those are cheap and available.
To trim this, turn down all the R3 pots to their minimum end (wiper is effectively between R3 and R2), then apply power. Use a voltmeter to adjust each R3 so that the corresponding R1 has 940 mV accross it. This step guarantees that none of the LEDs are overdriven, but all are close to their upper limit. Now go around and measure the light output of each LED to find the dimmest one. Then adjust R3 of all the remaining LEDs to match that light output.
One way to measure relative light output would be with a CdS photoresistor in a Wheatstone bridge driving a voltmeter. If you put a small pot in the bridge, you can trim it for null output from the dimmest LED, then adjust the others to get that null output. In any case, there are various ways to measure light, so getting into that more is a side issue to this question.
Given the vastly changed info... TDA2822 is a low power chip (under a 1W; its datasheet recommends it for "portable cassette players"), and of course the speaker it sends to is only 2.5W (doesn't get that much). Basically you can take the output of this amp (from the speakers' wires) straight to any professional line in audio equipment. It's like plugging in a walkman. No divider or anything like that is needed. Professional equipment accepts "hotter" signals than the consumer ones; see line level. Check with a voltmeter just in case that you don't get way over (say no more than 2V RMS on whatever it blasts the loudest), but there's not much else to do.
Also the quality of the PCB isn't great... but do you want NASA standards in toy using a $0.10 chip? The last image are "mouse bites", but those are normal.
Regarding the power supply info (added in a comment): 7.5V is how they get this chip to make enough sound for a loudspeaker. Likely the TDA2822 output doesn't get to the rails (i.e. it's less than 7.5V peak); most amps can't swing all the way to the rails, typically they can go up to 1V or 2V under. Some of the more dinky mixing consoles I've seen the innards of have only 6.3V rated caps on inputs; that mixing console was powered from 6V. So... there's potential danger of damaging a mixing console over a long period of time if this toy outputs to its max volume; we're not talking about immediate fireworks. If the mixing console is powered by more than 6V supply chances are good it uses higher-rated caps on inputs so the danger of damage becomes practically nil. If the mixing console is a profi one it will have maximum input level somewhere in its (service) manual. For example, a TASCAM I have specifies maximum input level as +18dBv (8 V).
Best Answer
I think any engineering design is handled top-down when you really look at the design process. This is not limited to digital electronics or even electronics at all.
Design of analog circuits is no different. You start out with what a circuit needs to do, then you come up with a overall strategy to solve the problem, then keep on drilling down until you get to whatever low level details your kind of design requires. For every engineering design I can think of, there are additional levels of abstraction both above and below the design. Again, analog electronics design is not different in that regard than any other engineering discipline. The same general process and existance of multiple levels of abstraction applies whether you are designing a audio amplifier, digital computer interface, the front wheel suspension of a car, or the cooling system of a nuclear power plant.
Let's use the design of a audio amplifier as a example. Higher levels above the design come to you as specifications. There is some limit above which you don't get to make choices (perform engineering design). The need may be to drive a small speaker so that someone within proximity can hear voice, like something built into a automated teller machine at a bank, or a gas pump. If you work for the ATM company, then you don't get to decide you want this to be a 300 W HiFi audio system for a theater.
Often determining the true requirements is part of doing a design. The company has decided to put a speaker in the new ATM so that it can issue voice prompts. They haven't said how many watts must go into what kind of speaker. This is your job to figure out. On the other hand, where the voice signal comes from may have already been determined and you don't get any wiggle room. All you can do is make sure that interface is clearly documented.
Once you have the requirements well decided and documented, you sit back and think of various high level ways to solve the problem. Pretty quickly, you'll narrow this down to a few alternatives, like getting a off the shelf class-D audio chip, a whole module that pretty much does everything between the source signal and the speaker, or something you design from lower level building blocks.
Good engineers don't just take the requirements at face value if they see something that might possibly be a small change externally but that could be a bigger advantage to their design. For example, you might prefer the audio came at you as digital words over SPI or something, but it is specified as line level analog. You go to the engineer that designed the circuit that produces the line level output. Perhaps you find that he actually has digital audio and is running that into a D/A because he figured that's whatever is downstream would want. Feeding digital audio to you not only saves money in his design, but also in yours.
This sort of looking at the bigger picture one or two levels up and trying to do the best for the overall system is all too rare nowadays. This is something the chief engineer of the project should be looking into too, but chief engineers are rare nowadays too. Often you get a project manager with little engineering skill, with nobody really coordinating the engineering effort between disciplines or subsystems.
Anyway, after you look at a few alternatives, you pick one going forwards. Let's say you decided that the does-all module is too expensive for the volume of this product. Your own discrete solution would work, but take more board space than it should, especially since it would be inefficient power-wise and dealing with the heat in the cramped space you have would be a real problem. So you go with the class D audio chip, except that none of the ones for the required power level can work directly with the power supplies you have available.
Now you have decomposed the overall amplifier into some power supply conversion, and the class D chip. Each of those will have details, etc. Eventually you get to a schematic of parts you can buy and put on a circuit board.
That may be the end of your design, but of course there are many levels below that. You're going to lay out the board, but you're not going to design the details of the physical board yourself and the process that will be used to make it. You specify holes and traces, and someone else makes sure that milling, drilling, plating, etc, all happen according to your spec. You buy a class D amplifier chip, but there is obviously significant design inside that block. If this is a super high volume product, then you might design a chip with a class D amplifier being just a part of it. Even then, someone else will design the silicon fabrication process so that you can simply talk in terms of transistors instead of masks and interconnects and doping levels and the like.
I don't see anything different here just because the design happens to be a analog circuit.