-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 43d281c
Showing
30 changed files
with
8,378 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.clangd/ | ||
build/ | ||
sdkconfig | ||
sdkconfig.old | ||
compile_commands.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# The following five lines of boilerplate have to be in your project's | ||
# CMakeLists in this exact order for cmake to work correctly | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
project(airmon LANGUAGES C) | ||
|
||
set(PROJECT_ELF ${project_elf}) | ||
|
||
# Ignore false clang warnings about `struct foo = { 0 }` | ||
target_compile_options(${PROJECT_ELF} PRIVATE -Wno-missing-braces -Wmissing-field-initializers) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Build and deploy doxygen documention to GitHub Pages | ||
sudo: false | ||
dist: trusty | ||
|
||
# Blacklist | ||
branches: | ||
only: | ||
- master | ||
|
||
# Environment variables | ||
env: | ||
global: | ||
- GH_REPO_REF: github.com/DavidAntliff/esp32-ds18b20.git | ||
|
||
# Install dependencies | ||
addons: | ||
apt: | ||
packages: | ||
- doxygen | ||
- doxygen-doc | ||
- doxygen-latex | ||
- doxygen-gui | ||
- graphviz | ||
|
||
# Build the docs | ||
script: | ||
- cd doc | ||
- doxygen | ||
|
||
# Deploy using Travis-CI/GitHub Pages integration support | ||
deploy: | ||
provider: pages | ||
skip-cleanup: true | ||
local-dir: doc/html | ||
github-token: $GITHUB_TOKEN | ||
on: | ||
branch: master | ||
target-branch: gh-pages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set(COMPONENT_ADD_INCLUDEDIRS include) | ||
set(COMPONENT_SRCS "ds18b20.c") | ||
set(COMPONENT_PRIV_REQUIRES "esp32-owb") | ||
register_component() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 David Antliff | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# esp32-ds18b20 | ||
|
||
## Introduction | ||
|
||
This is a ESP32-compatible C component for the Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital | ||
Thermometer device. | ||
|
||
It supports multiple devices on the same 1-Wire bus. | ||
|
||
It is written and tested for v2.1, v3.0-3.3 and v4.1-beta1 of the [ESP-IDF](https://github.com/espressif/esp-idf) | ||
environment, using the xtensa-esp32-elf toolchain (gcc version 5.2.0). | ||
|
||
## Dependencies | ||
|
||
Requires [esp32-owb](https://github.com/DavidAntliff/esp32-owb). | ||
|
||
## Example | ||
|
||
See [esp32-ds18b20-example](https://github.com/DavidAntliff/esp32-ds18b20-example) for an example that supports single | ||
and multiple devices on a single bus. | ||
|
||
## Features | ||
|
||
In cooperation with the underlying esp32-owb component, this component includes: | ||
|
||
* External power supply mode. | ||
* Parasitic power mode (VDD and GND connected) - see notes below. | ||
* Static (stack-based) or dynamic (malloc-based) memory model. | ||
* No globals - support any number of DS18B20 devices on any number of 1-Wire buses simultaneously. | ||
* 1-Wire device detection and validation, including search for multiple devices on a single bus. | ||
* Addressing optimisation for a single (solo) device on a bus. | ||
* CRC checks on temperature data. | ||
* Programmable temperature measurement resolution (9, 10, 11 or 12-bit resolution). | ||
* Temperature conversion and retrieval. | ||
* Separation of conversion and temperature retrieval to allow for simultaneous conversion across multiple devices. | ||
|
||
## Parasitic Power Mode | ||
|
||
Consult the [datasheet](http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf) for more detailed information about | ||
Parasitic Power mode. | ||
|
||
Parasitic power operation can be detected by `ds18b20_check_for_parasite_power()` followed by a call to | ||
`owb_use_parasitic_power()`, or simply set explicitly by a call to the latter. | ||
|
||
This library has been tested on the ESP32 with two parasitic-power configurations, with two DS18B20 devices at 3.3V: | ||
|
||
1. Disconnect power to each device's VDD pin, and connect that pin to GND for each device. Power is supplied to | ||
each device through the OWB data line. | ||
2. Connect the OWB data line to VCC via a P-channel MOSFET (e.g. BS250) and current-limiting resistor (e.g. 270 Ohm). | ||
Ensure your code calls `owb_use_strong_pullup_gpio()` with the GPIO connected to the MOSFET Gate. The GPIO will go | ||
high during temperature conversion, turning on the MOSFET and providing power from VCC to each device through the OWB | ||
data line. | ||
|
||
If you set up configuration 1 and do not see CRC errors, but you get incorrect temperature readings around 80 - 85 | ||
degrees C, then it is likely that your DS18B20 devices are running out of power during the temperature conversion. In | ||
this case, consider reducing the value of the pull-up resistor. For example, I have had success obtaining correct | ||
conversions from two parasitic DS18B20 devices by replacing the 4k7 Ohm pull-up resistor with a 1 kOhm resistor. | ||
|
||
Alternatively, consider using configuration 2. | ||
|
||
Note that use of parasitic power mode disables the ability for devices on the bus to signal that an operation has | ||
completed. This means that DS18B20 devices in parasitic power mode are not able to communicate when they have completed | ||
a temperature conversion. In this mode, a delay for a pre-calculated duration occurs, and then the conversion result is | ||
read from the device(s). *If your ESP32 is not running on the correct clock rate, this duration may be too short!* | ||
|
||
## Documentation | ||
|
||
Automatically generated API documentation (doxygen) is available [here](https://davidantliff.github.io/esp32-ds18b20/index.html). | ||
|
||
## Source Code | ||
|
||
The source is available from [GitHub](https://www.github.com/DavidAntliff/esp32-ds18b20). | ||
|
||
## License | ||
|
||
The code in this project is licensed under the MIT license - see LICENSE for details. | ||
|
||
## Links | ||
|
||
* [DS18B20 Datasheet](http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf) | ||
* [1-Wire Communication Through Software](https://www.maximintegrated.com/en/app-notes/index.mvp/id/126) | ||
* [1-Wire Search Algorithm](https://www.maximintegrated.com/en/app-notes/index.mvp/id/187) | ||
* [Espressif IoT Development Framework for ESP32](https://github.com/espressif/esp-idf) | ||
|
||
## Acknowledgements | ||
|
||
Parts of this code are based on references provided to the public domain by Maxim Integrated. | ||
|
||
"1-Wire" is a registered trademark of Maxim Integrated. | ||
|
||
## Roadmap | ||
|
||
The following features are anticipated but not yet implemented: | ||
|
||
* Concurrency support (multiple tasks accessing devices on the same bus). | ||
* Alarm support. | ||
* EEPROM support. | ||
* Parasitic power support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Use defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
html/ | ||
latex/ | ||
|
Oops, something went wrong.