Introduction

In different industrial sectors such as textiles, mining, metallurgy, and oil, among others, large amounts of wastewater are generated, whose composition is highly varied and rich in toxic wastes and chemical substances (Jan et al. 2010; Rasalingam et al. 2014; Charles et al. 2016; Alkathiri et al. 2020). With increase in industrialization, the production of harmful organic and inorganic substances and heavy metals such as arsenic, cadmium, chromium, cobalt, copper, iron, lead, manganese, mercury, nickel, tin, and zinc has also increased (Pangeni et al. 2014; Chen et al. 2017a, b; Ma et al. 2017; Wołowiec et al. 2019; Deng et al. 2020; Egirani et al. 2020). Most of these substances are not biodegradable and act as species resistant to the environment, which causes ecological damage and unfavorable effects on the development of ecosystems and living beings.

Following environmental approaches, industries have been showing interest in developing new studies and methods for the treatment of their waters (Bhatti et al. 2011; Wang et al. 2015; Harsha et al. 2017). In general, water treatment involves physical methods followed by physicochemical methods. But, at this stage, it is not possible to remove all pollutants, especially dissolved organic compounds, heavy metals, and chemicals. Although there are technologies for treating produced water, these can involve high costs, long reaction times, and low efficiency for water with high concentrations of contaminants (Fakhru’l-Razi et al. 2009; Igunnu et al. 2014; Yousef et al. 2020). Conventional physical, chemical, and biological processes for wastewater decontamination are usually applied. Chemical treatment is applied to increase effluent quality by using coagulating and flocculating agents; however, it is less effective for substances with a high degree of solubility (Heiderscheidt et al. 2015; Pathania et al. 2017; Liu et al. 2019). Biological treatment depends on the chemical composition of the pollutants, nature, and microorganisms, and their growth affects the ability to degrade the species in the water. The selectivity of microorganisms is associated with the characteristics of the effluent and the process conditions, but the process is not very efficient to eliminate substances in effluents continuous, and short periods (Robinson et al. 2001; Panahi et al. 2018). Regarding the physical process, in the first separation stage and/or after chemical or biological treatments, the removal of solids, particles, and soluble substances can be conducted by precipitation, ion exchange, membrane filtration, electrochemical destruction, and ozonation, among others (Hameed et al. 2008; Shou et al. 2016; Agrawal et al. 2017).

Several studies have focused on adsorption methods using activated carbon of different materials such as wood, organic material, residual biomass, and polymers. Activated carbons have cavities or pores in their structure, and their content contributes to the quality of textural properties. These properties define the specific surface area of the material and confer adsorbent properties to remove toxic substances. In general, activated carbons from organic material with high carbon content are synthesized (Odubiyi et al. 2012; Fares et al. 2018; Meng et al. 2019; Yang et al. 2020; Valério et al. 2020). Lignocellulosic biomass is a sustainable feedstock, and its use which reduces the accumulation of residual biomass in the form of fruit peel, wood, and leaves is projected. Currently, one of the agroindustries that generate a large amount of lignocellulosic biomass in the department of Santander (Colombia) is the cocoa sector, since it is the largest cocoa producer with 42.1% equivalent. Colombia is the fifth largest cocoa producer worldwide and the third largest in Latin America, for which it projects production of 246,000 tons by 2021 (Ortiz et al. 2014; Sánchez et al. 2021). The cocoa industry economically exploits the seed (cocoa beans), which represents 10% of the weight of the fresh fruit, and in the manufacture of chocolate, its derivatives are used. However, other by-products such as cocoa mucilage and shell are produced and represent about 75.7 and 85.9% of the total fruit on a wet basis (Afoakwa et al. 2013; Campos et al. 2018). The valorization of residual biomass such as cocoa shell plays an important role within the economic and environmental scheme. In addition, the high content of lignocellulosic biomass makes it an ideal precursor for the preparation of biomaterials.

