29 - 11 - 2020

Logger for temperature and huidity

Experiment: Logger of temperature and humidity.

AltonaLab diagram: KIT_TempHumLogger.nsm

Used hardware:

  • Numato 8 channel USB GPIO Module;
  • Connector board for ADC 5V;
  • AltonaLab temperature sensor;
  • AltonaLab humidity sensor;
  • 5V multi connector power supply board;
  • 220V to 12V, 2A power supply;

 For this experiment, we will use the same hardware diagram, as in previous experiment for measurement of temperature and humidity:

A real image of the connected boards:

An used AltonaLab diagram, after 10 min work:



 The first part of the AltonaLab diagram is the same as the previous experiment for Measure of temperature and humidity. At this first part are used functional block for Numato board, then two sensor blocks AltonaSensorTemp, AltonaSensorHumidity. The outputs of the sensors blocks are shown with Text controls in Red (temperature) and Blue (humidity) colors.

The special in this diagram are the bottom two blocks DBFStorage and DataSetImage:

  • Block DBFStorage - save the measured values from sensors in DBF database. This kind of database is perfect for some applications where only one software saves/reads data. The database is very fast. The important parameters of this block are:

- FullDBFFileName - here has to be entered the file path and file name of the used DBF. Then when a columns are set in parameter DataSet, the DBF database will be automatically designed and saved to this file;

- StoreType - determines the time type of the parameters StoreLast and StoreLastAtMemory, can get the next values: LastRecords, LastSeconds, LastMinutes, LastHours, LastDays;

- StoreLast - determines how many last measured values to be saved at the DBF database. For example, if StoreType is LastMinutes and StoreLast is 10, all the records in the DBF older than 10 min, will be deleted automatically. This is a tricky way the contains of the database to be self maintaining and the database size will never become too large;

- StoreLastAtMemory - determines how many last measured values to be stored at the block's memory and determines the contains of the output DataSet, which then will be shown in the Image control.

 - DataSet - this is a very important parameter, which describes the design of the database. At ort case, the database has three columns - Date, which has to be checked as Leading date column and is with Date data type, column Temp - with Analog data type and column Hum with analog type. We can add unlimited amount of columns. When we confirm this parameter, the DBF database will be redesigned with all the needful changes. At our case, the DBF database will consists of three columns: Date, Temp, Hum, and one index over the leading Date column. All the columns will appear as inputs of the block, as it is visible from the diagram, the block DBFStorage contains the inputs Date, Temp, Hum. The input Date is connected with CurrTime block, from where the current time will be gotten.

Parameters of DBFStorage:


The DBFStorage block has an input Append, which is connected to the output of the block PulseGenerator, which gets a pulse on every one second. This means, DBFStorage block will add a new record with measured values to the DBF database on every one second. Every time, a new record is added, the output OnReady of the block becomes for a short time to a high level and signals the next block DataSetImage to draw the new contains of the database.

If the AltonaLab diagram is stopped and after a time is started again, the contains of the DBF database will be loaded automatically and the existing measured data will be shown together with the new measured data. An empty hole will be visible between the two parts of the data - an old one and a new one. 

  • Block DataSetImage - the block is connected to the Image control and shows the contains of the DataSet which is connected to the block's input InDataSet. In our case, this is the contains of the block DBFStorage. The important parameters of the block are:

- PeriodTime - determines the type of parameter Last. Can be WholePeriodInDataSet, LastSeconds, LastMinutes, LastHours, LastDays;

- Last - determines how many last stored at the input DataSet values to be shown. For example, if the parameter PeriodType is LastMinutes and parameter Last is 10, the DataSetImage block will show the last 10 minutes existing in the dataset gotten from the input InDataSet of the block.

- Connected to Image Control - using this parameter the functional block is connected to the available on the diagram Image control;

- DataSet - with this most important parameter we can design which columns from the input dataset InDataSet of the block to be shown on the Image control, theirs Min/Max values and dot's colors. In our case, the columns are Date with Date data type, Temp with Analog data type and Hum with Analog data type. The column Temp is set to be shown in range 10...60 in Red color. The column Hum is set to be shown in range 0..100 in Blue color. Date column is from a leading column with Date data type and is used for X axis of the image. The trick here is - at this parameter can be described more or less column than into the input DataSet, which is gotten from DBFStorage, but the block DataSetImage will show only the data, if the column described in DataSetImage exists into the input InDataSet gotten from the previous block.

Parameters of DataSetImage:


Some ideas for the experiment:

  • To see the changes at the graphic, you can touch with fingers the temperature sensor, which will increase the temperature or can blow your breath over the humidity sensor, which will increase the humidity;
  • Can change the parameters of the block DBFStorage: StoreType to LastDays, StoreLast and StoreLastAtMemory to 7. Then to change the parameters of the block DataSetImage: PeriodType to LastDays and Last to 7. Then change the parameter Value of the block PulseGenerator to 60. The result will be a weekly logger. Always be careful and calculate how much records you expect to be stored at DBF and how much at the memory. Too many stored records are danger. For example, if every second is added a new record at the logger which store and show one week period, the total amount of the records are: 7days*24h*60min*60sec = 604,800 records. This records are too many for the computer memory. We can decrease them when we store one record per minute instead of one record per second. If we save one record per minute, the amount of the records for one week are: 7days*24h*60min = 10,080 records. At this case the system will work better. With one record per minute, we can achieve monthly or annual logger too.
  • For long period logger, we can make some other optimization as to read the sensor's values on every 20 sec, instead one time per second. This is the parameter CommunicatePerSec of the Numato functional block;