Answers.Body: <p>L and S very probably refer to load and supply voltage.  See <a href="https://en.wikipedia.org/wiki/Electrical_load" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Electrical_load</a> for details.</p>
  <p>Experimentally, I have not observed any significant differences between these values in use (possibly because the source resistance is small).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-14T13:06:42.957Z
Answers.Text: I think you could be right with that... But I cannot set the answer yet to correct. Since it is speculation I guess.
Answers.UserDisplayName: Thomas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-14T13:09:56.170Z
Answers.Text: There are LowVoltage = 0x01, HighCurrent = 0x02, and OverPowerCondition = 0x04 hub alerts. I could imagine there is a direct relation between these exposed alerts and the voltage / current modes.
Answers.UserDisplayName: Thomas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-14T02:39:43.370Z
Answers.LastActivityDate: 2020-07-14T02:39:43.370Z
Answers.UserDisplayName: frasertweedale
Answers.Body: <p>There doesn't appear to be an obvious difference between these two according to <a href="https://github.com/virantha/bricknil/blob/0610d8af76954b8b970956b86a5e59511b83389d/bricknil/sensor/sensor.py#L440" rel="nofollow noreferrer">a comment in the bricknil source</a>:</p>
  <blockquote>
  <p>Voltage Sensor</p>
  <p>Returns the raw mV value (0-3893) which probably needs to be scaled to 0-9600.</p>
  <p>It contains two capabilities, although they both appear to do the same thing:</p>
  <ul>
  <li>sense_l</li>
  <li>sense_s</li>
  </ul>
  </blockquote>
  <p>They appear to both return the same results in the same way.</p>
  <p>There are some low-level ways that these could be different, but I'm not aware of efforts to reverse engineer the firmware and/or boards to that degree, and I'm not aware of documentation that covers this. The official <a href="https://lego.github.io/lego-ble-wireless-protocol-docs/" rel="nofollow noreferrer">LEGO BLE docs</a> don't go into this level of detail about the voltage sensor.</p>
  <p>Here are a couple speculative possibilities:</p>
  <ul>
  <li>It is common for analog to digital converters to have different modes of operation that trade off speed and accuracy. VLT L and VLT S could make use of different sampling modes and/or averaging. For example, ST discusses using averaging to improve their ADC accuracy <a href="https://www.st.com/content/ccc/resource/technical/document/application_note/c4/63/a9/f4/ae/f2/48/5d/CD00258017.pdf/files/CD00258017.pdf/jcr:content/translations/en.CD00258017.pdf" rel="nofollow noreferrer">here</a> for the ST32 chips used in Powered Up parts.</li>
  <li>L and S could represent values at different stages in the power subsystem (e.g. regulated voltage vs battery voltage).</li>
  <li>These could be reserved for use in devices with multiple monitored cells. SPIKE Prime and Mindstorms both use 2 lithium cells in series. These cells are monitored individually, and it could be useful to access their values separately. This doesn't necessarily apply to Control+, but parts of the firmware are likely shared across devices.</li>
  </ul>
  <p>I wish I had a better answer for you, but that's the best I could find from digging around. I hope that someone here knows more about this than I do. I'll certainly update this answer if I figure out anything more about this.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-14T13:14:26.660Z
Answers.Text: Bricknil source understanding is the same as mine. I think the different stages as outlined in the other comment is the best guess we might have.
Answers.UserDisplayName: Thomas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-13T13:46:49.653Z
Answers.LastActivityDate: 2020-07-13T13:46:49.653Z
Answers.UserDisplayName: jncraton
Body: <p>As a computer science with limited Electrical Engineering Knowledge, I wonder what the <code>VLT L</code> and <code>VLT S</code> modes (and the Current counterparts) in the TechnicMediumHub (Control+ Hub) Voltage device are?</p>
  <p>I am in process of writing a <a href="https://github.com/sharpbrick/powered-up" rel="nofollow noreferrer">.NET library for PoweredUp</a> where I want to present a human readable interpretation of it.</p>
  <p>Below the dump of the Port(Mode)Information messages.</p>
  <pre><code>Port: 60
      IOTypeId: Voltage
      HardwareRevision: 1.0.0.0
      SoftwareRevision: 1.0.0.0
      OutputCapability: True
      InputCapability: False
      LogicalCombinableCapability: True
      LogicalSynchronizableCapability: False
      ModeCombinations: []
      UsedCombinationIndex: 0
      MultiUpdateEnabled: False
      ConfiguredModeDataSetIndex: []
      Mode: 0
        Name: VLT L
        IsInput: True
        IsOutput: False
        RawMin: 0
        RawMax: 4095
        PctMin: 0
        PctMax: 100
        SIMin: 0
        SIMax: 9615
        Symbol: mV
        InputSupportsNull: False
        InputSupportFunctionalMapping20: False
        InputAbsolute: True
        InputRelative: False
        InputDiscrete: False
        OutputSupportsNull: False
        OutputSupportFunctionalMapping20: False
        OutputAbsolute: False
        OutputRelative: False
        OutputDiscrete: False
        NumberOfDatasets: 1
        DatasetType: Int16
        TotalFigures: 4
        Decimals: 0
        DeltaInterval: 0
        NotificationEnabled: False
      Mode: 1
        Name: VLT S
        IsInput: True
        IsOutput: False
        RawMin: 0
        RawMax: 4095
        PctMin: 0
        PctMax: 100
        SIMin: 0
        SIMax: 9615
        Symbol: mV
        InputSupportsNull: False
        InputSupportFunctionalMapping20: False
        InputAbsolute: True
        InputRelative: False
        InputDiscrete: False
        OutputSupportsNull: False
        OutputSupportFunctionalMapping20: False
        OutputAbsolute: False
        OutputRelative: False
        OutputDiscrete: False
        NumberOfDatasets: 1
        DatasetType: Int16
        TotalFigures: 4
        Decimals: 0
        DeltaInterval: 0
        NotificationEnabled: False
  </code></pre>
  
