Every few years, the small town of Troy in Miami County, Ohio celebrates an historic occasion that for a few giddy weeks puts it on the world map of the grocery trade. At the time, National Cash Register, which provided the checkout equipment, was based in Ohio and Troy was also the headquarters of the Hobart Corporation, which developed the weighing and pricing machines for loose items such as meat. It was here, at just after 8 a.m. on June 26, 1974, that the first item marked with the Universal Product Code (UPC) was scanned at the checkout of Troy’s Marsh Supermarket.

It was treated ceremonial occasion and involved a little bit of ritual. The night before, a team of Marsh staff had moved in to put bar codes on hundreds of items in the store while National Cash Register installed their scanners and computers. The first "shopper" was Clyde Dawson, who was head of research and development for Marsh Supermarket; the pioneer cashier who "served" him, Sharon Buchanan. Legend has it that Dawson dipped into his shopping basket and pulled out a multi-pack of Wrigley’s Juicy Fruit chewing gum. Dawson explained later that this was not a lucky dip: he chose it because nobody had been sure that a bar code could be printed on something as small as a pack of chewing gum, and Wrigley had found a solution to the problem. Their ample reward was a place in American history.

Joe Woodland said himself it sounded like a fairy tale: he had gotten the inspiration for what became the bar code while sitting on Miami Beach. He drew it with his fingers in the sand. What he was after was a code of some sort that could be printed on groceries and scanned so that supermarket checkout queues would move more quickly and stocktaking would be simplified. That such a technology was needed was not his idea: it came from a distraught supermarket manager who had pleaded with a dean at Drexel Institute of Technology in Philadelphia to come up with some way of getting shoppers through his store more quickly. The delays and the regular stocktaking were costing him his profits. The dean shrugged him off, but a junior postgraduate, Bernard "Bob" Silver, overheard and was intrigued. He mentioned it to Woodland, who had graduated from Drexel in 1947. Woodland was already an inventor, and he decided to take on the challenge.

So confident was he that he would come up with a solution to the supermarket dilemma that Woodland left graduate school in the winter of 1948 to live in an apartment owned by his grandfather in Miami Beach. He had cashed in some stocks to tide him over. It was in January 1949 that Woodland had his epiphany, though the brilliance of its simplicity and its far-reaching consequences for modern existence were not recognized until many years later.

***

It was Morse Code that gave him the idea. Woodland had learned it when he was in the Boy Scouts. As he was sitting in a beach chair and pondering the checkout dilemma, Morse came into his head:

I remember I was thinking about dots and dashes when I poked my four fingers into the sand and, for whatever reason—I didn’t know—I pulled my hand toward me and I had four lines. I said ‘Golly! Now I have four lines and they could be wide lines and narrow lines, instead of dots and dashes. Now I have a better chance of finding the doggone thing.’ Then, only seconds later, I took my four fingers—they were still in the sand—and I swept them round into a circle.

Back in Philadelphia, Woodland and Silver decided to see if they could get a working system going with the technology to hand. They first filed a patent in 1949, which was finally granted in 1952. Although the patent illustrates the basic concept, there is only a smattering of anecdotal evidence about what Woodland and Silver actually built. A crude prototype in Woodland’s own home used a powerful 500-watt incandescent bulb. An oscilloscope was used to "read" the code; the whole thing was the size of a desk. Allegedly, it worked, up to a point. But an objective evaluation judged it to be 20 years ahead of its time. Woodland and Silver had the right idea, but they lacked the minicomputer and, critically, a very bright light with which to "read" the black and white bar code.

***

On July 16, 1960, when he first saw the laser, the head of public relations at Hughes Aircraft Company of Culver City, California, Carl Byoir, declared they were in big trouble: "It looks like something a plumber made." But the next day, at a press conference held in the Delmonico Hotel in New York, the company made one of the most sensational announcements in the history of science. One of their research scientists, Theodore Maiman, had made an "atomic radio light brighter than the center of the sun." Maiman produced for the newsmen his "laser," an acronym for Light Amplification by Stimulated Emission of Radiation.

