We all know that our Campbell Scientific dataloggers are really good at taking measurements and storing data. But did you know that they can also make decisions and control other devices? It's true! Your datalogger can turn a cellular phone modem or GPS receiver on and off to conserve power. It can trigger a water sampler to collect a sample or a camera to take a picture. It can activate an audio or visual alarm. What do you need to control? Have the datalogger do it!
Typically, your devices are physically connected to the datalogger using one of the digital I/O ports (C1-C8) or the SW12V (switched 12 volt).
|“Excuse me, Tip. Why are the digital I/O ports labeled C1 through C8?!?”
I'm glad you asked. Back in the old days, before CRBasic dataloggers,
those ports were called control ports. They have a lot more capability
now but haven't lost that feature.
Each digital I/O port can be set low (0 Vdc) or high (5 Vdc) using the PortSet() or WriteIO() instruction. A digital I/O port is normally used to operate an external relay driver circuit because the port itself has limited drive capacity.
There are also synchronous devices for measurement (SDMs) (www.campbellsci.com/sdm) that can get the job done. In addition, some SDM devices are continuous analog output (CAO) modules. CAO modules output continuous adjustable voltages required for strip chart and variable control applications.
That's the hardware we need to do control. What would the program look like? Often, the decision to do something is based on time, an event, or a measured condition. Let's take an example of turning on and off a cell phone based on time. The modem requires 12V power, so, we'll connect its power wire to the datalogger's SW12V. For ten minutes at the top of the hour, the phone will be on. The TimeIntoInterval() instruction is great for doing something based on the datalogger's clock. We'll embed it in an if/then logic statement like this:
If TimeIntoInterval ( 0,60,Min) Then PortSet (9,1) 'Port “9” is the SW12V Port. Turn phone on.
If TimeIntoInterval (10,60,Min) Then PortSet (9,0) 'Turn phone off.
Remember, if you turn a piece of hardware on under datalogger control, you also need to turn it off. Just having a condition be false does not change the state of the port.
Use your Campbell Scientific datalogger to:
The possibilities are endless!
Always out of control,