*2.1. Materials*

Aniline was purchased from Across and distilled under vacuum. Acid Blue 40 dye, FeCl3·6H2O and Na2SO4 (Sigma-Aldrich, St. Louis, MO, USA), Dodecyl benzene sulfonic acid (DBSA) (Across) and FeSO4·7H2O (Merck, Kenilworth, NJ, USA ) were used without further purification.

### *2.2. Synthesis of PANI*

PANI was synthesized via our previously reported chemical oxidation method [49]. Typically, 0.02 M (1.182 mL) aniline was suspended in 50 mL of 0.01 M H2SO4 solution. To this suspension 0.01 M (0.15 mL) DBSA was added as an emulsifying agent. Then 50 mL of 0.01 M FeCl3·H2O prepared in 0.01 M H2SO4 was added drop by drop as an oxidant with constant stirring. After 20 min of continuous stirring, a milky white color suspension turned to light green and then dark green in one hour. The final product was thoroughly washed with acetone and then with double-distilled water until the filtrate became clear. The obtained powder was dried in an oven for 24 h at 60 ◦C.

### *2.3. Synthesis of Fe3O4*

Fe3O4 was synthesized by the chemical co-precipitation method by adding 0.15 mL DBSA and 2 M of FeCl3·6H2O dissolved in 50 mL of 0.1 M NaOH to 0.5 M FeSO4·7H2O solution. The whole mixture was stirred continuously at 85–90 ◦C. After 20 min of stirring, 30 mL of 5 M ammonia solution was added at once which turned the color of the reacting mixture to black. The pH of the reacting mixture was kept at 10 during the whole experiment. After two hours of continuous stirring at 85–90 ◦C, the precipitate was washed with ethanol and double distilled water until the effluent became clear. The black precipitate was dried at 80 ◦C for 10 h and then annealed at 600 ◦C for 5 h in a furnace (NEYCRAFT JFF 2000 Fiber Furnace, France).

### *2.4. Synthesis of PANI*/*Fe3O4 Composites*

PANI/Fe3O4 composites were synthesized by suspending 0.15 g Fe3O4 particles in 30 mL of 0.01 M H2SO4 solution followed by addition of 50 mL (0.02 M) of aniline solution prepared in 0.01 M H2SO4 and 0.5 mL (0.01) DBSA, respectively. After 30 min of continuous stirring, 50 mL of 0.01 M FeCl3·6H2O was added as an oxidizing agent. A light green color appeared within the stirring mixture after 20 min of the oxidant's addition. The color of this mixture turned dark black after about one hour. After continuously stirring for 6 h, the product was separated and washed with acetone and double-distilled water. The clean precipitate was dried in oven at 60 ◦C for 24 h.

### *2.5. Batch Adsorption Study for Removal of AB40 Dye*

Twenty-milliliter solutions of different concentrations between 5–120 mgL−<sup>1</sup> were prepared from the stock solution of AB40 dye. To these solutions, PANI was added and shacked for about 120 min. These solutions were then filtered to determine the concentration of dye in the filtrate using UV-Visible spectrophotometer and applying Equation (1) [50].

$$\mathbf{q}\_{\mathbf{e}} = \frac{(\mathbf{C}\_{\mathbf{i}} - \mathbf{C}\_{\mathbf{e}})\mathbf{V}}{\mathbf{m}} \tag{1}$$

where qe (mg g<sup>−</sup>1) refers to adsorption at equilibrium, Ci (mg <sup>L</sup>−1) and Ce (mg <sup>L</sup>−1) show initial and equilibrium concentration of dye, respectively, m (g) is the mass of adsorbent while V represents the volume of solution in mL. The e ffect of temperature, contact time, ionic strength, pH and initial concentration of dye solution on the adsorption behavior was studied. The adsorption data were utilized to calculate the thermodynamic and kinetics parameters. The same procedure was employed for studying adsorption of AB40 on Fe3O4 and PANI/Fe3O4 composite.

Before the adsorption process, standard solutions of AB40 dye were prepared was in the range 0.005–2 mg L−<sup>1</sup> and their maximum absorption was determined via UV-Visible spectrophotometer (Perkin Elmer, Waltham, MA, USA). The absorption values were plotted against concentration of the standard dye solutions and calibration curve was obtained according to the Beer–Lambert law. The slope so obtained was used as reference for the determination of concentration in rest of the experiments. The calibration curve is also shown in the supporting files (Figure S1).

After the adsorption of AB40 dye, the adsorbents were put onto the filter paper and washed several times with double-distilled water to run out the adsorbed dye. Then it was washed with 0.1 M NaOH to remove the remaining dye. This process enables the reutilization of the adsorbent.