Most of the reporters were eager to learn what the laser was for, and what it could do. It was like science fiction. Maiman said the laser beam was so concentrated, so "coherent," that if it were beamed from Los Angeles to San Francisco it would spread only 100 feet. The tiny beam was hot and sharp enough to cut through materials. Could it be used as a weapon? That was not the intention, Maiman assured reporters. Nevertheless, the Los Angeles Herald headlined its story: "LA Man Discovers Science Fiction Death Ray." This became a popular theme in the newspapers.

Maiman had won the race to build the very first laser, beating fierce competition from around the world. It is possible to imagine the extreme excitement that he and his associate Irnee D’Haenens experienced when they produced that first fickle beam. They did not know then what it might be used for, but they imagined it would have many applications in science and communications, in industry for cutting and welding, and in medicine for delicate surgery. But, as Maiman wrote, "I did not foresee the supermarket check-out scanner or the printer."

***

A booklet produced in 1966 by the Kroger Company, which ran one of the largest supermarket chains in North America, signed off with a despairing wish for a better future: "Just dreaming a little . . . could an optical scanner read the price and total the sale. . . . Faster service, more productive service is needed desperately. We solicit your help." Kroger’s business was groceries, not electronics, so the company went looking for a partner with the necessary expertise.

A small research team at the powerful Radio Corporation of America (RCA) was looking at a few new projects, including the possibility of an automatic bank cash machine, which they decided would not go because "the customer would not buy the concept." Finally, they lighted on the bar code. A search of the history turned up some apparently hare-brained schemes: in one, customers picked out punch cards that identified what they wanted to buy and presented them to a cashier, who retrieved the goods from a store. This did not survive long in the grocery business. Then there was the patent for a system in which the supermarket shopper threw everything into a basket, which was pushed under a scanner that identified each item and printed out a bill.

They soon found the Woodland and Silver patent. This was not the rectangular bar code that Woodland had first envisaged on Miami Beach but the "bull's-eye" of concentric circles he thought would be a better design. When he and Silver worked on it, they decided the bull's-eye was the better symbol because it could be read accurately from any angle.

Printing the bull's-eye bar code proved to be one of the greatest difficulties, because any imperfections would make the whole system unworkable. A rotating turret of ballpoint pens, and a pen designed for astronauts that could write upside down, solved some of the problems. All this technical development, involving several companies commissioned by RCA, was to lead up to the first real-life test at the Kroger Kenwood Plaza store in Cincinnati. On July 3, 1972, the first automated checkstands were installed (One of RCA’s pioneer checkstands is in the Smithsonian collection.) More checkstands were installed and a comparison with other Kroger stores told an undeniable and very promising story: the bull's-eye bar code hit the target, with superior sales figures. But this was just one store in a nationwide grocery and supermarket business worth billions. If the laser and bar code were to revolutionize the checkout counter, they would have to be near universal.

***

The goal of the Ad Hoc Committee of the Universal Product Identification Code could be stated very simply. The representatives of the grocery trade were charged with finding a way to introduce a Universal Product Code, a bar code of some description that would be common to all goods sold in supermarkets and imprinted by the manufacturers and retailers. The code would carry information about the nature of the product, the company that made it, and so on. In-store computers would "read" this information with scanners and introduce their own variations, which might involve special offers and reductions. The vision was there but the difficulties in the way of its realization were daunting.

Manufacturers were often resistant to the idea of a universal code. They had existing methods of identification of products, which would have to be discarded or adapted. Cardboard manufacturers worried that a printed code might spoil their product. Canners did not want to be obliged to put bar codes on the base of cans. It took four years to arrive at a workable proposition to put to the whole industry.

Eureka: How Invention Happens Tracing the long pre-history of five twentieth-century inventions which have transformed our lives, Gavin Weightman reveals a fantastic cast of scientists and inspired amateurs whose ingenuity has given us the airplane, television, bar code, personal computer, and mobile phone. Buy

In the end, seven companies, all of them based in the United States, submitted systems to the Symbol Committee, a technical offshoot of the Ad Hoc Committee. RCA, having demonstrated to the committee its system in Cincinnati, took the view, not unreasonably, that it was the only real contender.

