User Tools

Site Tools


eeros_architecture:hal:scaling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
eeros_architecture:hal:scaling [2017/05/11 11:44] – created grafeeros_architecture:hal:scaling [2022/05/06 21:09] (current) jonasfrei
Line 1: Line 1:
 ====== Scale and Range of Analog Signals ====== ====== Scale and Range of Analog Signals ======
-Within eeros we work with signals having physically meaningful units. However, when such signals are read from real-world hardware we use analog-to-digital converters or encoder which are basically counters. When outputting such signals we use digital-to-analog converters. These counters or converters all deliver or need an integer value. Its maximum and minimum value depend on the resolution of the underlying hardware. The ''scale'' and ''range'' key allows to convert between the necessary integer value and the physically meaningsful signals.+Within EEROS we work with signals having physically meaningful units. However, when such signals are read from real-world hardware we use analog-to-digital converters or encoder which are basically counters. When outputting such signals we use digital-to-analog converters. These counters or converters all deliver or need an integer value. Its maximum and minimum value depend on the resolution of the underlying hardware. The ''scale'' and ''range'' key allows to convert between the necessary integer value and the physically meaningful signals. You might have several stages in your hardware, see [[eeros_architecture:hal:scaling_multi|]].
  
 ===== Configuring an Analog Output ===== ===== Configuring an Analog Output =====
 To configure such a channel follow these steps: To configure such a channel follow these steps:
   - Read the datasheet of your hardware and note the upper and lower limits of the analog output voltage.   - Read the datasheet of your hardware and note the upper and lower limits of the analog output voltage.
-  - Enter this limits in the configuration file under ''range'' with ''minOut'' and ''maxOut''.+  - Enter these limits in the configuration file under ''range'' with ''minOut'' and ''maxOut''.
   - Get the upper and lower limits of the digital values of the converter from the datasheet.   - Get the upper and lower limits of the digital values of the converter from the datasheet.
   - Enter this limits in the configuration file under ''range'' with ''minIn'' and ''maxIn''.   - Enter this limits in the configuration file under ''range'' with ''minIn'' and ''maxIn''.
   - Write a small digital value to the analog output directly (not through eeros). That is, if your are using comedi for instance, you use a user interface and write a value of 1000 to one of its analog outputs.   - Write a small digital value to the analog output directly (not through eeros). That is, if your are using comedi for instance, you use a user interface and write a value of 1000 to one of its analog outputs.
-  - Record this value it in the configuration file under ''scale'' as ''minIn''+  - Record this digital value in the configuration file under ''scale'' as ''minIn''
   - Measure the resulting voltage with a multimeter and record it in the configuration file under ''scale'' as ''minOut''.   - Measure the resulting voltage with a multimeter and record it in the configuration file under ''scale'' as ''minOut''.
   - Repeat this with a large digital value close to the upper limit. For this you have to know the range of your digital-to-analog converter.    - Repeat this with a large digital value close to the upper limit. For this you have to know the range of your digital-to-analog converter. 
-  - Record this value it in the configuration file under ''scale'' as ''maxIn'' +  - Record this digital value in the configuration file under ''scale'' as ''maxIn'' 
-  - Measure the resulting voltage with a multimeter and record it in the configuration file as under ''scale'' ''maxOut''.+  - Measure the resulting voltage with a multimeter and record it in the configuration file under ''scale'' ''maxOut''.
  
-The resulting channel configuration will look like:+The resulting channel configuration for a 16bit DAC might look like:
 <code> <code>
   "channel0": {   "channel0": {
     "signalId": "dacOut0",     "signalId": "dacOut0",
     "scale": [ { "id" : "dac",     "scale": [ { "id" : "dac",
-                 "minIn":    2000, "maxIn":  64000,+                 "minIn":    1000, "maxIn":  64000,
                  "minOut": -9.787, "maxOut": 9.923 } ],                  "minOut": -9.787, "maxOut": 9.923 } ],
     "range": [ { "id" : "dac",     "range": [ { "id" : "dac",
Line 28: Line 28:
   }   }
 </code> </code>
 +If you know the scale and offset of your channel you could give these values directly as:
 +<code>
 +  "channel0": {
 +    "signalId": "dacOut0",
 +    "scale": [ { "id" : "dac",
 +                 "scale":  0.5,
 +                 "offset": 2.5 } ],
 +    "range": [ { "id" : "dac",
 +                 "minIn":       0, "maxIn":  65536,
 +                 "minOut":  -10.0, "maxOut":  10.0 } ],
 +    "unit": "V"
 +  }
 +</code>
 +
    
 +===== Configuring an Analog Input =====
 +To configure such a channel follow these steps:
 +  - Read the datasheet of your hardware and note the upper and lower limits of the analog input voltage.
 +  - Enter these limits in the configuration file under ''range'' with ''minIn'' and ''maxIn''.
 +  - Get the upper and lower limits of the digital values of the converter from the datasheet.
 +  - Enter this limits in the configuration file under ''range'' with ''minOut'' and ''maxOut''.
 +  - Enter a small analog voltage value to the analog input and note it in the configuration file under ''scale'' as ''minIn''
 +  - Record the resulting digital input value of the analog-to-digital converter in the configuration file under ''scale'' as ''minOut''. If your are using comedi for instance, you use a user interface to read the digital value. 
 +  - Repeat this with a large voltage close to the upper limit. For this you have to know the range of your analog-to-digital converter. 
 +  - Record this value it in the configuration file under ''scale'' as ''maxIn''
 +  - Record the resulting digital value in the configuration file as ''scale'' ''maxOut''.
 +
 +The resulting channel configuration for a 16bit ADC might look like:
 +<code>
 +  "channel0": {
 +    "signalId": "adcIn0",
 +    "scale": [ { "id" : "adc",
 +                 "minIn":    -9.6, "maxIn":   8.85,
 +                 "minOut":    368, "maxOut": 61344 } ],
 +    "range": [ { "id" : "adc",
 +                 "minIn":   -10.0, "maxIn":   10.0,
 +                 "minOut":      0, "maxOut": 65535 } ],
 +    "unit": "V"
 +  }
 +</code>
 +
 +===== Configuring an Encoder Input =====
 +To configure such a channel follow these steps:
 +  - Read the datasheet of your hardware and note the resolution of your encoder for a full turn.
 +  - Enter this limits in the configuration file under ''scale'' with ''maxOut'' while ''maxIn'' is a full turn in rad.
 +  - The ''range'' with have ''noLimit'' because it might turn forward or backward without limitation.
 +
 +The resulting channel configuration for an encoder might look like:
 +<code>
 +  "channel0": {
 +    "signalId": "enc0",
 +    "scale": [ { "id" : "enc",
 +                 "minIn":   0, "maxIn": 6.28318530718,
 +                 "minOut":  0, "maxOut":         4096 } ],
 +    "range": [ { "id" : "enc",
 +                 "noLimit": true } ],
 +    "unit": "rad"
 +  }
 +</code>
eeros_architecture/hal/scaling.1494495858.txt.gz · Last modified: 2017/05/11 11:44 by graf