Profile
Back to NewsBack
GitHub Trending 8 min
Reader Mode
jbruce12000/kiln-controller: Turns a Raspberry Pi into an inexpensive, web-enabled kiln controller.

jbruce12000/kiln-controller: Turns a Raspberry Pi into an inexpensive, web-enabled kiln controller.

5 hours ago

Kiln Controller ==========

Turns a Raspberry Pi into an inexpensive, web-enabled kiln controller.

Features

* supports many boards into addition to raspberry pi * supports Adafruit MAX31856 and MAX31855 thermocouple boards * support for K, J, N, R, S, T, E, or B type thermocouples * easy to create new kiln schedules and edit / modify existing schedules * no limit to runtime - fire for days if you want * view status from multiple devices at once - computer, tablet etc * real-time firing cost estimate * real-time heating rate displayed in degrees per hour * supports PID parameters you tune to your kiln * monitors temperature in kiln after schedule has ended * api for starting and stopping at any point in a schedule * accurate simulation * support for shifting schedule when kiln cannot heat quickly enough * support for skipping first part of profile to match current kiln temperature * prevents integral wind-up when temperatures not near the set point * automatic restarts if there is a power outage or other event * web-configurable alerts for every safety and run-lifecycle event * easy scheduling of future kiln runs

Web Interface

A full single-page web app provides real-time kiln monitoring, profile editing, scheduling, and live config editing. See the Web Interface Guide for details. Below are screenshots of each tab:

!Image

Details

!Image

Schedules

!Image

Config

!Image

Hardware

Parts

| Image | Hardware | Description | | ------| -------- | ----------- | | !Image | Raspberry Pi | Virtually any Raspberry Pi will work since only a few GPIO pins are being used. Any board supported by blinka and has SPI should work. You'll also want to make sure the board has wifi. If you use something other than a Raspberry PI and get it to work, let me know. | | !Image | Adafruit MAX31855 or Adafruit MAX31856 | Thermocouple breakout board | | !Image | Thermocouple | Invest in a heavy duty, ceramic thermocouple designed for kilns. Make sure the type will work with your thermocouple board. Adafruit-MAX31855 works only with K-type. Adafruit-MAX31856 is flexible and works with many types, but folks usually pick S-type. | | !Image | Breadboard | breadboard, ribbon cable, connector for pi's gpio pins & connecting wires | | !Image | Solid State Relay | Zero crossing, make sure it can handle the max current of your kiln. Even if the kiln is 220V you can buy a single 3 Phase SSR. It's like having 3 SSRs in one. Relays this big always require a heat sink. | | !Image | Electric Kiln | There are many old electric kilns on the market that don't have digital controls. You can pick one up on the used market cheaply. This controller will work with 110V or 220V (pick a proper SSR). My kiln is a Skutt KS-1018. |

Schematic

The pi has three gpio pins connected to the MAX31855 chip. D0 is configured as an input and CS and CLK are outputs. The signal that controls the solid state relay starts as a gpio output which drives a transistor acting as a switch in front of it. This transistor provides 5V and plenty of current to control the ssr. Since only four gpio pins are in use, any pi can be used for this project. See the config file for gpio pin configuration.

My controller plugs into the wall, and the kiln plugs into the controller.

WARNING This project involves high voltages and high currents. Please make sure that anything you build conforms to local electrical codes and aligns with industry best practices.

Note: The GPIO configuration in this schematic does not match the defaults, check config and make sure the gpio pin configuration aligns with your actual connections.

!Image

Note: I tried to power my ssr directly using a gpio pin, but it did not work. My ssr required 25ma to switch and rpi's gpio could only provide 16ma. YMMV.

Software

Raspberry PI OS

Download Raspberry PI OS. Use Rasberry PI Imaging tool to install the OS on an SD card. Boot the OS, open a terminal and...

$ sudo apt-get update $ sudo apt-get dist-upgrade $ git clone https://github.com/jbruce12000/kiln-controller $ cd kiln-controller $ python3 -m venv venv $ source venv/bin/activate $ pip install -e .

