Use the 1wire

This page has been updated on the 26 April 2011.

Supported 1wire devices

Type Reference
Temperature sensor DS18S20
Serial number iButton DS1990A-F3/F5
1kbit/4kbit Memory iButton DS1992L
Hygrometer/Humidity sensor Based on DS2438 (specific project)

Connect a temperature sensor

Wiring

This table explains how to connect a 1wire temperature sensor to a C4-E

Temperature Sensor C4-Evo
Red wire Grey wire
Black wire Black wire

If you have to connect 2 or more temperature sensors we advise the following wiring:

Once connected, connect the basics console (screen 0) and type 1wire to display the detected device(s).

Configuration

To record the temperature sensors values you need to enable the parameters dataRecorder.fieldPeriod[28] to [37].

fieldPeriod DB variable Comment
[28] MDI_TEMP_1 temperature sensor 1
[29] MDI_TEMP_2 temperature sensor 2
[30] MDI_TEMP_3 temperature sensor 3
[31] MDI_TEMP_4 temperature sensor 4
[32] MDI_TEMP_5 temperature sensor 5
[33] MDI_TEMP_6 temperature sensor 6
[34] MDI_TEMP_7 temperature sensor 7
[35] MDI_TEMP_8 temperature sensor 8
[36] MDI_TEMP_9 temperature sensor 9
[37] MDI_TEMP_10 temperature sensor 10

Note: It’s possible to assign a temperature sensor to a specific fieldPeriod via the table temperatureSensor.sensor_table[x].

  1. Type #SWITCH# to open the basics console.
  2. Type 1wire to display the list of connected sensor. You should connect the sensor one by one to know their id.
  3. Type s dataRecorer fieldPeriod 28 60 to activate the first temperature sensor and record the value every 60 seconds.
  4. Type s dataRecorer fieldPeriod 29 60 to activate the second temperature sensor and record the value every 60 seconds.
  5. Type s temperatureSensor sensor_table[1] 14000802290bf110 to place the sensor 14000802290bf110 at the first position.
  6. Type s temperatureSensor sensor_table[2] 2800080153df8710 to place the sensor 2800080153df8710 at the second position.
  7. Type reboot to reset the device.

Read the chapter Set a parameter value to help you configuring the device.

Get the sensor values

Read this page if you never used the CloudConnect.

1. Log on the CloudConnect.
2. On the top frame select Site index > Tracking and History.
3. Select Toggle.
4. In RET add id, unitid, time, fieldid and data.
5. In Fieldids add 28 to get the fieldPeriod[28] values.
6. In Unitids add the id of your unit(s).
7. Browse the page then select Filter.

On the picture we can see the all data are empty, the reason is that the values are stored in hexadecimal. To access to the data you need to use the API output format xml, json or ext_json. The following sample is in ext_json.

In this example we have three records. The values stored in the line “value” are in hexadecimal and must be converted in decimal.

Hexadecimal Decimal Comment
%00%1B 27 27 degrees celcius
%00%1C 28 28 degrees celcius
%00%1B 27 27 degrees celcius

Connect an iButton

Wiring

This table explains how to connect a 1wire temperature sensor to a C4-E

iButton (standard) C4-Evo
Red wire Grey wire
Black wire Black wire

Once connected, connect the basics console (screen 0) and type 1wire to display the detected device(s).

Configuration

To record the iButton value you have to enable the parameter dataRecorder.fieldPeriod[27].

  1. Type #SWITCH# to open the basics console.
  2. Type s dataRecorer fieldPeriod 27 0 to record the iButton on event (each time the value is updated).
  3. Type reboot to reset the device.

Read the chapter Set a parameter value to help you configuring the device.

Get the badge values

Read this page if you never used the CloudConnect.

1. Log on the CloudConnect.
2. On the top frame select Site index > Tracking and History.
3. Select Toggle.
4. In RET add id, unitid, time, fieldid and data.
5. In Fieldids add 27 to get the fieldPeriod[27] values.
6. In Unitids add the id of your unit(s).
7. Browse the page then select Filter.

Here is a sample.

Here is the result in ext_json.

You can see three different records. The first record is empty which means no badge is plugged in the iButton reader. The next records means the badge c100000a816f6c01 has been plugged then unplugged a few minutes later.