The prevalence of respiratory illnesses such as Asthma and COPD (Chronic Obstructive Pulmonary Disease) has been growing rapidly across the world. The spirometry equipment used in hospitals for pulmonary function testing costs thousands of dollars. I have designed a smartphone-based low-cost pulmonary function analyzer that can be used to measure lung function and diagnose various respiratory illnesses. The mechanical part of my pulmonary function analyzer consists of a 3D-printed housing based on the Lilly spirometer design. The instantaneous flow rate during breathing is measured by a pressure sensor as air passes through a fine stainless steel wire mesh in the analyzer. The pressure sensor output is monitored by an Arduino microcontroller, which transmits the information over a Bluetooth 4.0 link. The measurement data is received by an Android app running on a smartphone or tablet, which analyzes the data and displays it graphically. The app computes various quantitative metrics on the lung performance and compares them to their predicted values based on the user’s age, gender, etc. Based on these comparisons, the app determines the probabilities of the results matching the characteristics of five different respiratory diseases: COPD, Asthma, Emphysema, Chronic Bronchitis and Restrictive Lung Disease.