The pretreatment of residual biomass represents one of the main technological challenges for the utilization and subsequent conversion into bioproducts with high added value such as activated carbons. Meanwhile, the characteristics of the valorization processes depend on the activation, pyrolysis conditions, and nature of the fluids of interest. Unlike many works reported in the bibliography, the present research work, as an innovative aspect, seeks to contribute to the sustainable socioeconomic development of the country by carrying out future projects on a pilot scale. In this way, an appropriate methodology for pretreatment and synthesis of activated carbons, it is possible to develop and commercialize adsorbent materials, based on the efficient management of biomass and the sustainable use of biodiversity and its ecosystemic services. The most important properties of adsorbents are the retention capacity and selectivity of the substances. Nonetheless, the concentration of the soluble pollutant (adsorbate), the pH of the solution, and the pollutant-adsorbent ratio are also important (Faria et al. 2008; Sotelo 2013). There is a wide variety of adsorbent materials of a carbonaceous nature, which greatly influences their porosity and surface area, and the multi-component separation properties. Activated carbons are materials with high adsorption capabilities, of which a large part is produced from organic waste, mainly of the lignocellulosic type. Furthermore, it has been established, through thermogravimetry and heat treatment tests, that a high percentage of the lignocellulosic material is transformed into activated carbon, while organic compounds such as cellulose and hemicellulose are converted into liquid products and gases. Thermogravimetric analysis to determine the kinetics of the pyrolysis process of materials is applied. Previously, kinetic models from various heating rates with values around 5, 10, 15, 20, and 40 °C/min are determined. However, the heating rates depend on the type of biomass. From the curve with a specific heating rate, it is essential to identify the degradation stages of the substances studied. In this way, it is possible to determine the abrupt changes and the temperature range of mass loss. Moreover, a low heating rate around 10 to 15 °C/min is recommended, because there is a significant exothermic difference between pyrolysis and in situ heterogeneous oxidation of biomass (Melgar et al. 2008; Manals et al. 2011; Saldarriaga et al. 2015; Han et al. 2016; Jo et al. 2017). The application and selectivity of activated carbons largely depends on the preparation conditions, and their chemical and textural properties (Wang et al. 2011; Díaz et al. 2013; Rivera et al. 2016; Oliveira et al. 2017; Aliakbari et al. 2018; Vuppaladadiyam et al. 2019). The use of biomass to prepare activated carbons has a positive impact on reducing organic waste. In numerous researches works, the use of activated carbons from vegetable biomass has been contemplated, due to their high efficiency in the removal of organic and inorganic compounds such as metals (White et al. 2011; Oyedun et al. 2014; Contescu et al. 2018; Cai et al. 2018; Priya et al. 2020). However, this efficiency depends on the nature of the vegetal material, reaction time, and chemical activation (Tejeda et al. 2014; Deliyanni et al. 2015; Yakout et al. 2016; Pak et al. 2016; Wahid et al. 2017).

To comply with the above, in this work, the cocoa shell precursor was used as raw material to produce activated carbon and evaluate its adsorption capacity with methylene blue and ferric chloride. Methylene blue is a cationic dye and is classified as organic salt. This dye is adapted in research due to its great potential to evaluate the quality of adsorbent materials (Ndolomingo et al. 2015). To obtain the best pyrolysis conditions, a 23 factorial design was carried out using temperature, impregnation ratio, and reaction time as process variables. The quality of the carbons and the analysis of the adsorption isotherms were conducted by ATR-FTIR and UV–VIS spectroscopy. Finally, the results obtained in the experimental tests were fitted to the models of the adsorption isotherms from Freundlich, Langmuir, and Temkin.

Materials and methods

Materials

In this work, the shell from the cocoa fruit with a humidity of 83.43% by weight was selected. The biomass on a dry basis was selected due to its content of cellulose (30.84% by weight), hemicellulose (23.85% by weight), and lignin (28.35% by weight). The biomass activation was conducted with phosphoric acid (99.5%, Sigma-Aldrich) with impregnation ratio of 1 and 1.5 with respect to the cocoa shell. The pyrolysis tests were carried out in a horizontal Carbolite UN 110 reactor in an inert chamber with nitrogen grade 5. For the adsorption tests, the salts of methylene blue (99%, Sigma-Aldrich) and ferric chloride (99%, Sigma-Aldrich) were used.

Activated carbon preparation

Chemical composition of cocoa shell

