Skip to content

Commit

Permalink
Merge branch 'Seeed-Studio:docusaurus-version' into docusaurus-version
Browse files Browse the repository at this point in the history
  • Loading branch information
meislisha authored Aug 1, 2024
2 parents 4b74848 + 49a229c commit 731c478
Show file tree
Hide file tree
Showing 7 changed files with 1,121 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
---
description: This wiki will demonstrate how to set up a local knowledge base on Jetson devices with ollama and AnythingLLM. By leveraging the powerful capabilities of large language models, we aim to enhance our work efficiency.
title: Local AI Assistant
keywords:
- reComputer
- LLM
- Chatbot
- ollama
- AnythingLLM
- llama
image: https://files.seeedstudio.com/wiki/wiki-platform/S-tempor.png
slug: /local_ai_ssistant
last_update:
date: 07/30/2024
author: Youjiang
---


# Local AI Assistant : Deploy Ollama and AnytingLLM on Jetson

## Introduction

Local AI Assistant is an artificial intelligence application that runs on local hardware and software, offering intelligent interaction and data processing capabilities. It operates independently of cloud services, protecting user privacy while providing quick response times and high levels of customization.

<div align="center">
<img width={800}
src="https://files.seeedstudio.com/wiki/reComputer/Application/local-ai-assistant/ai-assistant.png" />
</div>

