RGB Strip not smooth transistions

Hi.
I have got RGB Strip connected to Arduino Leonardo with TIP31C transistors like here. I want to get nice, smooth transistions beetween colors. I am using this code:

const int redPin = 8;
const int greenPin = 9;
const int bluePin = 10;

void setup() {
  // Start off with the LED off.
  setColourRgb(0,0,0);
}

void loop() {
  unsigned int rgbColour[3];

  // Start off with red.
  rgbColour[0] = 255;
  rgbColour[1] = 0;
  rgbColour[2] = 0;  

  // Choose the colours to increment and decrement.
  for (int decColour = 0; decColour < 3; decColour += 1) {
    int incColour = decColour == 2 ? 0 : decColour + 1;

    // cross-fade the two colours.
    for(int i = 0; i < 255; i += 1) {
      rgbColour[decColour] -= 1;
      rgbColour[incColour] += 1;
      
      setColourRgb(rgbColour[0], rgbColour[1], rgbColour[2]);
      delay(25);
    }
  }
}

void setColourRgb(unsigned int red, unsigned int green, unsigned int blue) {
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);
 }

Unfortunately, transistions aren't smooth. For example fade from blue to pink is "digital" and quick. I tried many codes but it didn't help. I also tried to use MOSFETs IRF510 or NPN BC47B transistors instead of TIP31 - without success.
Why it is not working the way I want to?

Here is my video: LED RGB Bad Color Tranistions - YouTube

Your diagram shows NO base current limiting resistors.
Just 10k resistors to ground.
No base resistors will fry your Arduino pins.

The TIP31 is a bad choice for a 5meter? LED strip.
The IRF510 is a poor choice (not a logic fet).
And the BC47B? BC547B is a 100mA signal transistor. Probably blown...

Get three LOGIC LEVEL mosfets.
Use three 10k resistors from the three output pins to ground.
And three 220ohm resistors between the three output pins and the three gates.
Post a diagram, or better a picture, so we can check it.

Your code is the next problem.
It should have CIEL lookup tables if you want equal lighting steps.
Arduino only has 8-bit PWM. Not very good for smooth colour changes.
An Adafruit 16 channel 12-bit PCA9685 breakout board could fix this.
Leo..

Thank you for your tips.

I don't have got logic level mosfets but tommorow I am going to visit local store to try buy them. Is IRL520 a good choice? Or maybe another transistor.

That is indeed a logic fet, but not a good one for your application.
It is a high voltage fet (100volt) with a rather high 'ON' resistance (0.27ohm).
List the logic fets that you can get, or link to the website of the store.
Low voltage logic fets usually have a lower 'ON' resistance.

This one has a much lower 'ON' resistance @5volt (0.035ohm).

Leo..

I was looking for transistors you linked at sparkfun (FQP30N06L / RFP30N06LE) but there are not avaliable in my shop. Anyway I found there:

STP36NF06L - this one seems to have similar specification

IRLZ44N

IRFZ44N

Eventually I can order one, but shipment takes up some time.
My local store is here

OK, I have got STP36NF06L now.
Does anybode can tell me if this connection is OK?
I took this image from here.

EDIT:
I connected this by myself. Is it OK?

Had a quick look, and it seems ok.
Leo..

Finally I found out what I was doing wrong. I was using 8,9,10 Leonardo pins, but pin 8 isn't PWM!
When I changed used pins to 9,10,11 it works now much better.

9 and 10 pins are 16-bit PWM on Leonardo. I think that transistions between colors are smoother now.
11th pin is 8/16bit? Hm... What does it mean, is that value selectable?
Leonardo pinout

matoex:
11th pin is 8/16bit? Hm... What does it mean, is that value selectable?

Don't know anything about a Leonardo.

x-bit PWM is the number of "LED current" steps.
Don't confuse this with brightness steps.

Perceived brightness is not lineair with LED power.
Complex calculations or simple lookup tables are used for equal brightness steps.

8-bit PWM is not smooth at low brightness.
12-bit PWM with 256 brightness steps is good, and also the max most LED driver chips can handle.
You use mosfets, so 16-bit should not be a problem.
Google "CIE lightness Arduino lookup table" for more info.
Leo..