Skip to content
bennierex edited this page May 6, 2015 · 6 revisions

Basic Usage

>>> import navio
>>> nio = navio.Navio()
>>> nio.ADC_read_all()
(571.75, 0.0, 0.0, 0.0)

Methods and properties

instance method ADC_get_mux_mode()

Gets the current ADC multiplexer mode.

Returns: (int) One of the MUX Mode constants defined below.

instance method ADC_set_mux_mode(mux_mode)

Sets the ADC multiplexer mode.

Returns: None
Parameters:

  • mux_mode: (int) One of the MUX Mode constants defined below.

raises ValueError if an invalid mode is passed as the argument.

instance method ADC_get_gain()

Gets the current ADC gain.

Returns: (int) One of the Gain constants defined below.

instance method ADC_set_gain(gain)

Sets the ADC gain.

Returns: None
Parameters:

  • gain: (int) One of the Gain constants defined below.

raises ValueError if an invalid gain is passed as the argument.

instance method ADC_get_mode()

Gets the current ADC operating mode.

Returns: (int) One of the Mode constants defined below.

instance method ADC_set_mode(mode)

Sets the ADC operating mode.

Returns: None
Parameters:

  • mode: (int) One of the Mode constants defined below.

raises ValueError if an invalid mode is passed as the argument.

instance method ADC_get_rate()

Gets the current ADC measurement rate.

Returns: (int) One of the Mode constants defined below.

instance method ADC_set_rate(rate)

Sets the ADC measurement rate.

Returns: None
Parameters:

  • rate: (int) One of the Rate constants defined below.

raises ValueError if an invalid mode is passed as the argument.

instance method ADC_read()

Get a reading (in mV) from the currently selected ADC input(s).

Returns: (float) The reading in mV.

instance method ADC_read_all()

Get an end-point reading (in mV) from all four ADC inputs.

Returns: (tuple of floats) The readings in mV.

Constants

Gain
gain Full-Scale Range (V)
ADC_GAIN_0 ± 6.144V
ADC_GAIN_1 ± 4.096V (default)
ADC_GAIN_2 ± 2.048V
ADC_GAIN_4 ± 1.024V
ADC_GAIN_8 ± 0.512V
ADC_GAIN_16 ± 0.256V
Warining: Read the datasheet and Emlid documentation for the allowable input voltage range. In no event should more than VDD + 0.3V be applied to the ADC.
MUX Mode
mode Inputs
ADC_MUX_AIN0_AIN1 pos = A0, neg = A1
ADC_MUX_AIN0_AIN3 pos = A0, neg = A3
ADC_MUX_AIN1_AIN3 pos = A1, neg = A3
ADC_MUX_AIN2_AIN3 pos = A2, neg = A3
ADC_MUX_AIN0_GND pos = A0, neg = GND (default)
ADC_MUX_AIN1_GND pos = A1, neg = GND
ADC_MUX_AIN2_GND pos = A2, neg = GND
ADC_MUX_AIN3_GND pos = A3, neg = GND
Mode
mode Operating Mode
ADC_MODE_CONT continuous conversion
ADC_MODE_SINGLE single-shot (default)
Rate
rate Data-Rate (sps)
ADC_RATE_8 8
ADC_RATE_16 16
ADC_RATE_32 32
ADC_RATE_64 64
ADC_RATE_128 128 (default)
ADC_RATE_250 250
ADC_RATE_475 475
ADC_RATE_860 860
Clone this wiki locally