An arrangement comprising: - a thermal device being a boiler, a gasification reactor, a pyrolysis reactor, or a torrefaction reactor, the thermal device comprising walls which enclose inner parts of the thermal device, - a surface reflecting and/or scattering electromagnetic radiation in the inner part of the thermal device, - a detector of electromagnetic radiation arranged at a second distance (L 2,1, L 2,2) from said surface, and - a processing unit, characterized in that the arrangement comprises - a laser source arranged at a first distance (L 1,1, L 1,2) from said surface and outside the thermal device, and - a window or an aperture configured to transmit an electromagnetic signal from the laser source to said surface comprised by a wall of the thermal device, in which arrangement - the laser source is configured to emit radiation from the laser source to said surface, said radiation being reflected and/or scattered in the form of reflected radiation from said surface, - the detector of electromagnetic radiation is configured to receive the reflected radiation, and - the processing unit is configured to determine the thickness or the increase in the thickness of a contamination layer by ∘ determining, during a first period of time (T 1), by means of emitted radiation and reflected radiation, data dependent on the first (L 1,1) and/or the second distance (L 2,1), and by means of said data, a first length (D 1), ∘ determining, during a second period of time (T 2), by means of emitted radiation and reflected radiation, data dependent on the first (L 1,2) and/or the second distance (L 2,2), and by means of said data, a second length (D 2), and ∘ determining, by means of the first length (D 1) and the second length (D 2), the increase in the thickness of the contamination layer or the thickness of the contamination layer, by using the first length (D 1) as an initial reference length. - a thermal device being a boiler, a gasification reactor, a pyrolysis reactor, or a torrefaction reactor, the thermal device comprising walls which enclose inner parts of the thermal device, - a surface reflecting and/or scattering electromagnetic radiation in the inner part of the thermal device, - a detector of electromagnetic radiation arranged at a second distance (L 2,1, L 2,2) from said surface, and - a processing unit, - a laser source arranged at a first distance (L 1,1, L 1,2) from said surface and outside the thermal device, and - a window or an aperture configured to transmit an electromagnetic signal from the laser source to said surface comprised by a wall of the thermal device, in which arrangement - the laser source is configured to emit radiation from the laser source to said surface, said radiation being reflected and/or scattered in the form of reflected radiation from said surface, - the detector of electromagnetic radiation is configured to receive the reflected radiation, and - the processing unit is configured to determine the thickness or the increase in the thickness of a contamination layer by ∘ determining, during a first period of time (T 1), by means of emitted radiation and reflected radiation, data dependent on the first (L 1,1) and/or the second distance (L 2,1), and by means of said data, a first length (D 1), ∘ determining, during a second period of time (T 2), by means of emitted radiation and reflected radiation, data dependent on the first (L 1,2) and/or the second distance (L 2,2), and by means of said data, a second length (D 2), and ∘ determining, by means of the first length (D 1) and the second length (D 2), the increase in the thickness of the contamination layer or the thickness of the contamination layer, by using the first length (D 1) as an initial reference length. ∘ determining, during a first period of time (T 1), by means of emitted radiation and reflected radiation, data dependent on the first (L 1,1) and/or the second distance (L 2,1), and by means of said data, a first length (D 1), ∘ determining, during a second period of time (T 2), by means of emitted radiation and reflected radiation, data dependent on the first (L 1,2) and/or the second distance (L 2,2), and by means of said data, a second length (D 2), and ∘ determining, by means of the first length (D 1) and the second length (D 2), the increase in the thickness of the contamination layer or the thickness of the contamination layer, by using the first length (D 1) as an initial reference length.