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
cure123123 authored Aug 9, 2024
2 parents 49e852a + c307b0e commit 3ffc9bb
Show file tree
Hide file tree
Showing 15 changed files with 1,566 additions and 295 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,6 @@ yarn.lock

# plugin FrontMatter
frontmatter.json
taxonomyDb.json
taxonomyDb.json

XIAO_ESP32C6_Swift_Matter.md
251 changes: 234 additions & 17 deletions docs/Edge/Beagle_Bone/BeagleBone.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ This wiki we will show you how to use yolov8n to do object detection with ai kit
<div class="table-center">
<table align="center">
<tr>
<th>reComputer r1000</th>
<th>Raspberry Pi5 8GB</th>
<th>Raspberry Pi AI Kit</th>
</tr>
<tr>
<td><div style={{textAlign:'center'}}><img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/1/-/1-113991274-recomputer-r1025-10-0.jpg" style={{width:600, height:'auto'}}/></div></td>
<td><div style={{textAlign:'center'}}><img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/1/-/1-113060086-raspberry-pi-ai-kit-45font.jpg" style={{width:600, height:'auto'}}/></div></td>
<td><div style={{textAlign:'center'}}><img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/2/-/2-102110919-raspberry-pi-5-8gb-font.jpg" style={{width:600, height:'auto'}}/></div></td>
<td><div style={{textAlign:'center'}}><img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/2/-/2-113060086-raspberry-pi-ai-kit-all.jpg" style={{width:600, height:'auto'}}/></div></td>
</tr>
<tr>
<td><div class="get_one_now_container" style={{textAlign: 'center'}}>
<a class="get_one_now_item" href="https://www.seeedstudio.com/reComputer-R1000-Series-Optional-Accessories.html">
<a class="get_one_now_item" href="https://www.seeedstudio.com/Raspberry-Pi-5-8GB-p-5810.html">
<strong><span><font color={'FFFFFF'} size={"4"}> Get One Now 🖱️</font></span></strong>
</a>
</div></td>
Expand All @@ -50,9 +50,10 @@ This wiki we will show you how to use yolov8n to do object detection with ai kit
</div>



## Install Hardware