However, at the last minute, International Business Machines (IBM) made a surprise bid. It had no technology at all to demonstrate to the committee, and the decision to enter the competition appears to have been an afterthought, despite the fact that it had in its employ none other than Joe Woodland. As it turned out, although he was involved in IBM’s submission, he was not the creator of its version of the Universal Bar Code. That fell to George Laurer, who, in his own view, had an advantage over his rivals because neither he nor IBM had given supermarket checkout systems or bar codes much thought and his company had no ready-made technology. Starting from scratch, Laurer had no prejudices about the appearance of the bar code, though his bosses had assumed it would be some version of the circular bull's-eye in Woodland’s patent and RCA’s pioneer system in Cincinnati.

Laurer was handed the specifications for a bar code that had been determined by the Symbol Selection Committee: it had to be small and neat, maximum 1.5 square inches; to save money it had to be printable with existing technology used for standard labels; it had been calculated that only ten digits were needed; the bar code had to be readable from any direction and at speed; there must be fewer than one in 20,000 undetected errors.

Although there was skepticism in IBM, Laurer was convincing enough to be given the go-head with a rectangular bar code. A division of IBM built a prototype scanner, and Laurer’s Universal Product Code was tested. "There were many skeptics in IBM," Laurer recalled, "not the least of whom was [his boss] B.O. Evans himself. However at the end of a flawless demonstration for Mr. Evans, we had our ace softball pitcher pitch beanbag ash trays, with symbols on the bottom, as fast as he could over the scanner. When each one read correctly, Mr. Evans was convinced."

It was another matter to convince the Symbol Selection Committee, which was under huge pressure to accept RCA’s already functioning bull's-eye symbol and technology that had done much to inspire confidence that a universal product code could work. After asking for an appraisal of the rival symbologies from scientists at the Massachusetts Institute of Technology, on March 30, 1973, in a New York hotel close to Grand Central Station, the committee met to make its final and fateful decision. The committee’s chair Alan Haberman asked them first to declare how sure they were that the symbol they had chosen was the correct one. There was a very high level of confidence—about 90 percent all round—and the winner was Laurer’s rectangular code.

For Woodland, who died in 2012 at the age of 91, it must have been a strange experience to witness the reincarnation in sophisticated form of the elongated lines of Morse Code he had drawn in the sand in 1949. There was now a modestly priced laser scanner to register with a concentrated beam of light the coded vertical lines of alternating black and blank and a microcomputer to decipher the information.

***

Like so many inventions, the UPC was not an immediate success. It was when the mass merchandisers adopted the UPC that it took off, Kmart being the first. In fact, bar code technology was almost made for companies like Walmart, which deal in thousands of goods that need to be catalogued and tracked. The bar code took off in the grocery and retail business in the 1980s, and at the same time began to transform manufacturing and to appear like a rash on anything that benefited from instant identification. In 2004, Fortune magazine estimated that the bar code was used by 80 to 90 percent of the top 500 companies in the United States.

Though the inspiration for the bar code was the plea by supermarkets for technology that would speed up the checkout, its greatest value to business and industry is that it has provided hard, statistical evidence for what sells and what does not. It has transformed market research, providing a rich picture of people’s tastes, and it has made production lines more efficient. The once-dreaded "death ray" laser beam now comes in handy gun-sized scanners that instantly read and log anything from hospital drugs to newborn babies.

***

After many years of anonymity, the man whose knowledge of Morse Code inspired the familiar black and white stripes finally got some recognition. In February 1992, President George H.W. Bush was photographed at a national grocery convention looking intently at a supermarket scanner and having a go at swiping a can with a bar code over it. The New York Times correspondent wrote this up as evidence that it was the first time Bush had seen a supermarket checkout. In other words, he was out of touch with everyday American life. His aides insisted that he was not struck by the novelty of the technology but by the fact that it could read a damaged bar code. Apocryphal or not, the story stuck and was regarded as damaging to Bush. However, as Woodland’s local newspaper put it: "George Bush isn’t one to hold a grudge. No Sir." A few months after the checkout incident, Bush presented Woodland with a National Medal of Technology.

This excerpt is adapted from Eureka: How Invention Happens, by Gavin Weightman. Reprinted with permission of Yale University Press.

Editor's Note, June 26, 2017: This story originally postulated that the Smithsonian's National Museum of American History collected the original Wrigley's gum pack and put it on display. The Smithsonian did not collect the gum; a facsimile was once on display that told the story of the UPC scanner.