EX-5.1 2 ex-5_1.htm EXHIBIT 5.1 Prepared by MERRILL CORPORATION www.edgaradvantage.com QuickLinks -- Click here to rapidly navigate through this document

Exhibit 5.1

[Letterhead of Gray, Plant, Mooty, Mooty & Bennett, P.A.]

June 23, 2000

HEI, Inc.
1495 Steiger Lake Lane
Victoria, Minnesota 55386

RE: Form S-3 Registration Statement

Gentlemen:

    This opinion is furnished in connection with the registration, pursuant to the Securities Act of 1933, as amended, of 150,000 issued and outstanding shares of common stock of HEI, Inc. (the "Company") to be sold by Mart Diana and Glen Zirbes (the "Shares").

    We have acted as counsel to the Company in connection with the preparation of the Form S-3 Registration Statement (the "Registration Statement"). We have examined the Restated Articles of Incorporation, the Bylaws of the Company, such records of the proceedings of the Company as we deemed material and such other certificates, records and documents as we considered necessary for the purpose of this opinion.

    Based on the foregoing, we are of the opinion that the Shares are legally issued, fully paid and non-assessable securities of the Company. We understand that this opinion is to be issued in connection with the Registration Statement. We consent to a filing of a copy of this opinion with the Registration Statement.

                        Very truly yours,

                        GRAY, PLANT, MOOTY, MOOTY & BENNETT, P.A.

                        /s/ Gray, Plant, Mooty, Mooty & Bennett, P.A.



QuickLinks

[Letterhead of Gray, Plant, Mooty, Mooty & Bennett, P.A.]