TECHNOLOGY FOCUS - ORGANIC CHEMISTRY - Preferred Method: The heat treatment is performed at 700-1800 degrees C. The duration of time is 10 minutes to 2 hours. The heat treatment is performed by: subjecting the powders to a microwave radiation with a frequency of 2.45 GHz; or a heat source other than a microwave radiation source. The method further comprises adding polyphosphoric acid to the powders prior to the subjecting step. Preferred Components: The material containing the tannin is tannin sulfonate, lignin and/or lignosulfonate. The carbon source material comprises tannin, urea, lignin, lignosulfonate, tannin sulfonate, phenol formaldehyde resins, melamine formaldehyde resins, tannin formaldehyde resins, resorcinol formaldehyde resins and/or urea formaldehyde resins. The additive containing the doping chemical element or the heteroatom containing additive is one containing oxygen, nitrogen, phosphorus, boron, sulfur, iodine, fluorine, silicon, selenium and/or germanium. The additive containing the doping chemical element comprises: a boron compound containing boric acid or sodium borate; a phosphorus compound containing phosphoric acid, polyphosphoric acid, or sodium phosphate; a silicon compound containing potassium silicate; a fluorine compound containing ammonium fluoride; an iodine compound containing sodium iodide, or ammonium iodide; or a nitrogen compound containing melamine, dicyandiamide, urea, guanidine or histidine. The additive containing the doping chemical element further comprises hexamine. EXAMPLE - 1.62 g Tannin and 1.26 g melamine were dissolved in 50 ml water with a few drops of methanol for added solubility, to form a mixture. The mixture was heated until the solutes dissolved and the heating was continued until all the water evaporated from the evaporating dish. The resulting dry solid was scraped. Then, 1 g of the powdered sample was placed in an alumina crucible with 4 drops of phosphoric acid and covered with another boron nitride crucible and placed in a microwave oven operating at 1.08 kW under ambient conditions for 10 minutes. The sample was left for 15 minutes to cool and to obtain phosphorus and nitrogen doped carbon composite.