A retired Scottish scientist who invented a system widely used in glucose sensors has won £2m in a court case against the industry behemoth Unilever after claiming he never received a penny from his former employer, despite the invention having made millions for the company.

Prof Ian Shanks, who has been fighting for compensation for 13 years, has been awarded compensation by the supreme court.

Shanks came up with a prototype of the electrochemical capillary fill device (ECFD) while working for a subsidiary of Unilever in Bedford in the 1980s.

Shanks told the Guardian in 2010 that he had been inspired by LCD technology to create a device in which a small, known volume of blood was drawn up into a cell between two glass plates and the concentration of particular substances within it measured.

“I thought about it a while, and I demonstrated it at home using glass slides from my daughter’s toy microscope kit,” he said at the time.

Shanks took his invention to his employer, who told him that the company owned it. Unilever went on to patent the invention and from the 1990s it sold licences to other companies to use the technology.

Lord Kitchin, a justice of the supreme court, noted that “ECFD technology eventually appeared in most glucose testing products”.

Shanks’s idea became ubiquitous, with the technology underpinning a new type of glucose sensor that was cheap and required very little blood to use. But while Unilever’s net benefit from the patents was about £24m, Shanks got nothing – until now.

Kitchin said Shanks was entitled to a fair share of the benefit seen by the company, even though Shanks accepted that Unilever owned the rights to his invention.

The justice said the rewards Unilever enjoyed “were substantial and significant, were generated at no significant risk, reflected a very high rate of return, and stood out in comparison with the benefit Unilever derived from other patents.”

A Unilever spokesperson said: “We are disappointed with the decision to overturn the previous three judgments and award Dr Shanks a share of the licence revenue obtained by Unilever in addition to the salary, bonuses and benefits he was compensated with while employed to develop new products for the business.”