1
1
Fork 0

updated and added README with images

main
Alina Marquardt 2023-04-05 16:09:21 +02:00
parent 4c11f7fc4b
commit ee34951ca6
10 changed files with 84 additions and 38 deletions

56
.gitignore vendored Normal file
View File

@ -0,0 +1,56 @@
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos

13
.vscode/settings.json vendored
View File

@ -1,13 +0,0 @@
{
"python.languageServer": "Pylance",
"python.linting.pylintEnabled": false,
"python.analysis.diagnosticSeverityOverrides": {
"reportMissingModuleSource": "none"
},
"python.analysis.extraPaths": [
"",
"/Users/peter/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.19-darwin-x64/stubs",
"/Users/peter/Library/Application Support/Code/User/globalStorage/joedevivo.vscode-circuitpython/bundle/20220820/adafruit-circuitpython-bundle-py-20220820/lib"
],
"circuitpython.board.version": null
}

View File

@ -1,11 +1,9 @@
def connect(): def connect():
import network import network
from time import sleep_ms from time import sleep, sleep_ms
ssid = "-Netzlein-" ssid = "YourSSID"
password = "Lau5Buam!" password = "totallysecurepassword"
#ssid = "Phaser"
#password = "toolbelt555"
print("Connecting to WiFi") print("Connecting to WiFi")

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# ESP8266 Thermometer with OLED display
![thermometer](images/thermometer.jpg)
## Hardware
- ESP-12F, WiFi Module Based on ESP8266 (preferrably with breakout board)
- SSD1306 128 x 64 Dot Matrix OLED with Controller
- DS1820 parasitic power 1-Wire temperature sensor
## Features
- Connects to Wifi
- Gets outside temperature via openweathermap
- Gets inside temperature via DS1820 temperature sensor
- Plots both temperatures against each other
- Handles Wifi and service outages gracefully
- Handles possible collisions of temperature labels
## Images
![ESP breakout board](images/board.jpg)
![display module](images/display.jpg)
![plot](images/plot.jpg)
![outage](images/outage.jpg)

BIN
images/board.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
images/display.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
images/outage.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
images/plot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
images/thermometer.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 KiB

23
main.py
View File

@ -2,7 +2,7 @@
from machine import Pin, I2C from machine import Pin, I2C
import ssd1306 import ssd1306
from time import sleep_ms from time import sleep, sleep_ms
import onewire, ds18x20 import onewire, ds18x20
import urequests import urequests
import ConnectWiFi import ConnectWiFi
@ -45,23 +45,6 @@ outer_templog = []
refresh_counter = 1 refresh_counter = 1
burn_in_counter = 0 burn_in_counter = 0
"""
def rand( floor, mod=0, negative = False):
# return random value from -floor.mod to floor.mod if negative is True
from os import urandom as rnd
sign = 1 if ord(rnd(1))%10 > 5 else -1
sign = sign if negative else 1
if mod:
value = float(('{}.{}').format(ord(rnd(1))%floor, ord(rnd(1))%mod))
else:
value = int(('{}').format(ord(rnd(1))%floor))
return sign*value
"""
def cleanedlist(list): def cleanedlist(list):
return [i for i in list if i != errortemp] return [i for i in list if i != errortemp]
@ -210,7 +193,7 @@ def refresh_outer():
if connection_success: if connection_success:
try: try:
response = urequests.get('http://api.openweathermap.org/data/2.5/weather?zip=79106,de&appid=50fdc9dbace8903dae0ac4ee4143b3b5') response = urequests.get('http://api.openweathermap.org/data/2.5/weather?zip=---your-zip---,de&appid=---your-app-id---')
parsed = response.json() parsed = response.json()
if 'cod' in parsed: if 'cod' in parsed:
@ -284,7 +267,7 @@ while True:
do_refresh_outer = False do_refresh_outer = False
ds18b20.convert_temp() # refresh value ahead of time for minimum latency ds18b20.convert_temp() # refresh value ahead of time for minimum latency
sleep_ms(1000) # refresh inner temp every second sleep(1) # refresh inner temp every second
print('.', end='') print('.', end='')