'Music was shaken to its roots in June," writes James Hamilton in his book London Lights, "When the Italian violinist Nicolò Paganini gave a series of performances at the King's Theatre, for which he initially demanded £4,000 a show." Even now, this is quite a hefty fee, but in the summer of 1831, it was a fortune.

Paganini is one of the diverse characters that move across the pages of London Lights: The Minds that Moved the City that Shook the World, 1805-51. There's Charles Babbage, who created calculating machines; John Martin, deviser of a new system of clean water supply for London; and Michael Faraday, who harnessed electricity. It could all be dry and academic, but author James Hamilton unearths the human foibles and sometimes scandalous behaviour of his characters.

"Professor Porson was lying under the table," he writes. "He stirred as one of the party of drinkers in the Cider Cellar, a basement drinking den in Maiden Lane, tripped and fell over a chair... The professor opened his eyes as his now senseless companion thudded down beside him. He sat up, hit his head on the edge of the table, and began to declaim Homer in Greek."

When we met at James's Oxfordshire home - he is one of the select band of authors who writes in a book-lined workroom at the bottom of his garden - I asked him for further details about the drunken professor.

"He was the sacked, defenestrated, Professor of Classics at Trinity College, Cambridge. He got on the wrong side of the Fellows because he wouldn't sign up to the Thirty-Nine articles of the Church of England. He was also well known as a drinker, which was rather embarrassing, and he didn't know when to hold his tongue."

After being ejected, he found himself in London, where he entertained all comers with his sparkling erudition.

"He was into what is now called outreach education. His audience wasn't professors and students in colleges, but out in the wider world. He wanted to spread his knowledge of Homer, Aeschylus, and Shakespeare.

"He had a remarkable memory and could recite them off the top of his head."

So was Porson a celebrity of his day?

"Yes he was, absolutely. He wanted to engage with a younger audience, and nowadays would certainly have ended up with a TV series, if he managed to keep off the bottle."

In the 19th century, there was no Sun or News of the World to dish the dirt on the famous and infamous. But there were journalists - William Jerdan, for instance, who began his career travelling around the south Devon coast reporting on "indecent sea-bathing". With considerable constraint, he later described Porson's career as "accidental and capricious, precarious and erratic".

The book is based on biographies, letters and "lucky discoveries in libraries and archives", says the author. "What I was looking for was the leaf mould: I dug away to find connections, and snide remarks about people, then added them up. You gradually get a momentum: A sparks off B, and you find that someone is unexpectedly connected to someone else."

James is the author of a major biography of J.M.W. Turner, and artists feature prominently. The book revels in stories of acrimonious rows between gallery owners, and artists, slighted because their pictures had not been hung in the best places in exhibitions. And there's the story of gallery owner George Bullock, who was offered the head of Oliver Cromwell.

"The head had been dug up after the restoration of Charles II, and exhibited on a spike on London Bridge," James explained. "Somebody must have felt sorry for it, and it was taken away. But the head was offered to George Bullock to show. No doubt he heard the sound of tills ringing loudly, but even he said no, no, this is a step too far'."

The book is also strong on scientists and engineers. In 1814, machinist and engineer Alexander Galloway accepted an order for a steam-driven saw from Stephen Peter Rigaud, Professor of Geometry at Oxford. Why on earth, I asked, would an Oxford professor need such an implement?

"You might well ask. It was a fairly modestly-sized saw. He probably needed it to cut wood to make mathematical models. Rigaud was a rather peppery gentleman, and got up the nose of Galloway, who was a very inventive, and businesslike engineer. The Professor sent Galloway all the wrong measurements, and Galloway made a flywheel for the saw that was much larger than necessary. So the Professor wouldn't pay the bill. There's a marvellous exchange of letters between the two of them in the Bodleian. In the end Galloway got his money, but probably swore that he would never work for an Oxford professor again."

London Lights also records James Sadler's ascent from Oxford in 1784, the first hydrogen-balloon flight in England, to which there is a plaque in Christ Church Meadow.

"I loved researching the history of ballooning, and the way the gas was generated by putting acid on shavings. An enormous industrial effort had to go into creating enough gas to fill one balloon, and it had to be made there and then. Health and safety officers would never allow it now.

"But the really exciting thing about writing London Lights was looking at the many, many people who were the mulch from which the great figures grew. One Faraday has to presuppose hundreds of other people who never quite made it - not failures, but people whose lives have together made the bottom of the pyramid. You cannot have a great discoverer, I would suggest, without a large hinterland of other people who are fellow toilers in the vineyard."

London Lights is published by John Murray at £25.