Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed Jan 21, 2025
1 parent fbd41d2 commit fc20f08
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
Binary file added docs/doc/assets/si7021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions docs/doc/en/modules/temp_humi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ title: Reading Temperature and Humidity Sensors with MaixCAM MaixPy

## Introduction

By attaching a temperature and humidity sensor module to MaixCAM, you can easily read the environmental temperature and humidity. This example uses the `Si7021` sensor, which can be driven via `I2C`.
By attaching a temperature and humidity sensor module to the MaixCAM, you can easily measure the environmental temperature and humidity. Here, we use the `Si7021` sensor as an example, which can be driven using `I2C`. For other sensors, you can request drivers from the manufacturer and use `I2C` or `SPI` to read data from them.

The complete code is available at [MaixPy/examples/sensors/temp_humi_si7021.py](https://github.com/sipeed/MaixPy/blob/main/examples/sensors/temp_humi_si7021.py).
![](../../assets/si7021.png)

Note that the system image needs to be version `>= 2024.6.3_maixpy_v4.2.1`.
**Note**: The power supply should be 3.3V. Connecting it to 5V may cause damage.

Connect the `SCL` / `SDA` pins of the sensor to the corresponding `SCL` / `SDA` pins on the MaixCAM. For instance, on `I2C5`, this corresponds to `A15(SCL)` / `A27(SDA)`.

## Usage

The complete code can be found in the [MaixPy/examples/ext_dev/sensors](https://github.com/sipeed/MaixPy/blob/main/examples/ext_dev/sensors) directory. Look for the `si7021` example.

**Note**: The system image version must be `>= 2024.6.3_maixpy_v4.2.1`.

10 changes: 8 additions & 2 deletions docs/doc/zh/modules/temp_humi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ title: MaixCAM MaixPy 读取温湿度传感器

## 简介

通过给 MaixCAM 外挂一个温湿度传感器模块,可以轻松读取到环境温度和湿度,这里以 `Si7021` 这款传感器为例,通过 `I2C` 可以驱动它。
通过给 MaixCAM 外挂一个温湿度传感器模块,可以轻松读取到环境温度和湿度,这里以 `Si7021` 这款传感器为例,通过 `I2C` 可以驱动它,其它的传感器你也可以找厂商要驱动然后使用 I2C / SPI 读取。

![](../../assets/si7021.png)

注意供电是 3.3v,不要接错到 5v 导致烧毁。

`SCL` / `SDA` 接到 MaixCAM 的 `SCL` / `SDA` 即可,比如 `I2C5` 对应的`A15(SCL)/ A27(SDA)`

## 使用

完整的代码在[MaixPy/examples/ext_dev/sensors/temp_humi_si7021.py](https://github.com/sipeed/MaixPy/blob/main/examples/sensors/temp_humi_si7021.py)
完整的代码在 [MaixPy/examples/ext_dev/sensors](https://github.com/sipeed/MaixPy/blob/main/examples/ext_dev/sensors) 目录下, 找到`si7021` 的例程即可。

注意系统镜像需要 `>= 2024.6.3_maixpy_v4.2.1` 版本。

9 changes: 7 additions & 2 deletions examples/tools/install_runtime.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import os

def install_runtime():
def install_runtime(force = False):
version_path = "/maixapp/maixcam_lib.version"
if force and os.path.exists(version_path):
os.remove(version_path)
cmd = f"chmod +x /maixapp/apps/settings/settings && /maixapp/apps/settings/settings install_runtime"
err_code = os.system(cmd)
if err_code != 0:
print("[ERROR] Install failed, error code:", err_code)
else:
print(f"Install runtime success")

install_runtime()

force_reinstall = False # reinstall runtime even we alredy installed.
install_runtime(force_reinstall)

0 comments on commit fc20f08

Please sign in to comment.