You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To perform measurements of an input terminal configured as RTD use built-in function `pinCurrent()` as shown below:
3424
+
To perform measurements of an input terminal configured as RTD use the built-in function `getRtd()` as shown below:
3425
3425
3426
3426
```arduino
3427
-
float value = exp.pinCurrent(<input>);
3427
+
float value = exp.getRtd(<input>); // this returns the resistive value measured in the input in ohms
3428
3428
```
3429
3429
3430
-
The following example will let you measure the current in all the analog inputs of every expansion connected at once, this sketch is based on the built-in example found in **File > Examples > Arduino_Opta_Blueprint > Analog > ADC**:
3430
+
For the following example a 2 wires **PT1000** will be used connected to **I1**. The sketch below will let you measure the resistance and convert it to a temperature value. This sketch is based on the built-in example found in **File > Examples > Arduino_Opta_Blueprint > Analog > RTD**:
Please take into account that `OptaController.update()` must be called cyclically to support the hot plug of new expansions. In other words, by calling the update() function cyclically, the controller will discover new expansions when they are plugged in while the controller is already running.
3548
+
3549
+
Thanks to this function, the action of plugging in a new expansion will cause the controller to start a completely new discovery process and a new I2C address assignment.
3550
+
3551
+
`OptaController.update()` function DOES NOT:
3552
+
* Check if an expansion has been removed and remove their objects
3553
+
* Update any data from or to the expansion
3554
+
3555
+
The expansion object in the example above is defined using the `OptaController.getExpansion(i);` function, as follows:
3556
+
3557
+
```arduino
3558
+
for(int i = 0; i < OptaController.getExpansionNum(); i++) { // check all the available expansion slots
The above method will check if there is an Ext A0602 expansion connected in the `i` index from the five admitted. This will ensure which expansion the read state belongs to.
3563
+
3564
+
The expansion channels are configured as **RTD inputs** using the function `beginChannelAsRtd` alongside the following parameters:
3565
+
3566
+
```arduino
3567
+
AnalogExpansion::beginChannelAsRtd(OptaController, i, // the device
3568
+
k, // the output channel you are using
3569
+
false, // use 3 wire RTD
3570
+
0.2); // current used on RTD in mA
3571
+
```
3572
+
3573
+
The current parameter in the function above will depend on your RTD type, study your sensor datasheet to find the more suitable for it, in this case, the **PT1000** used recommends a **0.2 mA** current.
3574
+
3575
+
The function `optaAnalogTask()` reads all the RTDs connected and converts their resistive value to a temperature.
3576
+
3577
+
After the Opta™ controller is programmed with the example sketch, open the Arduino IDE Serial Monitor and you will see each input reading as follows:
0 commit comments