Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rhubarbdog/microbit-dht11
a DHT11 class for microbit
https://github.com/rhubarbdog/microbit-dht11
assembler dht11 microbit micropython sensor temperature
Last synced: 24 days ago
JSON representation
a DHT11 class for microbit
- Host: GitHub
- URL: https://github.com/rhubarbdog/microbit-dht11
- Owner: rhubarbdog
- License: mit
- Created: 2018-11-29T00:16:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-03T12:39:40.000Z (almost 2 years ago)
- Last Synced: 2023-03-06T22:49:07.184Z (over 1 year ago)
- Topics: assembler, dht11, microbit, micropython, sensor, temperature
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 5
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-microbit - DHT11 - Library for for the DHT11 temperature and humidity sensor over 1 wire. (👩💻 Programming / 🐍 Python)
README
DHT11 - temperature and humidity measurement
This is the code for version 1 microbits and version 2 microbits, version 1 microbits work on pins 0 to 16 inclusive excluding pins 5 and 11 and the is the same for version 2 microbits except they don't also work on pin 16.
on a version 2 microbit for some reason there are a lot of exceptions on reading the sensor, both invald checksum and too few bits, i don't know why this is.This sensor uses 1 wire for communication, the receipt of bits is written in assembler, it's the only way i could manage to receive all of the data.
There is one user method `.read` this will either return a tuple of valid temperature and humidity data or raise an exception. The only exception to be trapped with a `try:` `except:` block is `DataError`. The sensor may also raise a `ValueError` for using an unsuitable pin or a general `Exception` if the are issues with the assembler routines.
There is some example code at the end of files `version_1.py` and `version_2.py` ,you need to run a REPL session to see the data output.
The sensor is wired as following :
Pin
13 volts (Vcc)
2Data IO, this needs a 5k
pull up resistor
3Not connected
4Ground