> For the complete documentation index, see [llms.txt](https://freegrow-1.gitbook.io/product-docs-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://freegrow-1.gitbook.io/product-docs-en/en-creator-kit-q1/uwb-creator-kit-q1-complete-setup-and-usage-guide/practice-examples/arduino-uno-integration.md).

# Arduino Uno Integration

### In this guide

we explain how to connect a GrowSpace UWB listener or developer tag to an Arduino Uno and receive real-time location data using the `lep` command.\
Since the Uno has only one hardware serial port, we use **AltSoftSerial**, a software serial method, to handle data reliably

***

### Required Materials

* GrowSpace Listener or Developer Tag (GR-LST-1001 or GR-TGD-1001S)
* Arduino Uno board
* Jumper wires
* USB cable (for PC connection)
* Arduino IDE
* AltSoftSerial library (for software serial communication)

***

### Installing Arduino IDE and Libraries

#### Install Arduino IDE

* Download and install the version that matches your operating system from[ the official Arduino website.](https://www.arduino.cc/en/software/)

#### **Install AltSoftSerial**

* Open the Arduino IDE
* Go to the top menu: **Sketch > Include Library > Manage Libraries**
* Search for **AltSoftSerial** and install the latest version

### Why Use AltSoftSerial?

The Arduino Uno has only one `hardware serial port`, which is used for the USB connection to your PC.\
However, the GrowSpace UWB device requires **high-speed serial communication at 115200 bps**, making it difficult to handle both PC and device communication through the same port.

#### Limitations of SoftwareSerial

* Unstable at high speeds like 115200 bps
* Can interfere with timers, affecting functions like `millis()` and `delay()`

#### **Advantages of AltSoftSerial**

* Uses internal timers for more accurate and stable communication
* Works reliably even at high speeds (115200 bps and above)
* Similar to `Serial`, so it’s easy to use
* On the Uno, RX is fixed to D8 and TX to D9, reducing pin conflicts

> Therefore, using **AltSoftSerial** is recommended to ensure stable communication between the GrowSpace device and the Arduino Uno.

***

### Serial Pin Connection (AltSoftSerial)

Connect the GrowSpace device to the Arduino Uno as shown below.\
Since the Uno supports 5V devices, use the **right-side connector** (5V-based) on the GrowSpace tag.

| GrowSpace Device Pins | Arduino Uno Pin |
| --------------------- | --------------- |
| HV (5V)               | 5V              |
| GND                   | GND             |
| TXD                   | D8              |
| RXD                   | D9              |

> ⚠️ **TX and RX must be cross-connected:** Device TX → Uno D8 (AltSoftSerial RX), Device RX → Uno D9 (AltSoftSerial TX)

{% columns %}
{% column %}

<figure><img src="/files/shmUuNtaVpcr2qROwbqD" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/ef9zVrutbRAmT6s1t0ic" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

***

### AltSoftSerial-Based Data Receiving Example Code

```json
#include <AltSoftSerial.h>

AltSoftSerial altSerial;  // RX: D8, TX: D9

void setup() {
  Serial.begin(115200);     // USB Serial
  altSerial.begin(115200);  // GrowSpace Device Serial
  delay(100);

  // Device Reset
  altSerial.print("reset\r");
  delay(1000);

  // Clear Buffer
  while (altSerial.available()) {
    altSerial.read();
  }

  // Start Location Request
  altSerial.print("lep\r");
}

void loop() {
  while (altSerial.available()) {
    char c = altSerial.read();
    Serial.write(c);  // Print to PC
  }
}
```

***

### Serial Monitor Setup and Test

* After uploading the code, connect the Arduino Uno to your PC.
* In the Arduino IDE, go to **Tools > Serial Monitor**.
* Set the **baud rate to 115200** and enable **newline**.

#### Example Output (Applicable to Both Developer Tag and Listener)

```
POS,0,0104,12.34,56.78,9.01,95,BC
```

<figure><img src="/files/04OYDcqDLwT12Sph4nJ2" alt=""><figcaption></figcaption></figure>

or

```
X: 12.34, Y: 56.78, Z: 9.01
```

<figure><img src="/files/UvZ9NvuYAtfBrEG48wjI" alt=""><figcaption></figcaption></figure>

If the GrowSpace device is working properly, you will see output like this with location data.

***

### Troubleshooting Guide

* If no output appears:
  * Check the jumper wire connections.
  * Make sure the AltSoftSerial library is properly installed.
  * Re-select the correct port for the Uno board, reboot the board, and try again.
* For more stable communication:
  * We recommend using the **Arduino Mega 2560**, which supports **four hardware serial ports**.

***

### Conclusion

In this manual, we showed how to connect a GrowSpace UWB listener or developer tag to an Arduino Uno and receive real-time location data.\
The location data received using the `lep` command can be applied to various indoor positioning projects and RTLS (Real-Time Location System) applications.
