The traditional electric furnace pyrolysis to produce heteroatom doped carbon faces the time-consuming issue due to the fixed size of furnace chamber and indirect heat transfer. Herein a fast Joule-heating pyrolysis method, viz., powering on the C, N, Fe-containing, conductive polyaniline precursor at fixed direct current (DC) voltage for a specific time, is put forward. The polyaniline precursor begins to decompose thermally when being powered with a DC voltage of 5.0 V upwards. In the pyrolysis products, Fe and N co-doping of carbon material leads to C-N bonding and C-Fe bonding in a certain way. The direct peroxide-peroxide fuel cell (DPPFC) with the optimal Fe, N codoped carbon material as anode and cathode can generate an open circuit voltage of 0.85 V and a peak power density of 29.7 mW cm(-2) in ambient temperature, which is highly competitive compared with other DPPFCs with anode and/or cathode made of noble metals.