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?
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.