Ralph E. Grimm, 57, president and board chairman of a Gaithersburg electronics firm, died Tuesday at Georgetown University Hospital. He had suffered a heart attack.

Before founding R. E. Grimm Co. in July 1975, he had held a number of posts in electronic firms in the Washington area since 1946.

Mr. Grimm helped organize Communication Electronics Inc. (CEI) in 1960, and was named president of that company in 1964. He was vice president for engineering of the Watkins-Johnson Company for a year before starting his own firm.

Mr. Grimm was a native of Stanley, Va. He served as an electronics officer with the Coast Guard during World War II.

He had been a consultant to the National Security Agency and a member of the Naval Research Advisory Committee.

His professional membership included the Institute of Electrical and Electronic Engineers, the Society of Photographic Scientists and Engineers, and the Society of Motion Picture and Television Engineers. He also belonged to the Association of Old Crows.

He is survived by his wife, Eugenia K., of the home in Bethesda; a son, Ralph Jr., of Farmington, Mich.; two brothers, Robert A., of Washington, and Ray K., of New Port Richey, Fla., and a sister, Ruth Selle, of Pisgah Forest, N.C.