BenVosper / heated

I don't need a microwave

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

heated

Scripts to turn Tinkerforge bricklets into a general-purpose PID controlled heater.


Assumes we've got a running brickd instance and the following bricklets connected:

Also requires:

Tested and working on a Raspberry Pi Zero with a HAT Zero Brick but theoretically would work fine with any other master brick.

Scripts

There are currently two scripts available:

unregulated.py

This provides a GUI which allows heater power to be set directly. The thermocouple temperature is visible and tracked over time via a graph.

If power is set to 0 or 100%, the relay is turned permanently off or on respectively. For any values in between, we use PWM with a fixed frequency (1Hz by default).

regulated.py

Provides a GUI which allows a desired target temperature to be set. A PID loop then dynamically updates heater power according to thermocouple temperature and tuning parameters.

controls-tab

The controls tab. Use the buttons to modify the set temperature (S)

Thermocouple temperature can again be visualised via a graph to verify stability.

graph-tab

The graph tab. Each horizontal pixel is one thermocouple reading. As such, the time scale is determined by the read period (default: 1 second per pixel)

PID parameters are set via the separate tuning.json file which is read on initialisation. If Heater.tuning_mode is set to True, this file is read on every PID iteration. This is useful for live PID tuning.

Usage

After installing requirements and ensuring that brickd is running, simply execute your desired script:

./unregulated.py

or

./regulated.py

For long-term use, you can use your preferred method of autostarting this script on boot. On a Pi Zero, I've had success using a systemd service set to start as soon as brickd is up.

The "Settings" tab in the GUI for both scripts provides a "Shut Down" button that executes a graceful shutdown of the host device. This may need to be updated as appropriate for your system.

About

I don't need a microwave


Languages

Language:Python 100.0%