Skip to content

Contributed by Bangbang, organized by Ai-Thinker

Adding the LHAL Driver and DS18B20 Temperature Detection to the AI-WB2 Component

  1. Introduction The LHAL driver is a peripheral module component from the newer Bouffalo Lab SDK versions and is not present in older versions. In order to add DS18B20 support and keep the code portable, both were ported together. The DS18B20 is a commonly used digital temperature sensor that outputs a digital signal. It is compact, has low hardware overhead, strong anti-interference capability and high accuracy. It is especially widely used.

  2. Implementation Principle The DS18B20 uses a single-wire bus and has strict timing requirements that must be accurate to microseconds. The AI-WB2 drives it directly with IO17 and uses an internal pull-up.

  3. Code Implementation Principle

Add the LHAL component and the DS18B20 module code

  1. Source Code

For the component, copy it into the component directory

Attachments uploaded:

platform.zip(3.97 MB, downloads: 1)

Example

  1. Special Thanks
  • @file driver_ds18b20.c
  • @brief driver ds18b20 source file
  • @version 2.0.0
  • @author Shifeng Li
  • @date 2021-04-06

Released under the MIT License. Build Time 2026-09-11 14:52:23