Moisture content was determined by adding 1 g of initial biomass in a previously weighed capsule. Then, the capsule with the sample was placed in an oven with controlled temperature at 105 °C, for a period of 120 min. By weight difference, the biomass wet weight is reported until a constant weight is obtained. To determine the holocellulose content, about 2 g of dry biomass with known humidity and sieved in the 60–80 mesh range was weighed. The sample was treated by adding 150 ml of 1.5% sodium chlorite and 10 drops of concentrated acetic acid. The mixture was left in a water bath for 30 min of reaction. This procedure was repeated four times. Then, the mixture was subjected to filtration and drying processes. To calculate the cellulose content, 1 g of biomass was weighed and refluxed with a mixture of 20 ml of acetic acid and methanol in a 1:1 ratio, for 60 min. Subsequently, the sample was cooled and 50 ml of a nitro-alcoholic mixture was added to it. After 60 min of boiling reaction, the mixture was vacuum filtered, washed with deionized water, and dried in an oven at 105 °C until constant weight. Hemicellulose was determined by the difference between the percentage of homocellulose and cellulose. For the determination of lignin, 15 ml of sulfuric acid was added to 1 g of biomass with constant stirring for 2 h. Then, water was added slowly until obtaining a solution with an acid concentration around 3%. The resulting mixture was refluxed for 4 h and allowed to stand for 24 h in order for the insoluble material or lignin to settle completely. Subsequently, the solid was filtered and washed with hot water and dried in an oven at 105 °C until constant weight (Toribio et al. 2014; Watkins et al. 2015; Mansora et al. 2019).

Treatment of the cocoa shell

The cocoa shell was initially subjected to a grinding stage in a TRAPP TRF 300 mill, and subsequently brought to a natural drying stage for 72 h. Then, the ground shell was separated by sieving in a Gran Test—Pinzuar sieve equipment, into three particle sizes with a mesh number ranging between 8 and 120. Subsequently, the crushed cocoa shell called cocoa shell precursor was divided into three groups by particle size intervals for the preparation of three activated carbons, which were coded as A, B, and C.

Chemical activation of biomass

The biomass (cocoa shell precursor) was impregnated with phosphoric acid H3PO4, using impregnation ratio (IR) of 1 and 1.5, between phosphoric acid/cocoa shell (Molina et al. 2004, Lamine et al. 2014; Chen et al. 2017a, b). During the chemical activation stage, approximately 300 g of dry and ground cocoa shell was weighed, and then, H3PO4 was added according to the impregnation ratio. The activation of the cocoa shell was carried out with constant stirring, maintaining the temperature at 100 °C for 60 min. The impregnation ratio (IR) can be obtained using Eq. 1:

$$IR = \frac{{m_{after\,impregnation} - m_{initial} }}{{m_{initial} }}$$
(1)

where:

minitial = mass of cocoa shell precursor, g.

msample after impregnation = mass of biomass after impregnation, g.

mliquids = mass of condensed liquids in the collector during reaction, g.

Thermogravimetric analysis (TGA)

The thermal decomposition was conducted on a thermogravimetric balance (Athlon thermogravimetric analyzer) to 10 mg of previously dried cocoa shell, in the temperature range between 25 and 800 °C, at a heating rate of 15 °C/min with a nitrogen flow of 50 ml/min. To identify the stages of thermal degradation of cocoa shell, the heating rate of 15 °C /min was selected, according to the methodology reported in the literature (Gil et al. 2010).

Pyrolysis testing and experiments design

The activated carbon preparation was realized through a thermochemical process in a Carbolite UN 110 oven, under an inert nitrogen atmosphere at a flow of 20 ml/min (Fig. 1). For each experiment, 300 g of cocoa shell precursor, previously activated with phosphoric acid, was used.

Fig. 1
figure 1

Scheme of the pyrolysis reactor (Carbolite): 1. nitrogen cylinder, 2. temperature controller, 3. reactor with pellets, 4. liquid collector

The experimental design allows the evaluation of the individual and interaction effect of the factors on the response variable. The 2 k factorial arrangement consists of k factors with two test levels. For example, the effect of k factors can be observed graphically to facilitate the interpretation of the results. The Pareto diagram determines the hierarchy of the main factor. In addition, a large number of tests for each selected factor are not necessary. For the preparation of activated carbons, this work used a 23 factorial design to establish the effect of 3 variables: impregnation ratio (IR), temperature, and reaction time, each variable with 2 levels. The responses variables were: surface area and activated carbon yield. Then, the best synthesis conditions in the preparation of the activated carbons A, B, and C were applied. Table 1 shows the three variables and their two levels.

Table 1 Factor levels

The reaction temperatures were previously determined based on the decomposition results of the thermogravimetry analysis test (Sect. 2.2.4). Subsequently, the activated carbon samples were subjected to a water-based washing process in a Soxhlet extraction system until obtaining washing waters with a pH in the range of 5 to 6. Finally, for the drying process the samples were placed in an oven at a temperature of 105 °C, for 24 h. During the pyrolysis test, the liquid product is condensed in the collector with dry ice. The mass balance was performed by gravimetry, using the following equations:

