The man behind personal identification number (PIN) technology has recalled his "eureka moment" as he marks 50 years since its invention.

James Goodfellow, 79, was a young engineer working in Glasgow in the 1960s when the banks were looking for a way of letting customers get hold of their money after branches closed on a Saturday morning.

He worked on the project for a number of weeks and came up with the idea of a coded card with a personal number to access money from cash machines.

After getting the go-ahead from bosses and the "great and the good" of the banks, he started work on developing the concept with a team of engineers.

The patent was then applied for on May 2, 1966, and the system soon became accessible for millions of people around the world.

Mr Goodfellow said he had gained no financial benefit from his invention but has gradually received recognition over the years.

He was made an OBE ten years ago and was given an honorary doctorate from the University of the West of Scotland in 2014.

Mr Goodfellow, who lives with wife of 50 years Helen in Paisley, Renfrewshire, said: "The banks wanted an automatic cash dispenser - something that would provide a service 24/7 unmanned.

"They wanted a methodology for allowing access to cash on this unmanned basis.

"It eventually landed on my desk and the reason probably was that in 1964 I had spent some time in the United States designing access control systems."

Recalling the time dedicated to the project, he said: "I was left with this problem - the demand was a million customers, 2000 machines scattered throughout the UK which anyone could use at any time, and only money dispensed to a recognised person.

"The conventional view at the time was that it was going to be biometrics - such as your fingerprint - but that was totally impractical for many reasons."

He said: "The actual sort of eureka moment took place when I was messing around and suddenly realised that I could do it and it would probably solve the problem.

"That took place in my head and then on an engineering model but there was quite a bit of work to put it together into a demonstration form.

"I bundled this great thing on to a trolley at Central Station and wheeled it down and took it off at Euston, put it in a taxi and set it up in a boardroom and then the great and the good of the banks and the insurance companies were given the demonstration.

"We now had a token identified to a person, issued by the bank, along with a number they had to keep secret and that was the personal identification number.

"If you got it right then you got the money - which is exactly the same as what happens today."

Mr Goodfellow said it was just part of his remit as a research and development engineer to work on the technology and it was seen as a successful project.

"I shortly went to work somewhere else and forgot about it," he added.

Although he received no financial reward for his invention, he insists he has "no grumbles" and is most proud of having been recognised by his local university as well as being inducted into a hall of fame at Harvard University in America.

Download: The STV News app is Scotland's favourite and is available for iPhone from the App store and for Android from Google Play. Download it today and continue to enjoy STV News wherever you are.