Creating crystals

Creating crystals

One of us recently bought one of these scientific kits for children. Yes, at Yoctopuce, we still are big kids :-) The idea was to grow crystals, but frankly the result wasn't very convincing. We ended up with a pile of ridiculously small crystals at the bottom of a plastic cup. Nothing like what was promised on the box. We wondered if we could better the concept with some Yoctopuce modules. Let's see if we can do as well as Walter White...

The principle

The principle is rather simple: you dissolve any chemical substance in water and wait for it to crystallize. Indeed, the atoms of some substances have a natural tendency to organize themselves in an ordered manner, and this creates crystal structures. To reach this result, you must dissolve a maximum of the said substance in hot water until you obtain a saturated solution, that is until you can't dissolve anything more. This saturation limit depends on the temperature: the hotter the water, the larger the quantity of substance that you can dissolve. Then, you let the solution cool down. The temperature going down, the saturation level diminishes and the dissolved substance reappears as crystals. But several phenomena can interfere:

  • If the temperature goes down too fast, instead of obtaining large and very regular crystals, you obtain a pile of minuscule crystals growing anarchically
  • If the solution temperature goes up again, the crystals dissolve again

The temperature must therefore go down very slowly, without ever going up again. Hence the idea of the magnetic hotplate stirrer discussed last week and of precisely controlling how the temperature goes down with a Yocto-RS232.

We are going to control the temperature with our magnetic hotplate stirrer,  AG802 model
We are going to control the temperature with our magnetic hotplate stirrer, AG802 model

Temperature control and PID

So we have a magnetic hotplate stirrer, model AG802. This model contains a PT100 probe which is supposed to enable it to precisely control the temperature of the liquid that it heats. Theoretically, you only need to ask the stirrer to heat the liquid to a very precise temperature to obtain a liquid at the requested temperature, to the tenth of a degree. But there is a hitch: the AG802 control is rather faulty: we observe sustained oscillations of several degrees, which is not at all good for us.

The AG802 temperature control is not quite up to par
The AG802 temperature control is not quite up to par

We therefore decided to make our own control with a Yocto-PT100 and a control algorithm.

We used a Yocto-RS232 and a  Yocto-PT100 to drive the AG802
We used a Yocto-RS232 and a Yocto-PT100 to drive the AG802

You could think that to obtain a stable temperature, you only need to heat until the desired temperature is reached. Well, that's not the case. Heating a liquid is a process with a great inertia, and it's the best way to induce oscillations. You must use a subtle method, such as a PID.

What's a PID?

A PID is a closed loop control algorithm. There is a whole mathematical theory behind it, but we are going to make it simple and easy to use. We have a black box taking a value as input, and returning another value as output. In our case, the black box is the AG802, the input is the requested temperature and the output is the actual temperature of the liquid. The PID consists in working on the error, that is on the difference between the desired temperature and the actually obtained one. We compute the setpoint as a combination of three factors, the first one Proportional to the error, the second one proportional to the Integral of the error, and the third one proportional to the Derivative of the error, hence the PID name.

In real life, we work by iterations. At each iteration, we measure the error E and we memorize this error over the N latest iterations in an E[0]...E[N-1] array. We then compute the sum of:

  • A*E[N-1], that is the latest error, it's the P in PID
  • B*(E[0]+E[1]+...E[N-1])/N, that is the error average over the N latest iterations, in other words the integral divided by N. It's the I in PID
  • C*(E[N-1]-E[0])/N, that is the derivative of the error over the latest N iterations. It's the D in PID

And we provide this sum directly to the black box as the setpoint for the next iteration. Indeed, the remarkable feature of PIDs is that the value to be reached appears only indirectly in the computation of the request. A, B, C are arbitrary coefficients that you can modify to optimize the PID behavior. There are many tutorials on this subject on Internet. We were lucky, we obtained a stable temperature at the first try with N=100, A,B,C=1.0 and a 4Hz sampling.

AG802 control vs. a PID-based control
AG802 control vs. a PID-based control

To avoid risking to burst the glass by heating it too fast, we voluntarily limited the temperature rise of the stirrer. This explains the incline difference between the two curves. Hardware aspects being settled, we can at last go into the thick of things, that is creating crystals.

Creating "seeds"

You must know that a solution crystallizes preferably around singularities present in the solution. These singularities can be:

  • Impurities, that's why you should use distilled water
  • Asperities, that's why the container should preferably be made of glass
  • Colder areas
  • An already formed crystal

The idea is therefore to prepare a small quantity of more or less saturated solution and to poor it in a flat-bottom container. In cooling down, the solution produces a great number of not very pretty small crystals. We can then take one of these crystals and use it as a seed .

Poor a small quantity of the solution in a container, leave it to cool down in the open And you obtain a very large number of minuscule crystals
Cristal seeds preparation

Creating the crystals

To create the crystals themselves, you must prepare a saturated solution. To do so, you can compute the quantity of matter to use to reach saturation in given water volume, with a given temperature. Or you can use an empirical method by adding matter until you can't dissolve anymore and then slightly increase the temperature to dissolve the excess.

When the solution is ready, you must collect a small crystal seed, attach it at the end of a very thin nylon string, hang it into the solution, and leave everything to cool very slowly. It is imperative to cover the container to avoid water evaporating too fast. However, the cover doesn't need to be sealed.

We hang the crystal in the solution
We hang the crystal in the solution

The solution must be as close to the saturation point as possible. If the solution is not saturated enough, the seed is going to dissolve before crystals start forming. And if you go above the saturation point, crystals are going to form around particles that couldn't dissolve.

For our crystals, we heated the solution up to 60░C and we let it cool down at the rhythm of about 10░ per day. We used the same substance as was used in our scientific kit, that is monoammonium phosphate which has the particularity to crystalize as very spectacular needles. But there are many other water soluble substances which can crystallize: copper sulfate, potassium alum, simple table salt, or even sugar.

After a few days, we obtained an enormous crystal
After a few days, we obtained an enormous crystal

Finally, here are some pictures of some monoammonium phosphate crystals we made, we also made a little time-lapse showing crystals formation.




We could have concluded by saying that, once more, we succeeded in solving an issue thanks to Yoctopuce modules. In fact, the true moral of the story is that, in the opposite to what we usually do which is to always select the best tools, even if we have to pay the price, this time we bought the cheapest stirrer with an RS232 port that we could find. In hindsight, from a salary standpoint, the time needed to make the AG802 behave correctly would have largely covered the price difference with a high-end device.

Add a comment No comment yet
Back to blog

Yoctopuce, get your stuff connected.