Skip to Content

AIN Command — Analog Input Reading

The AIN command allows reading the conditioned voltage value at the AD (Analog-to-Digital) inputs independently.


What is it used for?

🔌 Voltage monitoring — Reads main battery, auxiliary battery, or sensor voltages
Fuel sensors — Measures tank level with resistive sensors
🌡️ Analog sensors — Connects pressure, temperature sensors, etc.
📊 Custom calibration — Adjusts scale and offset for each input

Values can be customized using calibration factors and offset with the CXAIN command.


Syntax

OperationCommandDescription
QueryQAINindexReads analog input value

Parameters

FieldDescriptionValues
indexAD input number00, 01, 02, 07

Response

RAINindex sign value
FieldDescription
sign+ (positive) or - (negative)
valueConditioned value 0000-9999

Examples

Reading AD0 input

>QAIN00< >RAIN00+1250;ID=1234;*3A< // Result: +12.50 V (main battery)

Reading AD1 input

>QAIN01< >RAIN01+0850;ID=1234;*2B< // Result: +8.50 V (fuel sensor)

Reading AD2 input

>QAIN02< >RAIN02+2400;ID=1234;*1C< // Result: +24.00 V (truck battery)

Reading with negative value

>QAIN07< >RAIN07-0150;ID=1234;*4D< // Result: -1.50 (temperature sensor with offset)

Input Indexes

IndexInputTypical Application
00AD0Battery voltage
01AD1Fuel sensor
02AD2Pressure sensor
07AD7Temperature sensor

Maximum admissible voltage: 30.00 VDC. Do not exceed this value to avoid permanent damage.


Conditioning with CXAIN

Customize scale and offset for each input:

>SCXAIN00 0100 0000<

Parameters:

  • Scale factor: 0100 (factor 100 = 1.00, no change)
  • Offset: 0000 (no offset)

Example: Fuel sensor 0-100%

>SCXAIN01 0033 0000<
  • Factor: 0.33 (converts 0-3000 mV to 0-990 ≈ 0-100%)
  • Offset: 0

Reading:

>QAIN01< >RAIN01+0075;ID=1234;*2A<

Interpretation: 75% fuel

Example: Temperature sensor -40C to +125C

>SCXAIN07 0100 -4000<
  • Factor: 1.00
  • Offset: -40.00C

Reading:

>QAIN07< >RAIN07+0285;ID=1234;*1B<

Interpretation: 28.5C - 40 = -11.5C ambient


Use Cases

Auxiliary battery monitoring

>QAIN00< >RAIN00+1340;ID=1234;*3A<

Auxiliary battery at 13.4V → Charging correctly

Tank level sensor

// Configure for 0-100% >SCXAIN01 0033 0000< // Read level >QAIN01< >RAIN01+0082;ID=1234;*2B<

Tank at 82%

Multi-sensor system

>QAIN00< # Main battery >RAIN00+1270;ID=1234;*3A< # 12.7V >QAIN01< # Fuel level >RAIN01+0065;ID=1234;*2B< # 65% >QAIN02< # Oil pressure >RAIN02+0350;ID=1234;*1C< # 3.5 bar

Integration with Reports

AD report (analog readings)

>QAD<

Returns all AD inputs in a single report.

AE report (extended)

>QAE<

Includes conditioned values and status flags.

Events with thresholds

>SRL03E;TRG=AIN00>1400;ACC={GBR00L}<

Generates report when battery exceeds 14.0V (high charge).


Technical Specifications

ParameterValue
Input range0 - 30 VDC
ADC resolution12 bits
Accuracy0.1 V (typical)
Input impedance>100 kΩ
Sampling frequencyConfigurable

Compatibility

💾Firmware v1.03.00
C3Legacy
C5Legacy
ULLegacy
SPLegacy
C3:7 AD inputs
C5 Smart:7 AD inputs
Ultralite:7 AD inputs
Spider:3 AD inputs
💾Firmware v1.00.00
SP-IOT
SM-IOT
ZE-IOT
Spider IoT:3 AD inputs
Smart IoT:7 AD inputs
Zero IoT:2 AD inputs

See Also

Last updated