In December 1875 Western Union wrapped up the quadruplex court battles and gave Edison a new contract. This contract spelled out their expectations for Edison's patents in clear language and gave him the assignment of developing an acoustic telegraph. He used the money to build a research laboratory in Menlo Park, New Jersey, twenty-five miles southwest of New York City. Menlo Park was where Edison built the phonograph, the electric light bulb, and tinkered with Alexander Graham Bell's telephone technology. About thirty men worked in the two-story facility, and while Edison reinforced his reputation as an exacting boss, the whole group became very close.
Edison's life was changing in other ways as well. His new family also moved to Menlo Park when the facility was opened. On December 25, 1871, he married a young girl named Mary Stilwell. She was a sixteen-year-old girl from a modest Newark family, very quiet and retiring. By 1878 they had three children: Marion, Thomas Jr., and William. It was not an easy marriage for her. Because Edison was often at the Menlo Park laboratory, where experimental work often pressed him to remain for days at a time, Mary Stilwell was forced to run the house and take care of the children by herself most of the time.
Edison's invention of the phonograph grew out of his experiments with telephone technology. The telephone was a new invention with a reputation as a novelty toy. In 1876, it was the subject of a patent dispute by two men: Alexander Graham Bell, a teacher of the hearing-impaired in Boston, and Elisha Gray, a Chicago electrician. Although Gray had invented the basic technology in 1874, he did not believe the device was marketable. After Bell demonstrated his own invention at the Philadelphia Centennial Exposition in 1876 and filed a patent for it, Gray changed his mind, and the telephone became the subject of a court battle.
In the end, Bell triumphed over the courts but faced market competition from Edison. When Bell began using the telephone to compete with the telegraph in urban areas, Western Union bought Gray's telephone patent and put Edison to work on improving Bell's device. Edison discovered the weakness of Bell's device–poor sound transmission–and invented a transmitter that greatly improved the volume of the telephone. Western Union gained a tremendous advantage by using Edison's transmitter with Gray's telephone receiver, which infuriated Bell. He saw his chance to respond when Edison's transmitter was tested in England in November 1878. They had tested Edison's device by linking it to a Bell receiver. Bell threatened to sue Edison for patent infringement.
Edison tried to create his own receiver to avoid a court battle, but his attempts were inferior to Bell's. In addition, the British government ruled against Edison in 1880, in the court decision The Attorney General v. The Edison Telephone Company of London. Western Union worked out a deal with Bell that gave him control over Edison's transmitter patent in return for exclusive control over long-distance messages sent through telephone exchanges.
Though he lost the battle over the telephone, Edison's experiments in this area led him to a new discovery: the phonograph. In November 1877, while testing a variety of telephone sound diaphragms, Edison stumbled upon the idea of using the diaphragm to play back sound. With some of his staff, he set up the diaphragm on an automatic telegraph stand and poked a small hole in it. They ran small pieces of paper underneath it and spoke. To their excitement, crude sounds were played back when they ran the paper through a second time.