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
Function | MMT Pin | SMT Pin | TH Pin | AT Command |
---|---|---|---|---|
DIO0 |
31 |
33 |
20 |
|
DIO1 |
30 |
32 |
19 |
|
DIO2 |
29 |
31 |
18 |
|
DIO3 |
28 |
30 |
17 |
|
DIO4 |
23 |
24 |
11 |
|
DIO5 |
26 |
28 |
15 |
|
DIO6 |
27 |
29 |
16 |
|
DIO7 |
24 |
25 |
12 |
|
DIO8 |
9 |
10 |
9 |
|
DIO9 |
25 |
26 |
13 |
|
DIO12 |
5 |
5 |
4 |
|
DIO13 |
3 |
3 |
2 |
|
DIO14 |
4 |
4 |
3 |
|
DIO15 |
16 |
17 |
- |
|
DIO16 |
15 |
16 |
- |
|
DIO17 |
14 |
15 |
- |
|
DIO18 |
13 |
14 |
- |
|
DIO19 |
11 |
12 |
- |
Digital sampling is enabled on these pins if configured as 3, 4, or 5 with the following meanings:
-
3 is digital input.
-
Use PR (Pull-up/Down Resistor Enable) to enable internal pull up/down resistors for each digital input. Use PD (Pull Up/Down Direction) to determine the direction of the internal pull up/down resistor. All disabled and digital input pins are pulled up by default.
-
-
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 |
|
ADC1 |
30 |
32 |
19 |
|
ADC2 |
29 |
31 |
18 |
|
ADC3 |
28 |
30 |
17 |
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.