Tags: <powered-up>
Title: Technic Medium Hub - What is the difference between Voltage L and S?
UserDisplayName: Thomas
ThreadText: # Technic Medium Hub - What is the difference between Voltage L and S?
  
  (Asked by: username_0 on 2020-07-10)
  
  As a computer science with limited Electrical Engineering Knowledge, I wonder what the `VLT L` and `VLT S` modes (and the Current counterparts) in the TechnicMediumHub (Control+ Hub) Voltage device are?
  
  I am in process of writing a [.NET library for PoweredUp](https://github.com/sharpbrick/powered-up) where I want to present a human readable interpretation of it.
  
  Below the dump of the Port(Mode)Information messages.
  
  ```
  Port: 60
      IOTypeId: Voltage
      HardwareRevision: 1.0.0.0
      SoftwareRevision: 1.0.0.0
      OutputCapability: True
      InputCapability: False
      LogicalCombinableCapability: True
      LogicalSynchronizableCapability: False
      ModeCombinations: []
      UsedCombinationIndex: 0
      MultiUpdateEnabled: False
      ConfiguredModeDataSetIndex: []
      Mode: 0
        Name: VLT L
        IsInput: True
        IsOutput: False
        RawMin: 0
        RawMax: 4095
        PctMin: 0
        PctMax: 100
        SIMin: 0
        SIMax: 9615
        Symbol: mV
        InputSupportsNull: False
        InputSupportFunctionalMapping20: False
        InputAbsolute: True
        InputRelative: False
        InputDiscrete: False
        OutputSupportsNull: False
        OutputSupportFunctionalMapping20: False
        OutputAbsolute: False
        OutputRelative: False
        OutputDiscrete: False
        NumberOfDatasets: 1
        DatasetType: Int16
        TotalFigures: 4
        Decimals: 0
        DeltaInterval: 0
        NotificationEnabled: False
      Mode: 1
        Name: VLT S
        IsInput: True
        IsOutput: False
        RawMin: 0
        RawMax: 4095
        PctMin: 0
        PctMax: 100
        SIMin: 0
        SIMax: 9615
        Symbol: mV
        InputSupportsNull: False
        InputSupportFunctionalMapping20: False
        InputAbsolute: True
        InputRelative: False
        InputDiscrete: False
        OutputSupportsNull: False
        OutputSupportFunctionalMapping20: False
        OutputAbsolute: False
        OutputRelative: False
        OutputDiscrete: False
        NumberOfDatasets: 1
        DatasetType: Int16
        TotalFigures: 4
        Decimals: 0
        DeltaInterval: 0
        NotificationEnabled: False
  
  ```
  
  **Tags:** powered-up
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-07-14. Score: 2
  
  L and S very probably refer to load and supply voltage. See <https://en.wikipedia.org/wiki/Electrical_load> for details.
  
  Experimentally, I have not observed any significant differences between these values in use (possibly because the source resistance is small).
  
  > **Comments:**
  > **username_0**: I think you could be right with that... But I cannot set the answer yet to correct. Since it is speculation I guess.  
  > **username_0**: There are LowVoltage = 0x01, HighCurrent = 0x02, and OverPowerCondition = 0x04 hub alerts. I could imagine there is a direct relation between these exposed alerts and the voltage / current modes.  
  
  ---
  
  ### Answer by username_2 on 2020-07-13. Score: 1
  
  There doesn't appear to be an obvious difference between these two according to [a comment in the bricknil source](https://github.com/virantha/bricknil/blob/0610d8af76954b8b970956b86a5e59511b83389d/bricknil/sensor/sensor.py#L440):
  
  > Voltage Sensor
  >
  > Returns the raw mV value (0-3893) which probably needs to be scaled to 0-9600.
  >
  > It contains two capabilities, although they both appear to do the same thing:
  >
  > * sense\_l
  > * sense\_s
  
  They appear to both return the same results in the same way.
  
  There are some low-level ways that these could be different, but I'm not aware of efforts to reverse engineer the firmware and/or boards to that degree, and I'm not aware of documentation that covers this. The official [LEGO BLE docs](https://lego.github.io/lego-ble-wireless-protocol-docs/) don't go into this level of detail about the voltage sensor.
  
  Here are a couple speculative possibilities:
  
  * It is common for analog to digital converters to have different modes of operation that trade off speed and accuracy. VLT L and VLT S could make use of different sampling modes and/or averaging. For example, ST discusses using averaging to improve their ADC accuracy [here](https://www.st.com/content/ccc/resource/technical/document/application_note/c4/63/a9/f4/ae/f2/48/5d/CD00258017.pdf/files/CD00258017.pdf/jcr:content/translations/en.CD00258017.pdf) for the ST32 chips used in Powered Up parts.
  * L and S could represent values at different stages in the power subsystem (e.g. regulated voltage vs battery voltage).
  * These could be reserved for use in devices with multiple monitored cells. SPIKE Prime and Mindstorms both use 2 lithium cells in series. These cells are monitored individually, and it could be useful to access their values separately. This doesn't necessarily apply to Control+, but parts of the firmware are likely shared across devices.
  
  I wish I had a better answer for you, but that's the best I could find from digging around. I hope that someone here knows more about this than I do. I'll certainly update this answer if I figure out anything more about this.
  
  > **Comments:**
  > **username_0**: Bricknil source understanding is the same as mine. I think the different stages as outlined in the other comment is the best guess we might have.  
  
  ---
  
  