Polyaniline and doped polyaniline was prepared by the method of insitu chemical oxidative polymerization with ammonium persulfate as an oxidant agent. The composite polyaniline was mixing the magnesium oxide and polyaniline with the PANI matrix distributions. Polyaniline composite of MgO characterized like as x-ray diffractometer shows structural properties. The electrical properties of polyaniline and composite polyaniline as a conductivity increases with increase in frequency. The sensor property shows the sensitivity with the help of time obtained the sensitivities values the ranges from 120 to 160% from these composites in 50% composite the sensitivity is high.