Announcement

Collapse
No announcement yet.

Rev Hub Voltage and Current?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rev Hub Voltage and Current?

    Are there simple ways my students could .get the current supply voltage and current draw for the control & expansion hubs? Or even for more specific things like current the motor controllers or servo controllers are drawing?

    I see examples online using Open-FTC or the like. But the Rev documentation page makes it *seem* like this ought to be supported in the primary/standard SDK the kids are provided with.

    TIA

    Coach Z

  • #2
    <RE12>.g allows voltage and/or current sensors to connect between the battery pack and the REV Expansion Hub or REV Control Hub. I would suggest this voltage & current sensor.

    Comment


    • #3
      Originally posted by Alec View Post
      <RE12>.g allows voltage and/or current sensors to connect between the battery pack and the REV Expansion Hub or REV Control Hub. I would suggest this voltage & current sensor.
      Sorry, that link was for a 10A sensor which is too low. Here is a 20A sensor

      Comment


      • #4
        Originally posted by zain View Post
        I see examples online using Open-FTC or the like. But the Rev documentation page makes it *seem* like this ought to be supported in the primary/standard SDK the kids are provided with.
        Indeed, support for accessing the current monitors was integrated into the official SDK in v5.4. The DcMotorEx class supports has a getCurrent(CurrentUnit unit) method call and the LynxModule class has the getCurrent(CurrentUnit unit) (for the whole module), the getGpioBusCurrent(CurrentUnit unit), and the getI2cBusCurrent(CurrentUnit unit) methods.

        The LynxModule class also has the getInputVoltage(VoltageUnit unit) and the getAuxiliaryVoltage(VoltageUnit unit) methods.

        Comment


        • #5
          Awesome. That helps a lot. Thanks. I totally missed the new stuff in DCMotorEX.

          Some follow on Q's from a non-SW mentor if you don't mind:

          For the LynxModule class, with a control hub and an expansion hub, what does getCurrent or get InputVoltage return? The current draw for the whole hub? Which one? How do they tell it which one?

          The only LynxModule class use I've shown the kids is some copy-and-paste from the Bulk Cache example, after a bunch of explanation from some helpful folks here. So I could use a snip or two of example code there. Thanks!

          Coach Z

          Comment


          • #6
            Originally posted by zain View Post

            For the LynxModule class, with a control hub and an expansion hub, what does getCurrent or get InputVoltage return?
            • getCurrent will return the total current draw for the hub.
            • getInputVoltage will return the voltage of the 12v power source (connected to the XT30 port)
            • getAuxiliaryVoltage will return the USB VBUS voltage coming into the Mini-B USB port on the Expansion Hub from the phone.

            Originally posted by zain View Post

            Which one? How do they tell it which one?
            So, when you name your Hubs in your config file (e.g. "Expansion Hub 2", "Expansion Hub 3", "Control Hub"), you can use those names to retrieve the LynxModule instance associated with each one.

            For instance, to grab the LynxModule associated with "Expansion Hub 5", you would do

            Code:
            LynxModule exh5 = (LynxModule) hardwareMap.get(LynxModule.class, "Expansion Hub 5");

            Comment


            • #7
              You can also get the per-motor current:

              Code:
              DcMotorEx motor1 = hardwareMap.get(DcMotorEx.class, "leftMotor");
              Code:
              motor1.getCurrent(CurrentUnit.MILLIAMPS);

              Comment


              • #8
                Thanks a lot guys. The kids took this today and ended the day graphing flywheel velocity recovery times and all the other cool things I was hoping they'd get to.

                Comment

                Working...
                X