Cooling down and heating of solution unexpectedly during cation identification test While conducting qualitative tests for identification of cations in the given salt, I encountered this unexpected temperature change. Following are the steps of tests:

Step 1: We made an aqueous solution of the salt and added dilute hydrochloric acid. There was no precipitate, which showed that Group 1 cations ($\ce{Pb^2+}$) are absent.

Step 2: We then divided the solution into two parts, and through one part, passed $\ce{H2S}$ gas. There was no precipitate, which showed that Group 2 cations ($\ce{Cu^2+}$) were absent.

Here, the temperature of the solution through which we passed the gas, rose above the room temperature. It could be easily felt while holding the test tube.

Step 3: To the other part in the test tube, we added $\ce{NH4Cl}$ to make the solution completely alkaline, and then added $\ce{NH4OH}$ till the solution was ammoniacal. We did not get any precipitate, which showed that Group 3 cations (viz. $\ce{Al^3+}$, $\ce{Fe^2+}$ and $\ce{Fe^3+}$) were absent.

It is here that we encountered the temperature change. Before adding $\ce{NH4Cl}$, the solution was at room temperature. However, as we kept on adding $\ce{NH4Cl}$ to make the solution saturated and alkaline, the temperature of the solution went down considerably. After some time, it was so cold that water molecules in the atmosphere had started to condense on the outer side of the test tube. The temperature still went down when we added $\ce{NH4OH}$.

Step 4: Now we divided the solution into two parts and through one part, passed $\ce{H2S}$. We got a white precipitate, indicating the presence of Group 4 cation ($\ce{Zn^2+}$).

It must be noted here that as soon as we passed the $\ce{H2S}$ gas, the temperature of the solution again increased to room temperature.

Step 5: To the other part of the solution, we added $\ce{(NH4)2CO3}$. We got a white precipitate, which indicated that Group 5 cations (viz. $\ce{Ba^2+}$, $\ce{Sr^2+}$ or $\ce{Ca^2+}$) was present.

It must be noted that the temperature remained almost same now.

Later, by confirmatory tests, we determined the salts to be $\ce{Ca(CH3COO)2}$ and $\ce{ZnSO4}$.

Can anyone explain what chemical reactions had occurred which were exothermic and endothermic, thus resulting in a change in temperature of the solution?
After the help by @paracetamol, I found that the process of dissolution of $\ce{NH4Cl}$ is an endothermic reaction, which results in the decrease in the temperature of the solution.

An experimental demonstration can be found here.

Greater information may be found here.

Important parts of the second reference:


  When discussing this question, one needs to think about all the processes involved (or at least those that account for most of what happens). In general, any process will occur spontaneously, if $\Delta G$ is negative. To determine $\Delta G$, equation (1) is used.
  
  $$\Delta G = \Delta H - T \Delta S\tag{1}$$
  
  There is an enthalpic term related to the heat a reaction produces or requires and an entropic term that is temperature-dependent. We cannot say a lot about the entropic term a priori, but we can about the enthalpic term — which is luckily what the question is about. For that, we first need to write a reaction equation (2):
  
  $$\ce{NH4Cl (s) + n H2O &lt;=&gt;&gt; NH4+ (aq) + Cl- (aq) + m H2O}\tag{2}$$
  
  Dissolving of the ammonium chloride can also be thought as two separate processes, see equation $(2')$.
  
  $$\ce{NH4Cl (s) -&gt; [NH4+ (g)] + [Cl- (g)] -&gt; NH4+ (aq) + Cl- (aq)}\tag{2'}$$
  
  Meaning that first we break up the ammonium chloride crystal structure and second we dissolve the bare ions. If we want to write that in single enthalpy terms, we can do that as shown in equation (3).
  
  $$\Delta H_\mathrm{tot} = -\Delta H_\mathrm{lattice}(\ce{NH4Cl}) + \Delta H_\mathrm{solv}(\ce{NH4+}) + \Delta H_\mathrm{solv}(\ce{Cl-})\tag{3}$$
  
  All of these values can be looked up. I have given those as calculated by Jenkins and Morris in table.
  
  $$\textbf{Table 1:}\text{ Values of enthalpies used in this answer as}\\\text{quoted from Jenkins and Morris (reference 1).}\\\begin{array}{cccc}\hline
\text{compound} &amp; \Delta H_\mathrm{lattice} [\mathrm{kJ/mol}] &amp; \Delta H_\mathrm{solv} [\mathrm{kJ/mol}] &amp; \Delta H_\mathrm{tot} [\mathrm{kJ/mol}] \\\hline
\ce{NH4Cl} &amp; -709.1 &amp; - 694.7 &amp; 14.4 \\ \hline\end{array}$$
  
  So we need energy (a lot of it!) to break up the crystal lattice of $\ce{NH4Cl}$. We then re-gain energy by creating the hydrated, i.e. dissolved, ions in solution. If energy is required, it is typically (excluding photochemical reactions — not the case here) heat energy which is simply drawn from the surroundings. If energy is released, it is typically (same caveat) released as heat into the surroundings.
  
  Thus:
  
  
  The heat is absorbed by the solid ammonium chloride. It is used to break up the salt crystal according to equation $(2'.1)$. Part of it is re-released (unnoticed) by forming solvent–ion hydrogen bonds (the solvation mechanism of $\ce{NH4Cl}$ — equation $(2'.2)$).
  This heat is drained from the surroundings, which in this case is primarily the water in which you wanted to dissolve the ammonium chloride. (Of course, the solution will then further exchange heat with whatever is around it, meaning that either the air around a bottle/flask or an outer flask as in your described experimental setup will lose heat at the benefit of the $\ce{NH4Cl}$-solution.)