$$\% \,Activated carbon = \frac{{100\left( {m_{final} } \right)}}{{m_{initial} }}$$
(2)
$$\% \,Liquids = \frac{{100\left( {m_{liquids} } \right)}}{{m_{initial} }}$$
(3)
$$\% \,Gas = \frac{{100\left( {m_{initial} - m_{final} } \right)}}{{m_{initial} }}$$
(4)

where:

minitial = mass of impregnated sample, g.

mfinal = mass residual biomass after reaction, g.

mliquids = mass of condensed liquids in the collector during reaction, g.

% Activated carbon = percent by weight of activated carbon after reaction.

% Liquids = percent by weight of liquids after reaction.

% gas = percent by weight of gas after reaction.

The best synthesis conditions were used to obtain activated carbons A, B, and C.

Characterization

Surface area determination

The surface area was determined with a Vac Prep 061 Micromeritics equipment. The activated carbon samples were weighed into 9-mm-diameter glass cells and loaded into the equipment. Then, the degassing step was carried out at a temperature of 120 °C, for 2 h. Subsequently, the same procedure was carried out at 300 °C for 10 h, maintaining the vacuum pressure at 6 Pa. The texture characteristics such as surface area and pore volume were determined from adsorption–desorption isotherms with nitrogen at 77 K applying the Brunauer, Emmett, and Teller (BET) method. The specific areas of the samples with the BET method (Brunauer–Emmett–Teller) and the consistency criterion of the Rouquerol transform were calculated (Brunauer et al., 1938; Llewellyn et al. 2017). Nitrogen adsorption in this work was carried out in the range of relative pressure values (p/p°) from 0.02 to 0.99. The information was normalized using 3FLEX V4 software.

ATR-FTIR infrared spectroscopy

The cocoa shell and activated carbons were characterized by ATR-FTIR spectroscopy in order to qualitatively determine the functional groups. The infrared spectra were acquired with a Thermo Scientific Nicolet IS50 FTIR spectrometer, which has an attenuated total reflectance cell equipped with a single-pass diamond reflection crystal, with a 45° fixed angle of incidence. The obtained IR spectra were normalized using the OMNIC software.

Adsorption capacity assessment

Determination of activated carbon adsorption by UV–VIS spectroscopy

Adsorption tests were performed on different solutions of methylene blue and ferric chloride with initial concentrations between 50–450 and 50–350 mg/L, respectively. 0.1 g of activated carbon was added to 5 ml of each solution in 15 ml capped test tubes for centrifuge (Falcon). Subsequently, these tubes were shaken on a FALC F340 Series horizontal shaker, at 150 rpm, for 24 h (estimated time to reach equilibrium). The activated carbon was then separated by centrifugation in a Hettich Zentrifugen 320R equipment at 6000 rpm for 5 min. The final concentration of methylene blue or ferric chloride was determined from the supernatant liquid.

The methylene blue and ferric chloride calibration curves were estimated in a UV–VIS GO 3.12 spectrophotometer, at λ = 290 cm−1, using solutions in the range of 10 to 125 mg/L, and 10 to 240 mg/L, respectively. Fitting to the calibration correlations was conducted with the Beer–Lambert method.

Adsorption isotherms

- Langmuir model This model assumes that when the adsorbate (methylene blue and ferric chloride) comes into contact with the adsorbent (activated carbon), it only covers the latter with a homogeneous monolayer around its surface. The theoretical model of the Langmuir isotherm proposes that, at equilibrium, the maximum saturation point is obtained when there is no more adsorption in the monolayer formed by the adsorbate. Once a cation occupies an adsorption site, there will be no more molecular attraction at that specific site. The mathematical correlation adjusted to his theory is reflected in Eq. 5 (Basha et al. 2008, Ndi Nsami et al. 2013, Taghdiri et al. 2013, Salahudeen et al. 2014, Wahid et al. 2017):

$${\text{q}}_{{\text{e}}} = \left( {\frac{{{\text{q}}_{{{\text{max}}}} .{\text{b}}.{\text{C}}_{{\text{e}}} }}{{1 + {\text{b}}.{\text{C}}_{{\text{e}}} }}} \right)$$
(5)

where qmax and b are the Langmuir constants, which represent the maximum adsorption capacity (mg-g−1) of the adsorbent, and Ce is the energy constant related to the heat of adsorption (dm3-mg−1). In order to evaluate the parameters b and qmax through the fitted Langmuir isotherms, it is necessary to linearize the model as indicated in Eq. 6:

