2020-08-02 / Blog 4

Controlling external devices with data loggers

I must warn you that I am not a professional electrician. If you are unsure about whatever you are doing, please consult a professional. Before attempting to follow what has been suggested here, please read about electrical safety first. If you think there are any mistakes in this text, please contact me.

This week will be a break from coding, and will be on instrumentation, in particular controlling an external device with data loggers. You might have the need to control an external device, an alarm, sampler, camera, modem, heater, fan etc., either in the laboratory or in the field while monitoring the changes in your setup. The example I will give will be using a heating element to activate when the temperature drops below a threshold and to deactivate when the temperature is above the threshold. Campbell Scientific data loggers are used in many applications worldwide, and we use a CR1000x in our laboratory to measure various parameters mostly in student projects.

CR1000x, and many other data loggers, has control ports that can be set as low (0 VDC) or high (generally 5 VDC), but they have limited drive capacity to run an external device (Campbell, 2020). So, therefore you need an external relay-driven circuit to run your device. Relay, in very simple terms, is like a switch. When the control port is set "high", the relay activates the rest of the circuit.

The first thing we need is a solid-state relay. We have chosen a Crydom D1D07 for this example. There are two things you need to check. The first is the range of control voltage of your relay. When the control port is set to high, a 5 VDC is applied. Therefore, the range of the relay should cover this. The model we have chosen has a range between 3.5 to 32 VDC. Therefore, we the first criteria is met. The second thing to check is the maximum load voltage and current. This is decided based on the requirement of the device that we want to run. For example, we can have an enclosure heater, with a supply voltage of 12 VDC and an output power of 20 W. This gives us a current value of 1.67 amps. The relay we have chosen has a maximum load voltage of 100V and a current of 7 amps. So, this criteria has also been met.

We see that the relay has 4 connections, 2 for output and 2 for input. What we need to do to complete the circuit is the following (also illustrated in the figure):

  •  Connect the live cable from the power supply to the port 1 of the relay

  •  Connect the neutral cable from the power supply to the neutral of the device

  •  Connect the live cable from the device to the port 2 of the relay

  •  Connect the ground of the data logger to the port 3 of the relay

  •  Connect one of the control ports, i.e. C1-C4, on the data logger to the port 4 of the relay

The connections are now finished. We need to add a control sequence to the program of the data logger now using a simple if-else algorithm.