Apparatus and methods are utilized for controlling downhole equipment attached to a drill string by the transmission of commands from the surface of the earth. The drill string is rotated at the surface of the earth sequentially through one or more discrete angles of rotation to generate a command code. The sequence of discrete angular rotations is sensed downhole by a gyroscope and decoded as a command in a microprocessor. Alternately, a command code is transmitted by sequentially rotating the drill string at different angular rates which are likewise sensed by the gyroscope and decoded in the microprocessor. The microprocessor then transmits the decoded command to the controlled equipment.