$$\frac{{{\text{C}}_{{\text{e}}} }}{{{\text{q}}_{{\text{e}}} }} = \frac{{{\text{C}}_{{\text{e}}} }}{{{\text{q}}_{{{\text{max}}}} }} + \frac{1}{{{\text{q}}_{{{\text{max}}}} {\text{b}}}}$$
(6)

- Freundlich model This model proposes that the binding sites with the great thermogravimetric test (Fig. 3) attraction force are initially occupied by the adsorbate molecules. Then, the weakest sites are consecutively occupied, thus decreasing the molecular binding as the degree of occupation of each site increases. Freundlich’s expression is represented by Eq. 7 (Basha et al. 2008, Ndi Nsami et al. 2013, Salahudeen et al. 2014, Wahid et al. 2017):

$${\text{q}}_{{\text{e}}} = {\text{k}}.{\text{C}}_{{\text{e}}}^{{1/{\text{n}}}}$$
(7)

The adsorption parameters are obtained with Eq. 8,

$${\text{Ln}}\left( {{\text{q}}_{{\text{e}}} } \right) = {\text{Ln}}\left( {{\text{K}}_{{\text{f}}} } \right) + \frac{1}{{{\text{n}}_{{\text{f}}} }}{\text{ Ln}}\left( {{\text{C}}_{{\text{e}}} } \right)$$
(8)

where kf is the equilibrium constant (mg-g−1(dm3mg−1)1/1n) and nf is the constant related to the affinity between the salt (methylene blue or ferric chloride) and the absorbent (activated carbon).

-- Temkin isotherm model This model was developed to understand the indirect effects on the adsorbate–adsorbent interaction. In an isothermal adsorption, the heat of adsorption of all the molecules in the layer decreases linearly (Basha et al. 2008). The adsorption isotherm is represented by Eq. 9 (Basha et al. 2008, Ndi Nsami et al. 2013, Salahudeen et al. 2014, Wahid et al. 2017),

$${\text{q}}_{{\text{e}}} = {\text{n}}_{{\text{T}}} {\text{Ln}}\left( {{\text{K}}_{{\text{T}}} } \right) + { } + {\text{ n}}_{{\text{T}}} {\text{Ln}}\left( {{\text{C}}_{{\text{e}}} } \right)$$
(9)

where \({\mathrm{K}}_{\mathrm{T}}\) is the Tenkim equilibrium constant, and from nT it is possible to calculate b, which is related to the heat of adsorption calculated from the expression in Eq. 10:

$${\text{n}}_{{\text{T}}} = \frac{{{\text{RT}}}}{{\text{b}}}$$
(10)

Results and discussion

Obtaining activated carbons

In this work, cocoa shell-based activated carbon was proposed as a precursor, considering that its high lignin content (28.35% by weight, on a dry basis) is favorable for the performance of the products obtained under pyrolysis conditions. Figure 2a shows the yield by weight of the cocoa shell precursor at different particle diameters after the grinding process.

Fig. 2
figure 2

Biomass treatment: (a) particle size distribution; and (b) yield distribution by kind of cocoa shell precursor

The ground biomass was divided into three samples by particle size range called cocoa shell precursor A (8–20 mesh), B (40–60 mesh), and C (80–120 + mesh). The weight percentage of the three cocoa shell samples and the particle size is shown in Fig. 2b. It is concluded that after grinding, the highest percentage is obtained by cocoa shell precursor B, followed by A and the lowest is C.

Figure 3 shows the results of the shell thermogravimetry. Pyrolysis starts at approximately 240 °C. In the DTG curve, a maximum peak associated with the decomposition of cellulose and hemicellulose appears. According to the behavior of the DTG derivative, it can be observed that the greatest mass loss occurs near 310 °C. On the other hand, a cumulative mass loss of 48% by weight is observed around 350 °C, and the mass loss gradient decreases as the temperature increases. The results show that in the range from 400 to 500 °C the mass loss is 8% by weight, achieving a maximum cumulative weight loss of 65% around 700 °C.

Fig. 3
figure 3

Cocoa shell thermogram with a heating rate of 15 °C/min

