Go to file
smallsolar 345d16b542 Update readme.MD
Added example code (will obviously need to setup timers etc.
2025-04-19 16:43:02 +00:00
ds18b20.c Updated and tidied up file, also can now have multiple sensors (but each on an individual bus) 2025-04-19 16:13:47 +00:00
ds18b20.h Updated with raw_temperature function and also added ability to have multiple sensors 2025-04-19 16:12:29 +00:00
readme.MD Update readme.MD 2025-04-19 16:43:02 +00:00

readme.MD

DS18B20 for the STM32F0 using libopencm3

Introduction

A simple driver written for libopencm3 and stm32f0, it was written from first principles and uses a GPIO to read and write bits to the DS18b20.

Limitations:

  • It ignores the ROM Search therefore can only have a single ds18b20 sensor on each bus (but you can use multiple buses)
  • It uses NOP for some of its timing which is probably not ideal
  • The timings are rough, it could need some optimisation (but works with the fake ds18b20s I have.)

Example Usage

#include "ds18b20.h"

//Get Data from DS18b20 Sensor 1
ds18b20_start_conversion(GPIOB, GPIO1);
// Wait for conversion to complete
delay_ms(750);
int16_t ds_temp = ds18b20_read_raw_temperature(GPIOB, GPIO1);

References