9v Block Controlled charger

Hi, As a guitarist i have a few instruments that have pre-amps / tuners built in which are powered with 9v Blocks. Now i don't like to use non-rechargeable batteries if it a be avoided, but the chargers for 9v Block are usually not to good. Actually the 9v rechargeable batteries are not to good as a rule, but this is more as a result of them being 7 cells put together in series, which then can not be individually charged, and that tends to shorten the lifespan of these units. Anyway, the better the charger the longer the battery lasts, but when i look online for a simple charging circuit all i find is just to put a (variable-)resistor in series and maybe use a timer for auto-shut down as to not to overcharge the battery.
So i thought to use microprocessor to do it properly. (probably eventually an ATtiny, but let's say an UNO for now) And rather than using a variable resistor, just use a transistor instead. 9v blocks have an internal resistance which increases quite substantially as they are being charged, but they require and can handle only very small charging current. Rule of thumb about 10% of the total capacity (ok i mean you should charge them for about 10 hrs to fill them)
Now if i am going to drive a transistor with PWM it is just going to to an ON/OFF with duty cycle unless i filter it a tad, so so far i got to this :9v PWM Charger.JPG

and with my cheap-as oscilloscope i find that the ripple is almost gone at the collector of the transistor and i can vary the current sufficiently to modify the brightness of a LED (and 1K resistor) when i just do an analogRead of a potmeter and send the result as PWM to a pin.

#define OUTPIN 9
#define INPIN A0

void setup() {
  pinMode(OUTPIN, OUTPUT);
  pinMode(INPIN, INPUT);

void loop() {
  uint16_t analog = analogRead(INPIN) >> 2;
  analogWrite(OUTPIN, analog);

Now of course what i really want is to just measure the current, but somehow it doesn't need to be all that accurate, so i figure i could also just measure the voltage between GND and the Emitter of the transistor (across the 10 Ohms resistor) and create a current meter like that (not a very good one with 10 Ohms resistance but it is one)
Could you guys have a look ? am i missing something ?
Am i doing it completely the wrong way (probably !?)

9v PWM Charger.JPG

If the charge current is fixed you don't really need pwm to control the current. You could use a "current limiter", "current sink", or "current source". Just google for these terms.

You also have a tutorial pretty well explained here: https://youtu.be/xR0RfmmRhDw