Three defined stages are given Fig. 4, the first between 30 and 180 °C where evaporation of light components and water occurs, the second between 200 and 500 °C where the greatest change occurs due to chemical reactions, and the last stage where there is less mass loss due to decomposition reactions. These trends are similar to the results reported by various authors (Garcia et al. 2008; Salahudeen et al. 2014; Carrier et al. 2011; Zhang et al. 2014; Jo et al. 2017; Cai et al. 2018), who determined that hemicellulose and cellulose decompose in the temperature range between 200–260 °C and 240–350 °C, respectively. The increase in temperature causes the breaking of glycosidic bonds and some C—C bonds of the hydrocarbons, alcohols, aldehydes, acids, and others (Wang et al. 2007). However, these compounds tend to generate tar, carbon, and light gases such as CO, CO2, H2O, and others. Meanwhile, lignin decomposes at temperatures above 280 °C. Therefore, the multiple reactions give rise to the formation of a carbon-rich product as lignin decomposes at higher temperatures (Gao et al. 2016; Yang et al. 2020). These results corroborate that the cocoa shell precursor used in the present work tends to form solid residues with significant yields around 400 °C.

Fig. 4
figure 4

Pareto diagram: (a) activated carbon yield; (b) surface area

Analysis of the 23 factorial experiment

Table 2 reports the product yields of each pyrolysis test used to obtain activated carbons, using the fitting of the maximum and minimum variables values of the experiment design which was performed with the Statgraphics Centurion XVII software.

Table 2 Yield and characterization of cocoa shell pyrolysis products

Table 2 and the Pareto diagram (Fig. 4) show that the yield and the surface area of the activated carbons, obtained from the cocoa shell precursor in the pyrolysis process, depend on the effects of IR > temperature > time, in that order.

Likewise, the chart shows that variables and interactions AC (RI and Time) and BC (Temperature and Time) exceed the statistical limit point of t value (size of the difference between the population’s mean), which represents a significant contribution. Meanwhile, the results indicate that the surface area of the activated carbons depends on the impregnation ratio (IR). However, this property does not depend on the levels used for the temperature and time factors. The activated carbon yield increases significantly due to the dehydrating character of phosphoric acid that facilitates the loss of hydrogen and oxygen in the form of water. These reactions produce carbon enrichment and also generate improvement in the textural properties of the adsorbent material. (Gao et al. 2016).

The texture of activated carbon varies in terms of the phosphoric acid ratio and the rotary kiln temperature in the pyrolysis stage. The impregnation ratio is the most important effect, and must be considered before each pyrolysis test in order to obtain carbons with the desired qualities. Activated carbons with high surface area values for conditions of impregnation ratio, temperature, and time are obtained, with values of 1.5, 480 °C, and 30 min, respectively. These process conditions were selected for the prepared activated carbons from cocoa shell precursor with different particle diameters. Subsequently, the carbons in adsorption tests of methylene blue and ferric chloride salts will be applied. Before starting the adsorption studies of the activated carbons, it is necessary to determine their textural and chemical properties, considering that the adsorption efficiency depends on the pore structure. Figure 5a shows the volume distribution by pore type for activated carbons A, B, and C obtained from cocoa shell precursor.

Fig. 5
figure 5

Surface area. (a) pore size distribution; (b) nitrogen adsorption isotherms

According to IUPAC (International Union of Pure and Applied Chemistry), activated carbons are classified according to their pore size as, macropores (> 50 nm in diameter), mesopores (2–50 nm in diameter), and micropores (< 2 nm in diameter). Therefore, activated carbons A, B, and C present mesoporous structures with values of: 80.68, 80.84, and 81.07%, respectively. So, the macropore and micropore structures fractions for the activated carbons range from 17.71 to 18.11% and between 1.21 and 1.22%. Additionally, the porosity of activated carbons A and B is in the pore size region between 2 and 30 nm. Meanwhile, carbon C is in the pore size region between 2 and 50 nm.

According to the nitrogen adsorption–desorption behavior, the results show that the activated carbons present a hysteresis cycle, which allows classifying these materials as type IV isotherms of the IUPAC classification (Fig. 6b). However, carbon C shows a higher hysteresis cycle, which indicates that the adsorbent–adsorbate interaction is lower than carbons A and B. In Fig. 5b, is observed the complete formation of the monolayer from the reduced pressure value of approximately 0.06, and after this value, the multilayer adsorption occurs. The results show similar trends to works reported by other authors, where significant nitrogen adsorption is observed at low relative pressures, corresponding to adsorption in micropores (Martín et al. 1990; Puziy et al. 2017). On the other hand, increased adsorption at intermediate and high relative pressures is characteristic of multilayer adsorption formation. Table 3 shows the surface area of the A, B, and C synthesized activated carbons, obtained by pyrolysis of the cocoa shell precursors with mesh particle diameters of 8–20, 40–60, and 80–120 + , respectively.