<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/YOLOV8/install_AIkit.gif" alt="pir" width={1000} height="auto"/></p>
Please refer to [this](https://www.raspberrypi.com/documentation/accessories/ai-kit.html)

## Host computer

Expand Down Expand Up @@ -303,6 +304,13 @@ Find line 172 in ```object-detection-hailo.py```, and change the code like below
bash run.sh object-detection-hailo
```

## Result


<div align="center">
<iframe width="800" height="400" src="https://www.youtube.com/embed/mVNrEVpvvuc" title="YOLOv8n Object Detection on Raspberry Pi 5 with AI Kit" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div>


## Tech Support & Product Discussion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ last_update:

The reComputer r1000, designed for Building Automation Systems, features multiple isolated RS485 channels that support both high and low-speed communication. It is compatible with BACnet, Modbus RTU, and Modbus TCP/IP protocols, making it versatile for various automation needs. This guide provides a concise introduction to installing Home Assistant on the reComputer r1000, enabling seamless integration and control of your smart home devices.

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/ReTerminal/frigate/HA.png" style={{width:600, height:450}}/></div>
<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/logo.png" style={{width:400}}/></div>

[Home Assistant](https://www.home-assistant.io/) is a free and open-source software for home automation, serving as a central control system or smart home hub for various devices. Designed with local control in mind, it ensures your Building Management System (BMS) operates independently of remote servers or internet connections, enhancing security and reliability. This means your BMS can run 24/7 without the vulnerabilities associated with cloud-connected devices, providing a robust and secure automation solution.

Expand Down Expand Up @@ -125,15 +125,15 @@ sudo dpkg -i homeassistant-supervised.deb

Upon successful correction, a blue screen will appear, allowing you to select **Raspberry Pi4 64** model.

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/ReTerminal/frigate/bluescreen.png" style={{width:600, height:450}}/></div>
<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/ReTerminal/frigate/bluescreen.png" style={{width:600}}/></div>

After a few minutes, the installation will begin.

You can then view the Home Assistant Dashboard UI on a web browser using `<your_recomputer_ip>:8123`.

It will take some time to finish the initial startup process. Once it has finished starting up, create an account and follow the initial setup instructions

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/Home-Assistant/13.png" style={{width:600, height:450}}/></div>
<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/Home-Assistant/13.png" style={{width:600}}/></div>

:::note
If there are warnings in notifications, please reboot the reComputer.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
---
description: Learn how to set up and configure Modbus TCP and Modbus RTU with Home Assistant on a reComputer R1000, a powerful Raspberry Pi-powered solution for seamless integration and control of your Modbus devices in a Building Management System (BMS).
title: reComputer R1000 and Modbus with Home Assistant
keywords:
- Home Assistant
- reComputer R1000
- Home Automation
- BMS
- Modbus

image: https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/01.png
slug: /recomputer_r1000_home_assistant_modbus
last_update:
date: 08/07/2024
author: Kasun Thushara
---

## Introduction

In modern building management systems (BMS), integrating various protocols and devices is crucial for efficient monitoring and control. This guide focuses on leveraging the capabilities of Modbus communication protocols (Modbus TCP and Modbus RTU) with Home Assistant OS, using the powerful reComputer R1000, a Raspberry Pi-powered solution. Whether you're setting up a new system or enhancing an existing one, this guide will walk you through the process of connecting your Modbus devices to Home Assistant, ensuring seamless integration and control.

## Getting Start

Before you start this project, you may need to prepare your hardware in advance as described here.

### Hardware Preparation

<div class="table-center">
<table class="table-nobg">
<tr class="table-trnobg">
<th class="table-trnobg">reComputer R1000</th>
</tr>
<tr class="table-trnobg"></tr>
<tr class="table-trnobg">
<td class="table-trnobg"><div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/01.png" style={{width:300, height:'auto'}}/></div></td>
</tr>
<tr class="table-trnobg"></tr>
<tr class="table-trnobg">
<td class="table-trnobg"><div class="get_one_now_container" style={{textAlign: 'center'}}><a class="get_one_now_item" href="https://www.seeedstudio.com/reComputer-R1025-10-p-5895.html">
<strong><span><font color={'FFFFFF'} size={"4"}> Get One Now 🖱️</font></span></strong>
</a></div></td>
</tr>
</table>
</div>

### Software Preperation

Before diving into the integration process, it's crucial to ensure that all necessary drivers and tools are installed. Proper [installation of drivers](https://wiki.seeedstudio.com/reComputer_r1000_use_rs485_modbus_rtu/) is a prerequisite for seamless communication between Modbus RTU devices and Home Assistant. It is highly recommended to thoroughly study and install the required drivers before proceeding with this guide.

Additionally, if you haven't installed Home Assistant yet, please follow the [Home Assistant installation guide](https://wiki.seeedstudio.com/recomputer_r1000_home_automation/) to set it up on your reComputer R1000.

## File Editor Add-on

While you can configure most of Home Assistant directly from the user interface under Settings, some parts require you to edit files such as configuration.yaml. This file contains integrations to be loaded along with their configurations. By adding code snippets to this configuration file, you can enable specific functionalities, including Modbus integration.

To get started, you need to install the File Editor add-on in Home Assistant:

- Open Home Assistant.
- Navigate to `Settings > Add-ons`.

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/settings.PNG" style={{width:600}}/></div>

- Click on the `Add-on Store`.

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/add-ons.PNG" style={{width:600}}/></div>

- Search for `File Editor` and click on it.

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/fileeditor.PNG" style={{width:600}}/></div>

- Click the Install button.
- Once installed, click on Start to launch the File Editor.
- Optionally, enable Show in Sidebar for quick access.

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/fileeditor-start.PNG" style={{width:600}}/></div>

With the File Editor add-on, you can now edit the `configuration.yaml` file to add Modbus integration

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/config.PNG" style={{width:600}}/></div>

## Enabling Modbus TCP Integration

To enable the Modbus integration in Home Assistant, you need to add specific parameters to your configuration.yaml file. Below are the parameters and their descriptions that you will need to configure:

- **name**: The name of this hub. Must be unique.
- **host**: The IP address or name of your Modbus device, e.g., `192.168.1.1`.
- **port**: The network port for communication.
- **type**: The type of Modbus connection. Options are tcp or serial.Here we used `tcp`

To configure entities for your Modbus integration, you need to define various parameters for each entity. Below are the parameters required for setting up binary sensors:
There are several entities. You can check on [Offical modbus Home Assistant page](https://www.home-assistant.io/integrations/modbus).

- **binary_sensors**: A list of all binary sensors configured for this connection.
- **address**: The address of the coil/register.
- **name**: The name of the entity, which must be unique within the entity type.
- **scan_interval**: The update interval in seconds. Set scan_interval = 0 for no polling. Entities are read shortly after startup and then according to scan_interval.
- **slave**: Identical to device_address.
- **input_type**: The type of request. Options are coil, holding, or input.

**Example** :

```bash
modbus:
- name: modbus_hub
type: tcp
host: IP_ADDRESS_of_PLC
port: 502
binary_sensors:
- name: Relay_1
address: 8193
slave: 1
input_type: coil
scan_interval: 1
- name: Relay_2
address: 8194
slave: 1
input_type: coil
scan_interval: 1
```
<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/modbus-settings.PNG" style={{width:600}}/></div>

:::note
It is neccesary save and restart HA after changing configuration.yml file
:::

## Enabling Modbus RTU Integration

To enable Modbus RTU integration in Home Assistant, you need to add the following parameters to your configuration.yaml file:

- **name**: The name of this hub. Must be unique.
- **type**: The type of Modbus connection. Here, it should be serial.
- **port**: The serial port or USB device where your Modbus device is connected to your Home Assistant host. We found that it is `/dev/ttyAMA30`
- **baudrate**: The speed of the serial connection.
- **method**: The method of connection to Modbus. Options are rtu and ascii.
- **parity**: The parity of the data bytes. Options are E (Even), O (Odd), N (None).
- **bytesize**: The data size in bits of each byte. Typically 8.
- **stopbits**: The stop bits of the data bytes.

To configure entities for your Modbus RTU integration, you need to define various parameters for each sensor. Below are the parameters required for setting up sensors:

- **sensors**: The Modbus sensor allows you to gather data from Modbus registers.
- **name**: The name of the entity, which must be unique within the entity type.
- **address**: The address of the register.
- **slave**: Identical to device_address.
- **input_type**: The Modbus register type for the sensor. Options are holding or input.
- **scale**: The scale factor.
- **device_class**: The type/class of the sensor to set the icon in the frontend.
- **unit_of_measurement**: The unit to attach to the value.


Example:

```bash
modbus:
- name: modbus_hub2
type: serial
port: /dev/ttyAMA30
baudrate: 9600
bytesize: 8
method: rtu
parity: N
stopbits: 1
sensors:
- name: Room Temperature
address: 1
input_type: input
slave: 1
scale: 0.01
device_class: temperature
unit_of_measurement: °C
- name: Room Humidity
address: 2
input_type: input
slave: 1
scale: 0.01
unit_of_measurement: '%'
device_class: humidity
```
<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/modbus-rtu-setting.PNG" style={{width:600}}/></div>

:::note
It is neccesary save and restart HA after changing configuration.yml file
:::

Finally you will be able to see the working phenomina.

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/HA/demo.gif" style={{width:600}}/></div>


## 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>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: This article mainly introduces how to use the 485 communication function of reComputer R1000, and tests the rs485 and Modbus communication functions.
title: How to use rs485 and modbus rtu with reComputer R1000
title: How to use rs485 and modbus with reComputer R1000
keywords:
- Edge
- reComputer R1000
Expand Down Expand Up @@ -64,6 +64,11 @@ sudo apt-get install minicom
This test uses an RS485 to USB module to connect reComputer R1000 and W10 PC.
<div align="center"><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/RS485_fix/hardwareconnection.png" alt="pir" width="700" height="auto" /></div>

For ModbusTCP, we use Ethernet cables to connect the W10 PC and reComputer R1000 to a switch to ensure that they are on the same network segment.

<div align="center"><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/fuxa/r1000_connection.png" alt="pir" width="500" height="auto" /></div>


## Steps to use the RS485 interface normally and perform Modbus RTU testing

**Step 1**: First, you need to download the [**C program**](https://github.com/Seeed-Studio/seeed-linux-dtoverlays/tree/master/tools/rs485_control_DE) provided by us, and then refer to the contents of the ReadMe. Compile and run.
Expand Down Expand Up @@ -117,6 +122,23 @@ echo 590 > /sys/class/gpio/unexport
This is because they use different file systems and there will be conflicts when accessing the same resource.
:::

## Steps to use the Modbus TCP testing

**Step 1**: Open modbusmechanic on Win10 PC and R1000

<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fuxa/modbusmac_two.png" /></center>

**Step 2**: R1000 acts as the modbus TCP host. Click `Tool => Start Slave Simulator` on W10 PC, select `TCP` for TYPE, select `1` for Slave ID, and then add `Coils`; then enter `IP` in R1000, and select `Read Coil` for Scan group. Enter `Slave Node` and `Register`, and finally click `Transmit packet`. You can see that the slave data has been successfully read.

<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fuxa/R1000_MASTER_MODBUS_TCP.gif" /></center>

**Step 3**: R1000 acts as a modbus TCP slave. Refer to the second step for configuration. You can see that R1000 can read data normally as a slave.

<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fuxa/R1000_SLAVE_MODBUS_TCP.gif" /></center>


Running the Modbus TCP slave program in R1000 needs to listen to the `502` port, which may require `sudo` permissions. If your application cannot listen to the `502` port, please try to add permissions to it.


## Tech Support & Product Discussion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ If you notice an erroneous screen orientation after installing **Raspberry Pi OS

- **Step 1.** After flashing **Raspberry Pi OS Bookworm** to reTerminal eMMC, follow [this guide](https://wiki.seeedstudio.com/reTerminal/#install-reterminal-drivers-after-flashing-new-raspberry-pi-os-ubuntu-os-or-other-os) to install the necessary drivers


If you configured a user other than root, and the Bookworm image from July 24, I found I had to do:
```sh
sudo chown $USER ~/.config
sudo chgrp $USER ~/.config
sudo chmod u+rwx ~/.config
```

- **Step 2.** Open .config/wayfire.ini

```sh
Expand All @@ -91,6 +99,7 @@ mode = 720x1280@60
transform = 270
```


- **Step 4.** Open **/boot/config.txt**

```sh
Expand All @@ -109,4 +118,4 @@ dtoverlay=reTerminal
sudo reboot
```

Now the screen will be displayed in the correct orientation on Raspberry Pi OS Bookworm!
Now the screen will be displayed in the correct orientation on Raspberry Pi OS Bookworm!
Loading

0 comments on commit 3ffc9bb

Please sign in to comment.