C550B Captain reported dual HSI failure at night resulted in heading deviation and an airspace violation. Captain was able to manually set the HSI to match the magnetic compass and continued on course.
Synopsis
C550B Captain reported dual HSI failure at night resulted in heading deviation and an airspace violation. Captain was able to manually set the HSI to match the magnetic compass and continued on course.
Narrative
Ferry flight from ZZZ to ZZZ1. No passengers; single pilot.Due to aircraft maintenance being behind schedule take-off was after dark. Aircraft was EFIS (Electronic Flight Instrument System) equipped.After take-off pilot HSI (Horizontal Situation Indicator)/DG (Directional Gyro) gave incorrect heading; copilot HSI/DG gave incorrect heading different from pilot DG. Maintained wings level and climbed to 3;500 feet for easterly flight. Turned to what I thought was east. Pilot DG said I was heading west. Turned 180 degrees which actually had me heading west. Copilot DG had a different heading.Looking outside to get a bearing from ground lights was disorienting as I was now unsure of my correct heading. I focused on flying the aircraft. I found a flashlight and took a reading off the magnetic compass. I descended to 2;000 feet.Using the magnetic compass I would turn right about 20-30 degrees; level the wings; turn right another 20-30 degrees; level the wings and take a reading off the magnetic compass.This continued procedure continued until I was heading east and on course.During the maneuvering while focusing on the above; I entered the ZZZ2 Class B airspace by 500 feet. The base of the Class B was 3;500 ft. If I had turned directly on course this would not have been a problem but during my problem solving and maneuvering; I went farther south than I realized. Once I was on course; I was able to switch the slaving mode of the HSI and manually set the pilot compass to match the magnetic compass.In retrospect I should not have attempted a ferry flight at night after maintenance; though the original plan was to return in the daylight.I should have spent the night or found another away back to ZZZ1.
Source: NASA Aviation Safety Reporting System (public domain). Reports are voluntary submissions and are not verified by NASA.