Fig. 6
figure 6

Infrared spectra of the cocoa shell precursor and its activated carbons

Table 3 Characterization of the activated carbons surface area

The activated carbons synthesized showed a slight increase in pore volume in the increasing order of A < B < C and the surface areas are around 1000 m2/g. That indicates that the proposed methodology with the factorial design of experiments in the thermochemical treatment on cocoa shell precursor with particle mesh diameters between 8 and 120 + is suitable to obtain activated carbons with very prominent surface areas.

Characterization of activated carbons by FTIR spectroscopy

Figure 6 shows the infrared spectra of the cocoa shell precursor and its activated carbons. The results of the ATR-FTIR spectra provide unique information about the functional groups present on the activated carbons surface, which are useful to relate the chemical composition with the adsorption properties.

The variation of the peaks in the infrared spectra that the thermochemical test conditions and the particle diameter of the cocoa shell precursor produce different effects on the structure of the activated carbon is evidence.

The broad bands between 3600 and 2900 cm−1 are related to the –OH group, which can be attributed to the presence of surface species such as phenol type and carboxylic acid. The stretch bands between 1550 and 1650 cm−1, corresponding to the C = O group, can be mainly attributed to carboxylic acids. However, functional groups associated with lactones or cyclic ester-type organic compounds are present in this region, and these compounds can overlap at around 1630 cm−1. The bands between 990 and 1300 cm−1, there is an intensity that corresponds to C-O type single bonds, both ethers, and hydroxyls.

The FTIR spectrum of the cocoa shell precursor sample shows vibrations of the methylene > CH2 group typical of cycloalkanes around 1025 cm−1 and the C-H of methyl groups between 1290 to 1400 cm−1. In addition, bands at 2850—2920 cm−1 typical of aliphatic C–H stretching and 1375—1465 cm−1 associated with aliphatic C–H bending, are observed. The results show that the intensities of some characteristics groups present in the cocoa shell precursor are absent in the activated carbons obtained during the thermochemical process at 480 °C. Therefore, the decrease in H atoms shows that the activated carbons present structures with high carbon content with graphitized type carbon structural arrangement. The signals attributed in this study corroborate with the results reported in the literature (Fuente et al. 2003; Allwaret et al. 2016; Nandiyanto et al. 2019).

The decrease in intensity in the aliphatic bending and stretching region indicates that activated carbons are mainly composed of aromatic and cyclic oxygen-rich structures typical of phenolic, carboxylic compounds. The results affect that the abundance of these functional groups influences the chemical nature of the surface of each activated carbon. From the normalized spectra, it is observed that the intensities of the bands of these structures are higher for activated carbon B followed by activated carbons A and C. In this case, it is probably due to the oxidation produced by the phosphoric acid.

Methylene blue and ferric chloride adsorption analysis

The calibration curves (concentration vs absorbance) for the methylene blue and ferric chloride solutions are given Fig. 7, using the absorbances measured at λ = 290 cm−1 (Absλ), which showed coefficients of determination (R2) of 0.9801 and 0.9948, respectively.

Fig. 7
figure 7

UV–VIS calibration spectra for salts

The correlations obtained from the calibration curves using the Beer–Lambert’s law are shown in Eqs. 11 and 12.

$$Methylene \, blue: {\text{Ce}} = 8,.2 + 432.3{\text{Abs}}_{{\uplambda }}$$
(11)
$$Ferric \, chloride:{\text{Ce}} = 0.09 + 0.009{\text{Abs}}_{{\uplambda }}$$
(12)

Assessment of the adsorption capacity

The adsorption capacity of methylene blue increases as their initial concentration in the solution increases, for the three carbons studied (Fig. 8). The percent removal tends to decrease with increase in concentration. The results show that the adsorption tendency of methylene blue, for concentrations (Co) between 50 to 100 mg/L, is in the order of B > C > A. For higher concentrations, the adsorption of activated carbons is in the order of A > C > B.

Fig. 8
figure 8

Adsorption behavior of methylene blue in activated carbons: a adsorption capacity (qe) and b percent removal efficiency (% RE)

The ferric chloride adsorption results (Fig. 9) show similar trends to methylene blue. However, the percent removal of ferric chloride is lower with increase in initial concentration. For concentrations between 50 and 200 mg/L, the carbons are ordered as B > C > A. While, for higher concentrations the adsorption order of the activated carbons is ordered as A > C > B, keeping the same absorbent ratio.

