Skip to content

Analog inputs/outputs

RB400 Advance has four 0-10V analog inputs and two 0-10V analog outputs. The analog inputs and outputs are controlled via the SPI interface (/dev/spidev0.1). SPI settings:

  • Mode bits: CPHA = 1, CPOL = 0,
  • Bits per word: 8,
  • Max. speed 2 MHz.

Analog outputs

The following figure shows the write analog outputs frame. Each rectangle represents one byte.

Byte 1 Byte 2 Byte 3 Byte 4 Byte 5
0X4F AO1[7:0] AO1[15:8] AO2[7:0] AO2[15:8]

Fig. 1. Write analog outputs frame

The value 1000 corresponds to the output voltage 10V. If the fifteenth bit of the output value is 1 then the output is ignored. Frame timeout is 100ms.

Example 1

Set both analog outputs: AO1 = 10.0V ⇒ 1000 ⇒ 0x03E8 AO2 = 5.0V ⇒ 500 ⇒ 0x01F4

Byte 1 Byte 2 Byte 3 Byte 4 Byte 5
0X4F 0XE8 0X03 0XF4 0X01

Fig. 2. Write analog outputs frame - example 1

Example 2

Set only A01: AO1 = 10.0V ⇒ 1000 ⇒ 0x03E8

Byte 1 Byte 2 Byte 3 Byte 4 Byte 5
0X4F 0XE8 0X03 0X00 0X80

Fig. 3. Write analog outputs frame - example 2

Example 3

Set only A02: AO2 = 5.0V ⇒ 500 ⇒ 0x01F4

Byte 1 Byte 2 Byte 3 Byte 4 Byte 5
0X4F 0X00 0X80 0XF4 0X01

Fig. 4. Write analog outputs frame - example 3

Analog inputs

The following figure shows the read analog inputs frame. Each rectangle represents one byte.

Byte 1 Byte 2 Byte 3 Byte 4 Byte 5
0X41 AI1[7:0] AI1[15:8] AI2[7:0] AI2[15:8]
Byte 6 Byte 7 Byte 8 Byte 9
AI3[7:0] AI3[15:8] AI4[7:0] AI4[15:8]

Fig. 5. Read analog inputs frame

Between the first two bytes (0x41 and AI1[7:0]) there should be a delay of at least 100 µs.

The voltage at the analog input can be calculated using the formula:

Vin = ((AI[15:8] ← 8) OR AI[7:0]) · 10.065 / 1023.0

where:

  • "<<" denotes a left shift by 8 bits,

  • "|" denotes a bitwise OR operation.

Analog I/O Using Pigeon Tool

Pigeon Tool is a command-line utility used to read inputs and control outputs on Pigeon computers.

Installation and Startup

$ wget www.pigeoncomputers.com/files/pigeon-tool
$ chmod u+x pigeon-tool
$ sudo mv pigeon-tool /usr/local/bin/
$ pigeon-tool

After successful execution, the tool displays the available options.

Reading Analog Inputs

Analog inputs are identified as AI1–AI4 and return the measured voltage value.

$ pigeon-tool --ai1
$ pigeon-tool --ai2
$ pigeon-tool --ai3
$ pigeon-tool --ai4

Setting Analog Outputs

Analog outputs are identified as AO1–AO2 and accept voltage values.

$ pigeon-tool --ao1 5.00   # Set analog output AO1 to 5.00 V
$ pigeon-tool --ao2 10.00  # Set analog output AO2 to 10.00 V

Value range: 0.00–10.00 V.