Purix/Arduino Software

Purix A/S produce a solar powered chiller. and to get a better understanding of what I am writing about, I suggest that you first visit Purix here: http://purix.eu/experience

When Purix started their activities, I helped them for a couple of years getting all the “electrical stuff” into good shape. More information about the early days here:

Purix Controller 1

Purix controller 2

I programmed the first two Purix Controller versions (based on the Arduino Mega) while developing the hardware in 2012 – 2014. The Purix system was development during the very same period. Although both the Purix itself and the controller soft- and hardware have undergone a lot of further development since then, the controller software is basically still the same.

Here is an overview of the total Purix setup:


Program Structure:


The drawing above shows the three basic parts of the Purix Controller-sketch (= Arduino program). There is a setup part (“void setup”) that is only called once the controller starts up, and there is the main loop (“void loop”) that handles the physical input/output algorithms to control the Purix system as long as the power is on. The third and very important part is the serial input/output that enables us to monitor and control certain parts of the main loop. This part is not necessary for the actual execution of the controller algorithms, but absolutely essential to experiments and successful testing.


Start/Stop and State Control:


To avoid deadlocks and other nasty real-time pitfalls we use a very strict set of operational states: Standby, starting up, normal operation and closing down. All this takes place within the main loop. Within each state four PID regulators and some additional logic receives state-specific parameters. One can argue that a few more discrete states exist inside the normal operation state, but this is fully under control. This drawing shows how operational state is allowed to change. Until now only an external signal (with a specially developed de-bouncer), timers and some test-commands are allowed to change the states. It is the intention to have a self-check routine that will be able to force the program into closing down state.


The Loop:


This drawing shows in more detail what goes on inside the main loop, and how/where the serial control mechanism can interact. This is an early version. We have now added several extra features: Stepper motor control, triac control, etc. Click to see .pdf: Purix 2 The Loop The Serial Control I have made a very simple set of control commands used in monitoring and manually controlling the execution of the program. The commands consists of one character specifying the command-group (e.g. Read, Write or Control) followed by a second character specifying the sub-level of the command (e.g. P or I parameter). Write commands receive an integer as a third input. The two or three inputs are separated by commas and terminated by a return. The protocol is very simple and effective, with no possibilities to send errors to the program. The parser is inspired by the tutorial found here: http://www.dyadica.co.uk/journal/simple-serial-string-parsing/


Sketch Details by cTOPconsult: