An automatic pet door for large pets is installed in a hinged door and is actuated by a magnet worn by a pet. Unintended openings of the automatic pet door caused by the Earths ambient magnetic field when the hinged door is moved are prevented by a system that includes a microelectromechanical systems gyro. A counterweight system allows the use of a relatively small and inexpensive electric motor to actuate the automatic pet door.