Skip to content

okielife/TempSensors

Repository files navigation

Temperature Sensors

This repository (hopefully) contains everything needed to create and manage our temperature sensor system. We primarily use these temperature sensors to monitor temperatures of fridges and freezers at a local food pantry. The sensors are built from Raspberry Picos running MicroPython with DS18x20 one-wire sensors and TFT displays inside 3D printed cases. My intention is to make this as open source as possible, where the only "secret" is the GitHub token used to write the sensor results up to the dashboard repo. This repo contains design information, 3D print models, assembly instructions, documentation, firmware code, CI automated testing, and the Jekyll dashboard build.

Badges that should always be green

Dashboard Deployment Firmware Code Tests Stale Sensor Data Cleanup Static Code Analysis

Badges that might not be green

Temperature(s) out of Range Unresponsive sensor(s)

Convenient Links

Documentation

Latest Docs

The repository is documented on ReadTheDocs from the source in the repo docs/ folder. The documentation covers details about the project, parts lists, assembly instructions, wiring diagrams, and more. The documentation also includes module documentation for everything in the firmware directory.

If you have Sphinx installed (and the sphinx-rtd-theme package), you can build the docs and the instruction manual if you'd like:

cd docs/
make html       # open docs/_build/html/index.html
make latexpdf   # open docs/_build/latex/assembly.pdf

Repository Structure and More

The repository is structured with two "permanent" branches:

  • The main branch contains all the firmware code, design files, tests, scripts, models, docs, and the build rules and assets for the dashboard.
  • The sensor_data branch contains purely the posted results from the sensors, so that these never get in the way of development branches.

The code in the repository consists of:

  • .github/workflows: The yaml workflows that are run either on each commit, pull request, or on a schedule
  • dashboard: The Jekyll based dashboard site, including html templates and snippets, Jekyll configuration, and static data and assets
  • docs: The Sphinx-based RestructuredText documentation that is posted to ReadTheDocs, consisting of hand-written design discussion, assembly instructions, parts list, and soon firmware module documentation
  • firmware: The Python-based firmware, with MicroPython-based code to actually be executed on the Pico, but with supporting Python code to mock behavior for unit testing and even a Tk-based class to mimic the display in a Tk window
  • model: This folder currently just contains a couple 3D model files, but eventually will hold lots of supporting information, maybe design discussion, and more.
  • scripts: Both Python and Bash scripts that are used to support development, both locally and inside GitHub Action instances

The versioning of this project is going to mimic semantic versioning. I anticipate a major release of v3.7 soon, after which I will pivot to v4.0 major version to accommodate more significant changes. All assets necessary for a build are posted with each release, including the 3D models, instructions, and firmware. Ideas for the project are tracked as issues, and the roadmap is to be organized on the milestones page.

Development

One time, do this:

clone
git worktree add sensor_data gh-pages
pip install -r requirements

For firmware development, you can run tests like this:

coverage run -m unittest discover -s firmware/tests

To run scripts on the sensor data or reproduce the dashboard locally, make sure your sensor data is up to date:

python3 scripts/refresh_sensor_data.sh

Then run any script:

python3 scripts/check_all_temperatures.py

You can also run the linters:

mypy firmware --disallow-untyped-calls --disallow-untyped-defs --check-untyped-defs
flake8 firmware/

You can build the dashboard if you have bundler

cd dashboard
bundle exec jekyll serve

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages