Nasogastric intubation is a common clinical procedure for both diagnostic and therapeutic reasons. It is normally performed in “blind” without any visual aid or indication, and thus erroneous insertion and misplacement of the nasogastric (NG) tube could happen. Studies have shown that these errors could result in a wide spectrum of thoracic and non-thoracic complications, even fatal failure. The project is to address this problem by providing real-time localization of the NG tube. By embedding a small permanent magnet (PM) at the insertion tip of the NG tube, an optimized and intelligently distributed spatial sensor network is worn outside the patient to localize and track the position/orientation of the tube. A display system is able to indicate the position of the NG tube tip, and prompt alarm if any potential placement errors occur.