Skip to content

Include 1-Wire sensor example for DS18B20#4894

Open
WeSpeakEnglish wants to merge 2 commits into
Seeed-Studio:docusaurus-versionfrom
WeSpeakEnglish:patch-3
Open

Include 1-Wire sensor example for DS18B20#4894
WeSpeakEnglish wants to merge 2 commits into
Seeed-Studio:docusaurus-versionfrom
WeSpeakEnglish:patch-3

Conversation

@WeSpeakEnglish

Copy link
Copy Markdown
Contributor

Added example code for Dallas/Maxim DS18B20 sensor using 1-Wire protocol.

Added example code for Dallas/Maxim DS18B20 sensor using 1-Wire protocol.
@github-actions

Copy link
Copy Markdown
Contributor

👍 @WeSpeakEnglish

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.

@github-actions

Copy link
Copy Markdown
Contributor

🌍 检测到文档变更 - 可进行多语言翻译

统计信息: 共 1 个文件需要处理
操作类型: 新增:0 修改:1 删除:0 移动:0 移动+修改:0

🚀 开始翻译

在此评论回复以下命令之一:

  • /translate all - 翻译所有变更到所有语言 (中文、日文、西班牙语、葡萄牙语)
  • /translate zh - 仅翻译到中文
  • /translate ja - 仅翻译到日文
  • /translate es - 仅翻译到西班牙语
  • /translate pt - 仅翻译到葡萄牙语 (巴西)
  • /translate zh ja - 翻译到中文和日文
  • /translate zh es - 翻译到中文和西班牙语

译文将提交到 base 仓库分支 auto-translate/pr-<PR号> 并打开/复用一个翻译 PR,原 PR 不会被翻译提交污染,也不会阻塞合并。

@github-actions

Copy link
Copy Markdown
Contributor

🌍 检测到文档变更 - 可进行多语言翻译

统计信息: 共 1 个文件需要处理
操作类型: 新增:0 修改:1 删除:0 移动:0 移动+修改:0

🚀 开始翻译

在此评论回复以下命令之一:

  • /translate all - 翻译所有变更到所有语言 (中文、日文、西班牙语、葡萄牙语)
  • /translate zh - 仅翻译到中文
  • /translate ja - 仅翻译到日文
  • /translate es - 仅翻译到西班牙语
  • /translate pt - 仅翻译到葡萄牙语 (巴西)
  • /translate zh ja - 翻译到中文和日文
  • /translate zh es - 翻译到中文和西班牙语

译文将提交到 base 仓库分支 auto-translate/pr-<PR号> 并打开/复用一个翻译 PR,原 PR 不会被翻译提交污染,也不会阻塞合并。

@limengdu

Copy link
Copy Markdown
Member

Hi @WeSpeakEnglish, thank you for contributing this 1-Wire DS18B20 example! The code is clean and well-structured. Here are a few suggestions to make it even better for wiki readers:

1. Add wiring instructions

The example jumps straight into code without explaining the hardware setup. DS18B20 requires a 4.7kΩ pull-up resistor between the data line and VCC. Could you add a brief wiring description, e.g.:

  • DS18B20 VCC → 3.3V
  • DS18B20 GND → GND
  • DS18B20 DQ → XIAO pin A2 (DA2)
  • 4.7kΩ resistor between DQ and VCC

2. Clarify the pin mapping

The code uses #define OW_PIN 2, which maps to A2/DA2 on the SAMD21. It would help to mention this explicitly in the text above the code block so users don't have to guess.

3. Parasitic power note

The code uses parasitic power mode (digitalWrite(OW_PIN, HIGH) during conversion). This is fine but worth mentioning — some users may prefer normal 3-wire power, and parasitic mode can be unreliable with long cables or multiple sensors.

4. Multi-device limitation

The example uses Read ROM (0x33) which only works with a single device on the bus. A short note like "This example assumes a single DS18B20 on the bus. For multiple devices, use Search ROM (0xF0) instead" would prevent confusion.

5. Suggested library alternatives

For users who want a quicker start, you could mention existing Arduino libraries:

These are all optional improvements. The code itself works correctly — nice CRC implementation and clean serial output. Let us know if you'd like to address any of these or if you prefer to merge as-is!

@nfs0619 nfs0619 requested a review from limengdu June 23, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants