# Biodiesel production

Biodiesel production is the process of producing the biofuel, biodiesel, through the chemical reactions of transesterification and esterification. This process renders a product (chemistry) and by-products.
The fats and oils react with short-chain alcohols (typically methanol or ethanol). The alcohols used should be of low molecular weight. Ethanol is the most used because of its low cost, however, greater conversions into biodiesel can be reached using methanol. Although the transesterification reaction can be catalyzed by either acids or bases, the base-catalyzed reaction is more common. This path has lower reaction times and catalyst cost than those acid catalysis. However, alkaline catalysis has the disadvantage of high sensitivity to both water and free fatty acids present in the oils.

## Biorefinery process steps

The major steps required to synthesize biodiesel are as follows:

### Feedstock pretreatment

* Feedstock
** Microbial oil
*** Oleaginous microorganism
** Palm oil
** Soybean oil
** Coconut oil
** Vegetable fats and oils
** Jatropha
** Animal fat
** Waste oil
Common feedstock used in biodiesel production include:
* Yellow grease (recycled vegetable oil)
* Vegetable oil fuel
* Tallow
Lignocellulose generates byproducts that act as enzyme inhibitors, such as acetic acid, furfural, formic acid, vanillin, and these chemical inhibitors affect cell growth.
Recycled oil is processed to remove impurities from cooking, storage, and handling, such as dirt, charred food, and water. Virgin oils are refined, but not to a food-grade level. Degumming to remove phospholipids and other plant matter is common, though refinement processes vary. Water is removed because its presence during base-catalyzed transesterification results in the saponification (hydrolysis) of the triglycerides, producing soap instead of biodiesel.
A sample of the cleaned feedstock is then tested via titration against a standardized base solution, to determine the concentration of free fatty acids present in the vegetable oil sample. The acids are then either removed (typically through neutralization), or are esterified to produce biodiesel (or glycerides).

### Reactions

Base-catalyzed transesterification reacts lipids (fats and oils) with alcohol (typically methanol or ethanol) to produce biodiesel and an impure coproduct, glycerol. If the feedstock oil is used or has a high acid content, acid-catalyzed esterification can be used to react fatty acids with alcohol to produce biodiesel. Other methods, such as fixed-bed reactors, supercritical reactors, and ultrasonic reactors, forgo or decrease the use of chemical reaction that reduces the quality of substance in chemistry.

### Product purification

Products of the reaction include not only biodiesel, but also the byproducts soap, glycerol, excess alcohol, and trace amounts of water. All of these byproducts must be removed to meet the standards, but the order of removal is process-dependent.
The density of glycerol is greater than that of biodiesel, and this property difference is exploited to separate the bulk of the glycerol coproduct. Residual methanol is typically recovered by distillation and reused. Soaps can be removed or converted into acids. Residual water is also removed from the fuel.

## Reactions
### Base-catalysed transesterification mechanism

The transesterification reaction is base catalyzed. Any strong base capable of deprotonating the alcohol will work (e.g. NaOH, KOH, sodium methoxide, etc.), but the sodium and potassium hydroxides are often chosen for their cost. The presence of water causes undesirable base hydrolysis, so the reaction must be kept dry.
In the transesterification mechanism, the carbonyl carbon of the starting ester (RCOOR$^1$) undergoes nucleophilic attack by the incoming alkoxide (R$^2$O$^−$) to give a tetrahedral intermediate, which either reverts to the starting material, or proceeds to the transesterified product (RCOOR$^2$). The various species exist in equilibrium, and the product distribution depends on the relative energies of the reactant and product.

## Production methods
### Supercritical process

An alternative, catalyst-free method for transesterification uses supercritical methanol at high temperatures and pressures in a continuous process. In the supercritical state, the oil and methanol are in a single phase, and reaction occurs spontaneously and rapidly. The process can tolerate water in the feedstock, free fatty acids are converted to methyl esters instead of soap, so a wide variety of feedstocks can be used. Also the catalyst removal step is eliminated. High temperatures and pressures are required, but energy costs of production are similar or less than catalytic production routes.

### Ultra- and high-shear in-line and batch reactors

Ultra- and High Shear in-line or batch reactors allow production of biodiesel continuously, semi- continuously, and in batch-mode. This drastically reduces production time and increases production volume.
The reaction takes place in the high-energetic shear zone of the Ultra- and High Shear mixer by reducing the droplet size of the immiscible liquids such as oil or fats and methanol. Therefore, the smaller the droplet size the larger the surface area the faster the catalyst can react.

### Ultrasonic reactor method

In the ultrasonic reactor method, the ultrasonic waves cause the reaction mixture to produce and collapse bubbles constantly; this cavitation simultaneously provides the mixing and heating required to carry out the transesterification process. Use of an ultrasonic reactor for biodiesel production can drastically reduce reaction time and temperatures, and energy input. Using such reactors, the process of transesterification can run inline rather than using the time-consuming batch processing. Industrial scale ultrasonic devices allow for processing of several thousand barrels per day.

### Lipase-catalyzed method

Large amounts of research have focused recently on the use of enzymes as a catalyst for the transesterification. Researchers have found that very good yields could be obtained from crude and used oils using lipases. The use of lipases makes the reaction less sensitive to high free fatty-acid content, which is a problem with the standard biodiesel process. One problem with the lipase reaction is that methanol cannot be used because it inactivates the lipase catalyst after one batch. However, if methyl acetate is used instead of methanol, the lipase is not in-activated and can be used for several batches, making the lipase system much more cost-effective.

### Volatile fatty acids from anaerobic digestion of waste streams

Lipids have been drawing considerable attention as a substrate for biodiesel production owing to its sustainability, non-toxicity and energy efficient properties. However, due to cost reasons, attention must be focused on the non-edible sources of lipids, in particular oleaginous microorganisms. Such microbes have the ability to assimilate the carbon sources from a medium and convert the carbon into lipid storage materials. The lipids accumulated by these oleaginous cells can then be transesterified to form biodiesel.