XBee 3 BLU devices offer versatile input and output (I/O) capabilities, allowing them to interface directly with external sensors, actuators, and other peripheral devices. You can configure I/O pins for various functions, such as reading sensor values, controlling LEDs or relays, or even generating pulse-width modulation (PWM) signals.

The following topics describe analog and digital I/O line support and output control.

Digital I/O support

Digital I/O is available on lines DIO0 through DIO9 and DIO12 through DIO19.

Function MMT Pin SMT Pin TH Pin AT Command

DIO0

31

33

20

D0 (DIO0/ADC0/Commissioning Configuration)

DIO1

30

32

19

D1 (DIO1/ADC1/TH_SPI_ATTN Configuration)

DIO2

29

31

18

D2 (DIO2/ADC2/TH_SPI_CLK Configuration)

DIO3

28

30

17

D3 (DIO3/ADC3/TH_SPI_SSEL Configuration)

DIO4

23

24

11

D4 (DIO4/TH_SPI_MOSI Configuration)

DIO5

26

28

15

D5 (DIO5/Associate Configuration)

DIO6

27

29

16

D6 (DIO6/RTS Configuration)

DIO7

24

25

12

D7 (DIO7/CTS Configuration)

DIO8

9

10

9

D8 (DIO8/DTR/SLP_Request Configuration)

DIO9

25

26

13

D9 (DIO9/ON_SLEEP Configuration)

DIO12

5

5

4

P2 (DIO12/TH_SPI_MISO Configuration)

DIO13

3

3

2

P3 (DIO13/UART_DOUT Configuration)

DIO14

4

4

3

P4 (DIO14/UART_DIN Configuration)

DIO15

16

17

-

P5 (DIO15/SPI_MISO Configuration)

DIO16

15

16

-

P6 (DIO16/SPI_MOSI Configuration)

DIO17

14

15

-

P7 (DIO17/SPI_SSEL Configuration)

DIO18

13

14

-

P8 (DIO18/SPI_CLK Configuration)

DIO19

11

12

-

P9 (DIO19/SPI_ATTN Configuration)

Digital sampling is enabled on these pins if configured as 3, 4, or 5 with the following meanings:

  • 3 is digital input.

  • 4 is digital output low.

  • 5 is digital output high.

Analog I/O support

Analog input is available on D0 through D3. Configure these pins to 2 (ADC) to enable analog sampling.

Function MMT Pin SMT Pin TH Pin AT Command

ADC0

31

33

20

D0 (DIO0/ADC0/Commissioning Configuration)

ADC1

30

32

19

D1 (DIO1/ADC1/TH_SPI_ATTN Configuration)

ADC2

29

31

18

D2 (DIO2/ADC2/TH_SPI_CLK Configuration)

ADC3

28

30

17

D3 (DIO3/ADC3/TH_SPI_SSEL Configuration)

AV (Analog Voltage Reference) specifies the analog reference voltage used for the 10-bit ADCs. Analog sample data is represented as a 2-byte value. For a 10-bit ADC, the acceptable range is from 0x0000 to 0x03FF. To convert this value to a useful voltage level, apply the following formula:

  • ADC / 1023 (vREF) = Voltage

ADCs sampled through MicroPython will have 12-bit resolution.

Example

An ADC value received is 0x01AE; to convert this into a voltage the hexadecimal value is first converted to decimal (0x01AE = 430). Using the default AV reference of 1.25 V, apply the formula as follows:

  • 430 / 1023 (1.25 V) = 525 mV

I/O behavior during sleep

When the device sleeps (SM ! = 0) the I/O lines are optimized for a minimal sleep current.

Digital I/O lines

Digital I/O lines set as digital output high or low maintain those values during sleep. Disabled or input pins continue to be controlled by the PR/PD settings. Peripheral pins (with the exception of CTS) are set low during sleep and SPI pins are set high. Peripheral and SPI pins resume normal operation upon wake.

Analog and PWM I/O lines

Lines configured as analog inputs or PWM output are not affected during sleep. PWM lines are shut down (set low) during sleep and resume normal operation upon wake.