As mentioned last month, a major feature of the USB Data Logger is its custom scripting language. This makes it very versatile and allows it to be interfaced to many different sensor types. It can be interfaced to most digital sensors, almost all I2C and 1-wire sensors, and almost any analog sensor, frequency input or counter.
Custom scripting also makes it highly configurable. If you have a logging application in mind, this unit will almost certainly be suitable.
The accompanying PC software is used to compile the custom “scripts”. These provide the instructions for reading the various sensors and for processing the data. So this unit can not only log data but can also analyse that data!
Towards the end of this article, we run through a number of scenarios and give some example custom scripts. These are a good starting point for learning to write scripts for your own logging applications.
What it can do
Before moving on to the construction, let’s run through a few things the USB Data Logger can do.
First, if you have a weather station, you can log a whole day’s worth of temperatures and then compute the average. You could also extract the daily maximum and minimum temperatures and log them as well.
Second, if you have a number of digital sensors connected to the I2C bus, you can send commands to read from them, log their values or send commands to power them down during extended periods when no logging needs to occur. Note that the USB Data Logger itself will automatically switch into standby mode during extended periods of inactivity to save power.
You can also read from a sensor and execute code depending on the reading reported by the sensor. For example, if you have a temperature sensor, you can monitor its value and turn an external relay on or off (eg, to control an air-conditioner) if the value is outside a specific range.
These are just some examples of what is possible.
If you’ve ever programmed before, it should be very easy to understand and write programs for the USB Data Logger (the scripting language’s syntax is simple and loosely based on C). If not, we give a very quick introduction at the end of this article, with a number of examples showing code that can be used.
It shouldn’t take too long to learn and a full description of the language can be downloaded as a PDF file from the January 2011 section of the SILICON CHIP website – www.siliconchip.com.au
Fig.2: install the parts on the PC board as shown on this layout diagram, starting with surface-mount parts REG1 (bottom, left) and CON1 (the memory card socket). The photo at right shows the fully-assembled board. Note that there are some minor differences between this unit and the final layout shown above.