NOVELTY - The invention discloses a method and device of refining biodiesel from cultivated microalgae based on power generated by biogas. The method is to collect organic wastes from households, enterprises, and farmers, dispose the organic wastes in a sealed fermenter fermented by anaerobic bacteria to generate biogas which is used for power generating by co-generation. The primary component of biogas is methane and the secondary component is carbon dioxide. The exhaust waste includes high temperature carbon dioxide and steam after burning which will increase the density of waste heat and carbon dioxide of the environment if released directly. The present invention condenses the high temperature gases first to recover waste heat from it, then the cooled carbon dioxide is introduced in microalgae cultivator as the nutrients for the photosynthesis of microalgae and generates oxygen. Therefore, the obtained microalgae can be used as a raw material of biodiesel. The power generated from the co-generation can be used to illuminate LED lamps with a specific wavelength during no light night time provided for the microalgae to proceed photosynthesis. The present invention can generate power from the organic waste, reduce waste heat and carbon dioxide, generate oxygen, recycle heat and biodiesel. The residue of the organic waste can be used as organic fertilizer after fermented. The microalgae can be used as feedstuff after extracting oil from it. There is no resource waste neither secondary (pollution in the whole procedure, it can be benefit to all. The present invention comprises a biogas generator, a co-generator, a power storage, a condenser for condensing waste gas and recycling heat device, and a microalgae cultivator. The biogas generator is composed of a fermenter, a biogas purify unit and a biogas storage tank and the organic waste is fermented in the fermenter to generate biogas and the residue is purified by the water and stored for future use. The co-generator and power storage uses the biogas to generator the electricity which can be paralleled to the power company or stored for the future use. The waste gas condenser and waste recycle device comprises a heat exchanger, a gas storage tank and a hot water storage tank. Hot water is obtained from the condensation of the high temperature gas exhaust via heat exchanger. At the same time, low temperature carbon dioxide is obtained for cultivating microalgae. The microalgae cultivator includes control unit of carbon dioxide flow and pressure and multiple cultivation tanks for introducing cooled carbon dioxide in the cultivation tanks for microalgae growth. In addition, the microalgae cultivator includes LED lamps for night lightening to provide light source for photosynthesis at night to obtain high volume of microalgae for refining biodiesel.