In this wiki, we will demonstrate how to set up a local knowledge base on Jetson devices with [ollama](https://ollama.com/) and [AnythingLLM](https://anythingllm.com/). By leveraging the powerful capabilities of large language models, we aim to enhance our work efficiency.

## Prerequisites

- Jetson device with more than 16GB of memory.
- The hardware device needs to be pre-flashed with the jetpack [5.1.1](https://wiki.seeedstudio.com/reComputer_Intro/) operating system.

:::note
In this wiki, we will accomplish the following tasks using the [NVIDIA® Jetson AGX Orin™ 64GB Developer Kit](https://www.seeedstudio.com/NVIDIArJetson-AGX-Orintm-64GB-Developer-Kit-p-5641.html), but you can also try using other Jetson devices.
:::

<div align="center">
<img width={800}
src="https://files.seeedstudio.com/wiki/reComputer/Application/local-ai-assistant/AGX-Orin.png" />
</div>

<div class="get_one_now_container" style={{textAlign: 'center'}}>
<a class="get_one_now_item" href="https://www.seeedstudio.com/AGX-Orin-32GB-H01-Kit-p-5569.html?queryID=a07376a957f072a4f755e1832fa0e544&objectID=5569&indexName=bazaar_retailer_products"><strong><span><font color={'FFFFFF'} size={"4"}> Get One Now 🖱️</font></span></strong>
</a>
</div>

## Getting Started

### Hardware Connection
- Connect the Jetson device to the network, mouse, keyboard, and monitor.

:::note
Of course, you can also remotely access the Jetson device via SSH over the local network.
:::

### Install and Run Ollama

Here, we highly recommend using [jetson-examples](https://github.com/Seeed-Projects/jetson-examples) to quickly deploy Ollama on your Jetson device.

**Step1.** Open a terminal on jetson device and run the following command to install `jetson-examples`:

```bash
sudo apt install python3-pip
pip3 install jetson-examples
```

**Step2.** To deploy ollama on Jetson device with a single command, we can run:

```bash
reComputer run ollama
```

**Step3.** Download the Llama3 large model using Ollama:

```bash
ollama run llama3
```

:::info
Please keep this terminal active.
:::

### Install and Run AnythingLLM

We can conveniently install AnythingLLM using a [local Docker setup](https://docs.anythingllm.com/installation/self-hosted/local-docker#recommend-way-to-run-dockerized-anythingllm).

**Step1.** Run AnythingLLM on Jetson.

Reopen the terminal and enter the following command:

```bash
docker pull mintplexlabs/anythingllm

export STORAGE_LOCATION=$HOME/anythingllm
mkdir -p $STORAGE_LOCATION
touch "$STORAGE_LOCATION/.env"
docker run -d -p 3001:3001 --cap-add SYS_ADMIN \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm
```

**Step2.** Configure your own local knowledge base.

To access the full application, visit `http://<jetson-ip>:3001` in your browser.

:::note
You can enter the `ifconfig` command on the Jetson terminal to find its IP address.
:::

<div align="center">
<img width={800}
src="https://files.seeedstudio.com/wiki/reComputer/Application/local-ai-assistant/anythingllm-init.png" />
</div>

Follow the on-screen prompts to complete the configuration of AnythingLLM.

:::danger
Please note that on the configuration page of `LLM Perference`, we should select Ollama's Llama 3.1 large language model.
:::

<div align="center">
<img width={800}
src="https://files.seeedstudio.com/wiki/reComputer/Application/local-ai-assistant/select-ollama.png" />
</div>

Finally, import the necessary documents. The large language model will then answer questions based on the imported documents.

`import` --> `click to upload or drag and drop` --> `select document` --> `move to Workspace` --> `save and embed`

<div align="center">
<img width={800}
src="https://files.seeedstudio.com/wiki/reComputer/Application/local-ai-assistant/inport-doc.png" />
</div>

At this point, you have successfully set up your own local knowledge base.

:::note
For more in-depth configuration tutorials, please refer to [this link](https://docs.anythingllm.com/).
:::

### Let's Run It

Enter questions in the dialogue box, and the large language model will provide answers based on the knowledge base.

<div align="center">
<img width={800}
src="https://files.seeedstudio.com/wiki/reComputer/Application/local-ai-assistant/test.png" />
</div>

<details>

<summary> story1.txt </summary>

```txt
Once upon a time in a quaint village nestled between rolling hills, there was a young girl named Eliza who loved to explore the woods behind her home. The forest was a magical place, filled with tall trees that whispered secrets, streams that sang soft melodies, and flowers that seemed to glow under the moonlight.
One sunny morning, Eliza set out on one of her adventures, her heart brimming with excitement. As she wandered deeper into the forest, she discovered a hidden path she had never seen before. The path was lined with shimmering stones that sparkled like stars. Curious and intrigued, Eliza followed it.
After a short walk, the path led her to a magnificent clearing where a majestic oak tree stood in the center. At the base of the tree was a small, ornate door. It was covered in intricate carvings of animals and vines. Eliza, with her heart pounding with both excitement and nervousness, gently pushed the door open.
Inside, she found herself in a cozy, enchanted room. There were shelves lined with books and strange artifacts, and a warm fire crackling in a stone hearth. In the middle of the room, a wise old owl perched on a branch of a large, leafy plant.
The owl looked at Eliza with kind, knowing eyes. “Welcome, young traveler,” it hooted softly. “I am Oliver, the guardian of this magical realm. Few people find their way here. You must have a special heart.”
Eliza’s eyes widened in awe. “What is this place?” she asked.
“This is the Realm of Wonders,” Oliver explained. “It is a place where dreams come to life and where those with pure intentions can find their heart’s true desire.”
Eliza gazed around the room, her curiosity piqued. “What can I do here?”
Oliver smiled. “You can make a wish. But remember, wishes made here come with great responsibility. They have the power to change not just your life but the lives of those around you.”
Eliza thought long and hard. She remembered how her village had been struggling with drought and how her friends and family were suffering. With a determined look, she made her wish.
“I wish for rain to fall upon my village and bring life back to the land.”
Oliver nodded approvingly. “A selfless wish. It will be granted.”
The next morning, as Eliza returned to her village, dark clouds gathered in the sky, and a gentle rain began to fall. The villagers looked up in amazement as the parched earth drank in the life-giving water. The fields began to turn green, and the village flourished once more.
Eliza’s heart swelled with joy as she realized the impact of her wish. The Realm of Wonders had given her the chance to make a difference, and she learned that true magic comes from caring for others.
From that day on, Eliza continued to explore the woods, knowing that the true wonders of life were found in kindness and selflessness.
And so, the village thrived, and Eliza’s adventures became the stuff of legends, reminding everyone that magic, indeed, begins with a kind heart.
```

</details>



## Effect Demonstration

Here, we use the configured local personal assistant to query the information we need.

<div align="center">
<iframe width="800" height="450" src="https://www.youtube.com/embed/JjPfXNqhO1g" title="Local AI Assistant : Deploy Ollama and AnytingLLM on Jetson" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div>

## References
- https://ollama.com/library/llama3.1
- https://anythingllm.com/
- https://www.youtube.com/watch?v=4UFrVvy7VlA&t=4s


## Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

<div class="button_tech_support_container">
<a href="https://forum.seeedstudio.com/" class="button_forum"></a>
<a href="https://www.seeedstudio.com/contacts" class="button_email"></a>
</div>

<div class="button_tech_support_container">
<a href="https://discord.gg/eWkprNDMU7" class="button_discord"></a>
<a href="https://github.com/Seeed-Studio/wiki-documents/discussions/69" class="button_discussion"></a>
</div>
51 changes: 29 additions & 22 deletions docs/Edge/Raspberry_Pi_Devices/reComputer_R1000/recomputer_r.md
Original file line number Diff line number Diff line change
Expand Up @@ -1328,55 +1328,62 @@ Please note that if you require Zigbee functionality, it is necessary to purchas
[Please click here for assemble instruction](/recomputer_r1000_assembly_guide/#assemble-4glorazigbee-module-and-antenna).
:::

#### To test Zigbee communication with two Zigbee modules, follow these steps:
#### Set up reComputer R1000 with Zigbee module as Zigbee Coordinator:

**Step 1.** Check Serial Ports:
Use the following command to check available serial ports:

```bash
cat /dev/ttyUSB*
cat /dev/ttyACM*
```

**Step 2.** Install Serial Communication Tool:
**Step 2.** Install Serial Communication Tool, then enter *cutecom* open the UI:

```bash
sudo apt install minicom
sudo apt-get install cutecom
```

**Step 3.** Open Serial Port for Coordinator (First Zigbee Module):
**Step 3.** Configure the setting and Open communication:
* Configure the baudrate as 115200
* Tick 'Hex output' at the bottom
* Select correct Device port, for example: /dev/ttyACM0
* Then click 'Open' to set up communication

```bash
sudo minicom -D /dev/ttyUSB2 -b 1152008n1 -w -H
```
<div align="center"><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/zigbee1.png" /></div>

Follow these steps to configure the first Zigbee module:

- Set as coordinator: Send command `55 04 00 05 00 05`, expect response `55 04 00 05 00 05`.<br />
- Reset device: Press reset button or send command `55 07 00 04 00 FF FF 00 04`.<br />
- Network formation: Send command `55 03 00 02 02`.<br />

**Step 4.** Open Serial Port for Router (Second Zigbee Module):
:::note
For more detail information, please refer to [E18-MS1PA2-IPX](https://www.ebyte.com/product-view-news.html?id=894). For Hex command instruction, please refer to [Ebyte Zigbee 3.0 Module HEX Command Standard Specification](https://www.ebyte.com/pdf-down.aspx?id=2936).
:::

Open another instance of minicom and configure it for the second serial port with the same settings as before.
**Step 4.** Configure the Zigbee module as Coordinator
Follow these steps to configure the first Zigbee module after checking module is at HEX code mode:

Follow these steps to configure the second Zigbee module:
- Set as coordinator: Send command `55 04 00 05 00 05`, expect response `55 04 00 05 00 05`.<br />
<div align="center"><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/zigbeecommand.png" /></div>

- Set as router: Send command `55 04 00 05 01 04`, expect response `55 04 00 05 00 05`.<br />
- Reset device: Press reset button or send command `55 07 00 04 00 FF FF 00 04`.<br />
<div align="center"><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/zigbeecommand2.png" /></div>

- Network formation: Send command `55 03 00 02 02`.<br />
<div align="center"><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/zigbeecommand3.png" /></div>

:::note
For check digit calculation, can use such [Block Check Character calculator](https://bcc.beyerleinf.de/) tool; Can also use serial communication tools like SSCOM and XCOM with BCC calculate.
:::

**Step 5.** Check Device Status:
Send command `5 03 00 00 00` to check the device status. Expect a response similar to `55 2a 00 00 00 01 XX XX XX XX`, where `XX` represents device information.
Send command `5 03 00 00 00` to check the device status. Expect a response similar to `55 2a 00 00 00 01 XX XX XX XX`, where `XX` represents device information.

**Step 6.** Enter Transparent Mode:
If network formation is successful, enter transparent mode by sending command `55 07 00 11 00 03 00 01 13`. Both modules should be in transparent mode for direct communication. To exit transparent mode, send `+++`.
If network formation is successful, enter transparent mode by sending command `55 07 00 11 00 03 00 01 13`. Both modules should be in transparent mode for direct communication. Don't forget to set Input mode as *None*. To exit transparent mode, send `+++`.
<div align="center"><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/zigbeecommand4.png" /></div>


**Step 7.** Additional Notes:
- If router configuration fails, the device may already be a coordinator. Leave the network using command `55 07 00 04 02 xx xx xx`.
- Test transmission power using commands `55 04 0D 00 00 0D` (query) and `55 04 0D 01 XX XX` (set).

Ensure you replace /dev/ttyUSB* with the correct serial port for each Zigbee module. Follow these steps carefully to test Zigbee communication between the two modules successfully.

Then can connect Zigbee device to reComputer R1000 via ZHA, zigbee2mqtt, Tasmota platforms,etc.

### PoE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ You need to prepare the following hardware

Following these steps should help you disassemble the device without any issues.

**STEP 1:** Remove the Four Screws at the Bottom:
**STEP 1:** Remove the Four Screws at the Bottom and Grounding Screw from Side Panels:

- Locate and unscrew the four screws located at the bottom of the device using an appropriate screwdriver.
- Remove and unscrew the grounding screw from the side panels.

**STEP 2:** Take Off the Floor Panel:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
description: In this tutorial, we will embark on a journey to explore Zigbee application development using the XIAO ESP32C6 development board. The XIAO ESP32C6 is a compact yet powerful board that features the ESP32-C6 chip, which offers integrated Wi-Fi and Bluetooth Low Energy (BLE) connectivity. By leveraging the ESP Zigbee SDK, we can harness the full potential of the XIAO ESP32C6 and extend its capabilities to include Zigbee functionality.
title: Quick start with Zigbee on XIAO ESP32C6
title: Quick start with Zigbee on XIAO ESP32C6 by IDF
image: https://files.seeedstudio.com/wiki/xiaoc6_zigbee/3.jpg
slug: /xiao_esp32c6_zigbee
last_update:
date: 05/30/2024
author: Citric
---

# Quick start with Zigbee on XIAO ESP32C6
# Quick start with Zigbee on XIAO ESP32C6 by IDF

Zigbee is a widely adopted wireless communication protocol that finds extensive use in home automation, smart energy management, and Internet of Things (IoT) applications. Known for its low power consumption, reliable data transmission, and mesh network capabilities, Zigbee is an excellent choice for building scalable and efficient wireless networks.

Expand Down
Loading

0 comments on commit 731c478

Please sign in to comment.