No announcement yet.

I would like to get the raw values from the ADC on the REV

  • Filter
  • Time
  • Show
Clear All
new posts

  • 3805Mentor
    Yes but the REV is a 12 bit, so 0 - 4095.

    So this is more of an annoyance than a need. The ADC's resolution is 0.8 mV per step. The getVoltage reports back to the nearest 1 mV, so close enough for most purposes.

    At one time I wondered how much the Maxbotics ultrasonic distance sensor varied its return for a stationary position. It has a 1 cm per step resolution at 5 volts with a 1024 bit AD which is what the Modern Robotics CDIM is. This is 4.88 mV per step, so 1 mV resolution on getVoltage isn't as much a problem.
    I binned expected and 3 steps above and below with the sensor stationary. You could see that it always had significant counts in 2 bins and much lower percentage counts farther out.

    Another reason for raw was the Maxbotics was easy to read when you could get raw, as the raw number was in cm, not true with REV though.
    Yet another reason was I found a bug in one of the early SDKs where the conversion of a sensor to volts wasn't making any sense, being able to get the raw data helped me figure out I wasn't crazy.

    So for REV my OCD wants 0.8 mV bins (or the raw value) and I can only get 1 mV bins. I actually have gotten the answer I wanted to see, so as I said an annoyance rather than an actual need.

    I'll check out RevExtensions2


    Leave a comment:

  • 4634 Programmer
    Oh wait, are you saying you're trying to read the user port ADC as say 0-1024 instead of 0-3.3v?

    Leave a comment:

  • 4634 Programmer
    Is there a specific reason you want RAW instead of standard units? Also FYI, RevExtensions2 provides high-level calls for all the data that the ADC can provide.

    Leave a comment:

  • I would like to get the raw values from the ADC on the REV

    I've drilled down from getVoltage and found this class in a jar -
    public class LynxAnalogInputController extends LynxController implements AnalogInputController

    In it is the method -
    public double getAnalogInputVoltage(int port)

    Which has this statement -
    LynxGetADCCommand command = new LynxGetADCCommand(this.getModule(), LynxGetADCCommand.Channel.user(port), LynxGetADCCommand.Mode.ENGINEERING);
    The other ADCCommand.Mode is RAW.

    This seems promising, but I have no idea how to make use of this knowledge to get a raw AD value.
    Is there a way to do this? Detailed instructions would be needed for someone being dragged kicking and screaming into the OOP world. :-)