Note: The above steps work on ubuntu if you prefer

For development and contributing, see CONTRIBUTING.md.

Raspberry PI deployment

If you're done playing around with simulations and want to deploy the code on a Raspberry PI to control a kiln, you'll need to do this in addition to the stuff listed above:

$ sudo raspi-config interfacing options -> SPI -> Select Yes to enable select reboot

Configuration

All parameters are defined in config.py. You need to read through config.py carefully to understand each setting. Here are some of the most important settings:

| Variable | Default | Description | | -------- | ------- | ----------- | | sensor_time_wait | 2 seconds | It's the duty cycle for the entire system. It's set to two seconds by default which means that a decision is made every 2s about whether to turn on relay[s] and for how long. If you use mechanical relays, you may want to increase this. At 2s, my SSR switches 11,000 times in 13 hours. | | temp_scale | f | f for farenheit, c for celcius | | pid parameters | | Used to tune your kiln. See PID Tuning or Autotuner. | | simulate | True | Simulate a kiln. Used to test the software by new users so they can check out the features. |

Testing

After you've completed connecting all the hardware together, there are scripts to test the thermocouple and to test the output to the solid state relay. Read the scripts below and then start your testing. First, activate the virtual environment like so...

$ source venv/bin/activate

then test the thermocouple with:

$ ./test-thermocouple.py

then test the output with:

$ ./test-output.py

and you can use this script to examine each pin's state including input/output/voltage on your board:

$ ./gpioreadall.py

PID Tuning

The Config tab on the web interface includes a built-in PID Auto-Tuner that heats the kiln at full power to 400F, records the heating curve, and calculates optimal PID values using the Ziegler-Nichols method. The new values are written to config.py automatically and the controller restarts. See the Web Interface Guide for details.

If you end up having to manually tune, here is a PID Tuning Guide.

Usage

Server Startup

$ source venv/bin/activate; ./kiln-controller.py

Autostart Server onBoot

If you want the server to autostart on boot, run the following command:

$ /home/pi/kiln-controller/start-on-boot

Client Access

Click http://127.0.0.1:8081 for local development or the IP of your PI and the port defined in config.py (default 8081).

Simulation

In config.py, set simulate=True. Start the server and select a profile and click Start. Simulations run at near real time.

Scheduling a Kiln run

You can schedule a firing to start at a specific date and time from the Profiles tab or the Schedule button next to Start on the Overview tab. Scheduled runs are saved to disk so they survive a reboot, and are managed by the running kiln-controller process.

Alerts

The Alerts panel on the Config tab lets you choose which conditions raise an alert: safety-critical events (emergency shutoff, relay stuck on, thermocouple failure), run lifecycle events (started, completed, aborted, power-outage restart), and informational events. Selections are saved to disk and survive a reboot. See the Alerts Guide for the full registry, detection thresholds, and delivery setup.

All of these conditions are detected live while the controller runs, and each fired alert is written to the daemon log tagged ALERT with the details.

Delivery -- the bottom of the Alerts panel chooses where fired alerts go beyond the log:

  • MQTT -- publishes each alert as json to its own topic (default
kiln/alert) on the same broker as the live state stream. Requires mqtt_enable = True in config.py.
  • Webhook -- posts each alert as json to any url: ntfy, discord, slack,
home assistant, pushover, or your own receiver.

Both take effect immediately when toggled (no restart) and their settings are saved with the alert checkboxes.

Logging

Daemon logs land in /var/log/daemon.log, and the kiln-logger.py script records a full firing to csv for graphing and analysis. See the logging guide for details.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see .

Support & Contact

Please use the issue tracker for project related issues. If you're having trouble with hardware, I did too. Here is a troubleshooting guide I created for testing RPi gpio pins.

Origin

This project was originally forked from https://github.com/apollo-ng/picoReflow but has diverged a large amount.
Chat with me