Fig. 9
figure 9

Adsorption behavior of ferric chloride in activated carbons: a adsorption capacity (qe); and b percent removal efficiency (% RE)

Figure 10 shows the fitting of the experimental data for the adsorption of methylene blue and ferric chloride using the Freundlich isotherm for the activated carbons A, B, and C. The results show that at low concentrations of methylene blue and ferric chloride salts, there is a greater removal, but the available sites are occupied as the concentration increases. In addition, results show that activated carbon B has high adsorption efficiency of methylene blue and ferric chloride in the concentration ranges of 50–100 mg/L and 50–200 mg/L, respectively.

Fig. 10
figure 10

Freundlich isotherms in activated carbons: a methylene blue and b ferric chloride

The adsorption kinetics parameters for fitting the adsorption behavior of methylene blue and ferric chloride to Langmuir, Freundlich, and Temkin isotherms were calculated by linear regression as shown in Eqs. (6), (8), and (9). The coefficients of determination (R2) for the Freundlich isotherms are close to 1, and these are greater than the coefficients reported for the Langmuir and Temkin isotherms (Table 4).

Table 4 Adsorption kinetics parameters of adsorption isotherms

Similarly, the sum of squared errors (SSE) parameter of the adsorption tests for methylene blue and ferric chloride shows minimum values for the Freundlich model, followed by the Langmuir and Temkin models, respectively. Thus, the Freundlich isotherm shows a better fit to the experimental adsorption data of methylene blue and ferric chloride, which suggests that monolayer and multilayer adsorption occurred on the surface of activated carbons. The results of the maximum adsorption capacity (qmax) of the Langmuir model show that the removal of methylene blue is greater, compared to the ferric chloride salt, in the three activated carbons. On the other hand, the n values for Freundlich isotherms suggest that there exists a greater affinity between methylene blue and the three activated carbons than to the ferric chloride salt. Furthermore, the equilibrium constants of the Freundlich and Temkin models show that the adsorption rate is higher for methylene blue.

The results show that the conditions selected with the factorial experimental design allow high performance of the dehydrating character of H3PO4 and the decomposition reactions of the carbonaceous structure of the cocoa shell. Therefore, these characteristics produce activated carbons with new pores that increase the surface area and textural properties. In general, the thermochemical treatment employed produces mesoporous activated carbons.

The chemical modification of the activated carbons revealed an increase in the oxygen content present in functional groups associated with carboxylic acids and phenols. The content of these functional groups produced significant changes in the physical properties of the material and the adsorption capacity of adsorbents such as methylene blue and ferric chloride. The results obtained from the characterization of synthesized activated carbons show consistency with the results reported by other researchers (Giraldo et al. 2008; Hesas et al. 2013; Bazan et al. 2016; Priya et al. 2020). The chemistry of the surface depends on the presence of functional groups, and therefore, their nature is fundamental to the adsorption capacity. According to the methodology proposed in this work, activated carbon B which presents greater effectiveness in adsorption capacity is determined. This property to the content of functional groups reported and the textural properties such as surface area, volume, and pore size is attributed. Likewise, the adsorption capacity depends on the nature of the adsorbate.

Conclusion

Cocoa shell-based activated carbons were synthesized with surface areas between 970 and 1200 m2/g, and the best conditions of temperature, impregnation ratio acid/cocoa shell precursor, and reaction time were 480 °C, 1.5, and 30 min, respectively.

Cocoa shell-based activated carbons, obtained with the phosphoric acid activation method, presented significant amounts of functional groups R–OH, R–COOH, and R–OCO, among others, possibly associated to substances such as phenols, carboxylic acids, lactones, ethers, and esters. Therefore, the high adsorption capacity of activated carbons against the methylene blue and ferric chloride salts is due to the texture of the material and its chemical nature. From the adsorption results, it was evidenced that, for concentrations of methylene blue and ferric chloride in the range of 50–100 mg/l, and 50–250 mg/l, respectively, the efficiency of the three activated carbons follows the order of B > C > A.

In general, considering the adsorption kinetics parameters obtained in the adsorption curves using the Freundlich method, the abundance of the functional groups OH, C = O, and -CO, and the surface area of 1217 m2/g, the carbon activated B has higher adsorption kinetics compared to the methylene blue and ferric chloride salts under study. Therefore, with the methodology proposed in this work, it was possible to synthesize activated carbons with excellent chemical and textural properties.