Giter Club home page Giter Club logo

kiln-controller's Introduction

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
  • support for a watcher to page you via slack if you kiln is out of whack
  • easy scheduling of future kiln runs

Run Kiln Schedule

Image

Edit Kiln Schedule

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.

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 -r requirements.txt

Note: The above steps work on ubuntu if you prefer

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.
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

Run the autotuner. It will heat your kiln to 400F, pass that, and then once it cools back down to 400F, it will calculate PID values which you must copy into config.py. No tuning is perfect across a wide temperature range. Here is a PID Tuning Guide if you end up having to manually tune.

There is a state view that can help with tuning. It shows the P,I, and D parameters over time plus allows for a csv dump of data collected. It also shows lots of other details that might help with troubleshooting issues. Go to /state.

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

If you want to schedule a kiln run to start in the future. Here are examples.

Watcher

If you're busy and do not want to sit around watching the web interface for problems, there is a watcher.py script which you can run on any machine in your local network or even on the raspberry pi which will watch the kiln-controller process to make sure it is running a schedule, and staying within a pre-defined temperature range. When things go bad, it sends messages to a slack channel you define. I have alerts set on my android phone for that specific slack channel. Here are detailed instructions.

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 http://www.gnu.org/licenses/.

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.

kiln-controller's People

Contributors

2bitoperations avatar adq avatar andyrawson avatar benkrasnow avatar chipgarner avatar chron0 avatar davelloper avatar igor-rast avatar jbruce12000 avatar maestr0 avatar openelectron avatar ryanjdillon avatar sbman avatar yggi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kiln-controller's Issues

kiln-tuner.py dosent stop when target temp is reached

Hi

I just tried to run the kiln-tuner, but is does not stop when max temp is reached.

the compare don't think to work when temp from kiln is is float and taget temp is in int.

I tried to change code like this:

recordprofile(args.csvfile, float(args.targettemp))

and seems to fix it, but kiln is not turned off even though code is called:

oven.output.heat(0)

heating control

I have a kiln , I am 85 yrs old and need some help setting this up. I have downloaded and installed on a Pi3 but havent found out how to get the prgm onto a screen.
I am not a programmer an EE in analog circuits. help please...it seems like this work was a very considerable effort and I am so grateful to find it.
My email is [email protected]

Log file

My understanding is that logs are saved in /var/log/daemon.log. This file exists on my Pi. However, it contains data unrelated to the KilnController, seemingly related to the Pi OS. So I don't get a log of my kiln runs. Can the kiln log be renamed or saved elsewhere? Or is there different problem/solution? TIA

FYI, I've implemented KilnController exactly as described here, and it works a treat! But my coding knowledge ended with Fortran many years ago and I rely on the generosity of strangers. Thank you.

Thermocouple short to ground & short to VCC

Hello. I first downloaded and installed this software in March. Everything worked great (thank you!) for several runs as I tested out a newly built wax burnout kiln. After initial testing, I had to put the project aside for a while. When I came back to it, I ran the software and would get an occasional Thermocouple Short to Ground error or a Short to VCC error in the console. The next time I ran it...I got the same errors. I was concerned that I got some debris into breadboard or that some wiring had come loose so I rewired the circuit. Did not fix. I built and installed a new MAX31855. Did not fix. I got a new RPI and soldered the circuit. I moved the flash to the new RPI and booted it. Same errors. Now everything is new/different except the flash and the errors are still there. Later today I will start with a new flash and reinstall all the software. I suspect and hope that this will resolve the issue.

Have you had anything like this happen before? Is there any easy fix?

Also...when I changed the RPI, I went from 3B+ to zeroW. I have seen a few oddities that may be manifestations of the same problem that results in the Thermocouple Short errors. There is a pull down list that shows the saved profiles. It does not get populated with the existing saved profiles until you add a new profile and save it...then all the previous profiles show up in the list. Also, the controller was set to degrees F in March but now the units are degrees C but the value is correct as if the units are in F. Very strange...seemingly non-deterministic behavior.

FYI...I have been an Arduino fan for many years and I am accustomed to its robustness. Maybe RPI is more easily corrupted due to incorrect shutdown? I did have a test running when the electrician shut off a breaker to work on a group of circuits and my RPI Kiln Controller was running on one of them. I thought I had a successful run after that but now I am not so certain.

Thanks for the work you are doing on this project. Let me know if you would like me to look at something on the flash. I will not reformat that flash....I will start with a new one...so it will be available to you for a few weeks at least.

image

ERROR oven : problem reading temp.

Here is the terminal output after inital ok reading it goes to this
ERROR oven : problem reading temp N/C: False GND: False VCC: False ???: True.
It reads tp until reaches this . Help!

Are you interested in my kiln display code?

Hi, I'm not submitting this as a merge request yet. I was just wondering if you would be interested in me doing so?

I bought one of these for my pi: https://www.adafruit.com/product/4484

I wrote software talking to the exsting websocket API: https://github.com/adq/kiln-controller/blob/kilndisplay/kiln-display.py
(The buttons do not do anything right now)

Retrofitted to my kiln (replacing the original 3 button controller) , it looks like this (running the 200/250 test profile): kilnlcd

Main problem is I had to shift the GPIOs along to make room for the LCD.

Thermocouple board compatibility

I picked up Adafruits' new board, the MCP9600 for the K-type Thermocouple. Is there a way to make this compatible with your program? It doesn't seem to detect it.

ModuleNotFoundError: No module named 'RPi'

~/kiln-controller $ source venv/bin/activate; ./kiln-controller.py
2021-08-07 12:31:28,131 INFO kiln-controller: Starting kiln controller
2021-08-07 12:31:28,149 INFO kiln-controller: this is a real kiln
2021-08-07 12:31:28,152 INFO oven: import MAX31855
2021-08-07 12:31:28,155 INFO oven: init MAX31855
Traceback (most recent call last):
File "./kiln-controller.py", line 44, in
oven = RealOven()
File "/home/pi/kiln-controller/lib/oven.py", line 382, in init
self.board = Board()
File "/home/pi/kiln-controller/lib/oven.py", line 49, in init
self.create_temp_sensor()
File "/home/pi/kiln-controller/lib/oven.py", line 77, in create_temp_sensor
self.temp_sensor = TempSensorReal()
File "/home/pi/kiln-controller/lib/oven.py", line 109, in init
from max31855 import MAX31855, MAX31855Error
File "/home/pi/kiln-controller/lib/max31855.py", line 2, in
import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'

I'm getting the following error when trying to get the service to run on a Pi Zero W using the documentation

Any suggestions?

Kiln Venting Option

First of all thank you for the code I am very happy to use it.

I need to ventilate the ceramic kiln during firing.
How can I do this? It would need to be on for several hours.(gpio on) Then turn it off. (gpio off)
So I think an option where you could control a relay based on time or temperature would be useful.
Optional: Editing this in the web interface.

If someone could help me with this, I would be happy to pay. So that others can benefit from it.

Thank you!

kiln-tuner cooling state

Hi

When running the kiln-tuner.py should it not run until target tempature and ALL the way down to the start tempature?

Or does it just need to run until target tempature is met?

Thanks
Felix

remote access

I now have kiln-controller working locally but cannot access remotely. What do i need to do? Thank you.

Shutting down the Pi

I am curious to find out if it is considered detrimental to just pull the power to powerdown the RPi as there is no easy way to shut the system down without having a screen plugged into the RPi.

I know in the past I have wrecked the software on an SD card from simply pulling the power lead. !

As you can tell I am a software novice.

Many thanks to all. Totally brilliant project. Look forward to powering up the kiln very soon.

Config : "Could not import config file."

I have been running an old version using a MAX31855: works OK but I have some 'Short to Vcc' 'Short to ground' blips at high temps so I have built a new version using a MAX31856.

I am having a really strange problem: when I run kiln-controller.py I get the 'Could not import config file.' fault. I have tried deleting the config.py file and reinstating by copying from config.py.EXAMPLE - still no joy.

OS is a clean full 32 bit Rasp Pi OS using Rasp Pi Imager v1.6

Any ideas?

Running in parallel with an existing controller

Hi! I have a Skutt 818 which has an electronic controller and was wondering if it was possible to run this in parallel with the existing electronic controller. My use case would be to fire the kiln with the existing controller and basically use this project to monitor temps remotely and was thinking of being able to wire the thermocouple to both the boards in parallel or in series without any relays, but I'm not confident if that would work. Thanks!

MAX31855 Measurement Instability

Hi,

During testing I have noticed instability of the temp measurements from the MAX31855 board when observing the GUI.
The average temperature intermittently jumps +/- 40deg C, usually ~2mins between changing the average temp.
I connected the MAX31855 to an Arduino and have confirmed that stable measurements are being obtained from this board so it seems to be the Pi.
Can you provide any advice regarding what might cause this issue?

Thanks, Shannon

MAX31855 stuck at 32 degrees F

Says when starting the kiln the channel is already in use for the 31855. Did I blow my pid?

Also see this error:

ERROR ovenWatcher: could not write to socket <geventwebsocket.websocket.WebSocket object at 0xb4aebdf8>

Full terminal summary:

Last login: Mon Oct 25 17:08:27 2021 from 192.168.1.113
pi@raspberrypi:~ $ cd kiln-controller pi@raspberrypi:~/kiln-controller $ source venv/bin/activate; ./kiln-controller.py
2021-10-26 06:28:03,396 INFO kiln-controller: Starting kiln controller
2021-10-26 06:28:03,414 INFO kiln-controller: this is a real kiln
2021-10-26 06:28:03,417 INFO oven: import MAX31855
2021-10-26 06:28:03,420 INFO oven: init MAX31855
/home/pi/kiln-controller/lib/max31855.py:33: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(self.cs_pin, GPIO.OUT)
/home/pi/kiln-controller/lib/max31855.py:34: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(self.clock_pin, GPIO.OUT)
2021-10-26 06:28:03,485 INFO kiln-controller: listening on 192.168.1.128:8081
2021-10-26 06:28:08,366 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/index.html HTTP/1.1" 200 8186 0.098801
2021-10-26 06:28:08,486 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/jquery.event.drag-2.2.js HTTP/1.1" 200 13011 0.013681
2021-10-26 06:28:08,539 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/css/bootstrap-theme.min.css HTTP/1.1" 200 17892 0.016566
2021-10-26 06:28:08,563 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/css/bootstrap-modal.css HTTP/1.1" 200 4930 0.013804
2021-10-26 06:28:08,588 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/css/select2.css HTTP/1.1" 200 21165 0.0121752021-10-26 06:28:08,612 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/jquery.flot.resize.js HTTP/1.1" 200 3319 0.013000
2021-10-26 06:28:08,650 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/css/bootstrap.min.css HTTP/1.1" 200 103084 0.148183
2021-10-26 06:28:08,665 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/jquery-1.10.2.min.js HTTP/1.1" 200 93292 0.222365
2021-10-26 06:28:08,694 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/css/picoreflow.css HTTP/1.1" 200 14869 0.011435
2021-10-26 06:28:08,719 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/jquery.flot.draggable.js HTTP/1.1" 200 5461 0.012316
2021-10-26 06:28:08,740 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/bootstrap.min.js HTTP/1.1" 200 27933 0.010493
2021-10-26 06:28:08,748 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/jquery.flot.js HTTP/1.1" 200 121898 0.123951
2021-10-26 06:28:08,773 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/jquery.bootstrap-growl.min.js HTTP/1.1" 200 1326 0.010567
2021-10-26 06:28:08,798 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/select2.min.js HTTP/1.1" 200 60928 0.013018
2021-10-26 06:28:08,826 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/js/picoreflow.js HTTP/1.1" 200 21450 0.012554
{'type': 'backlog', 'profile': None, 'log': []}
{"type": "backlog", "profile": null, "log": []}
2021-10-26 06:28:08,865 INFO kiln-controller: websocket (status) opened
2021-10-26 06:28:08,891 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/images/panel_bg.png HTTP/1.1" 200 700 0.010047
2021-10-26 06:28:08,909 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/css/select2x2.png HTTP/1.1" 200 1015 0.008400
2021-10-26 06:28:08,934 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/fonts/tables.woff HTTP/1.1" 200 17488 0.011143
2021-10-26 06:28:08,959 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/fonts/glyphicons-halflings-regular.woff HTTP/1.1" 200 23464 0.012299
2021-10-26 06:28:08,983 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:08] "GET /picoreflow/assets/fonts/digital-7-webfont.woff HTTP/1.1" 200 11392 0.011865
2021-10-26 06:28:08,998 INFO kiln-controller: websocket (control) opened
2021-10-26 06:28:09,099 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 06:28:09] "GET /favicon.ico HTTP/1.1" 404 870 0.083990
2021-10-26 06:28:09,115 INFO kiln-controller: websocket (config) opened
2021-10-26 06:28:09,152 INFO kiln-controller: websocket (storage) opened
2021-10-26 06:28:09,164 INFO kiln-controller: GET command received
2021-10-26 07:31:05,473 INFO geventwebsocket.handler: 192.168.1.113 - - [2021-10-26 07:31:05] "GET /picoreflow/index.html HTTP/1.1" 304 66 0.006941
2021-10-26 07:31:05,498 INFO kiln-controller: websocket (status) closed
2021-10-26 07:31:05,506 INFO kiln-controller: websocket (config) closed
2021-10-26 07:31:05,517 ERROR kiln-controller: Connection is already closed
2021-10-26 07:31:05,520 INFO kiln-controller: websocket (control) closed
2021-10-26 07:31:05,529 INFO kiln-controller: websocket (storage) closed
{'type': 'backlog', 'profile': None, 'log': []}
{"type": "backlog", "profile": null, "log": []}
2021-10-26 07:31:05,558 INFO kiln-controller: websocket (status) opened
2021-10-26 07:31:05,618 INFO kiln-controller: websocket (control) opened
2021-10-26 07:31:05,653 INFO kiln-controller: websocket (config) opened
2021-10-26 07:31:05,695 INFO kiln-controller: websocket (storage) opened
2021-10-26 07:31:05,708 INFO kiln-controller: GET command received
2021-10-26 07:31:06,217 ERROR ovenWatcher: could not write to socket <geventwebsocket.websocket.WebSocket object at 0xb4aebdf8>

Last login: Mon Oct 25 17:07:00 2021 from 192.168.1.113
pi@raspberrypi:~ $ cd kiln-controller pi@raspberrypi:~/kiln-controller $ source venv/bin/activate; ./kiln-controller.py
2021-10-25 17:08:35,746 INFO kiln-controller: Starting kiln controller
2021-10-25 17:08:35,764 INFO kiln-controller: this is a real kiln
2021-10-25 17:08:35,767 INFO oven: import MAX31855
2021-10-25 17:08:35,769 INFO oven: init MAX31855
/home/pi/kiln-controller/lib/max31855.py:33: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(self.cs_pin, GPIO.OUT)
/home/pi/kiln-controller/lib/max31855.py:34: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(self.clock_pin, GPIO.OUT)
2021-10-25 17:08:35,822 INFO kiln-controller: listening on 192.168.1.128:8081

question about wiring and operation

Hey, first of all, looks like great work!

Perhaps a naive question, but looks like you are just wiring the SSR on one of the hot legs between the power outlet and your kiln sitter. Is this correct? I have a 220V 40A kiln with six elements and six control knobs. In this case do you just set all knobs to max and let the controller flip the SSR on and off as needed?

MAX31865 and PT100 (Not rely an issue).

Love your work :)
Would it be possible to ad support for MAX31865 and PT100 and possibly also support for PT1000 and NTC thermistors (last one commonly used on 3D printer and dirt cheap). i2C interface?

gevent-websocket not geventwebsocket?

In kiln-controller.py the line import geventwebsocket does not work and it appears that geventwebsocket should be hyphenated. Is this an error or what..please explain?
Ronald.

2 or 3 phase kiln

Hi

If I want to use a 2 or 3 phase kiln, should I just double/trible the diagram to the solid relays or can I just connect solid relays in parallel?

Thanks!
Felix

error on installing instructions.

hi, on instruction there is a little error:
sudo apt-get install pytho3-dev python3-virtualenv libevent-dev virtualenv

should be
sudo apt-get install python3-dev python3-virtualenv libevent-dev virtualenv

thank you for all
giorgio

Illegal Instruction error on Pi Zero W

I'm getting an Illegal instruction error when trying to run this on a Pi Zero W. I think this is most likely due to an ARMv6 / ARMv7 compilation issue in one of the dependencies, but little to no clue which one is the culprit!

I have a Pi Zero W2 I will try on, which shares the CPU with the Pi 3b. Will report back!

Direct temperature input

Hi, I'm looking into using this for a heat treat oven I have. Would it be possible to add a field for direct temperature input, or to make the target temp field editable when not running a schedule? It would make it a lot easier to harden and temper steel when there are many different set points, each individual one used infrequently. It would also allow for easier preheating.

max31856 pinout

Hi

I have a max31856

so pinput is like this:

D0 = SD0 (max31856)
CS = CS (max31856)
CLK = SCK (max31856)

Or?

Thanks

Screenshot 2021-08-31 at 15 54 03

Heat on icon

Current clean install on pi Zero linked to a MAX31856 board. The red .ds-led-heat-active icon only flashes on once (for about a second) per duty cycle even if the whole cycle is logged as 'heat on'. Tested lengthening duty cycle to 20 secs and red heat on icon still only flashes on once per cycle.

Any thoughts on where I should look?

config not imported

I am having an issue where it says it can't import the config file and that I need to copy it from the example. Even though I have done that and changed what I needed to in it.

I am using the latest rasbian BTW.

Contactor adaptation

Please bear with me, I am an amateur potter and a Python illiterate.
I am using your Rasp Pi set up to control an old electric kiln with a contactor. Thank you!

I originally used a MAX31855 and a kiln-controller branch pre oven.py rewrite. Because I am controlling a contactor (built into the kiln and as a fail-safe) I added a couple of lines within oven.py def set_heat(self, value): (see below) to test the state of pin 23 and to only change the state when needed (so only turn on if now off, only turn off if now on). This stopped unnecessary on/off wear on the contactor and was a lot quieter.

I am having trouble with MAX31855 Short to Vcc, Short to ground problems at higher temps so I have bought MAX31856 and run it with the latest version of kiln-controller. It works but the poor old contactor now sounds like an Uzi. I think I can get control more binary by reducing window_size in line 477 of oven.py and can increase service cycle but I am struggling to work out where the ON and OFF bit (equivalent to def set_heat(self, value):) is in the rewritten oven.py so I can add pin 23 state test to reduce the contactor switching.

Any help gratefully received.

def set_heat(self, value):
if value > 0:
self.heat = 1.0
if gpio_available:
if config.heater_invert:
GPIO.input(config.gpio_heat)==0 # test state of pin 23

time.sleep(self.time_step * value)

             GPIO.output(config.gpio_heat, GPIO.HIGH)
             time.sleep(self.time_step * value)
           else:
             GPIO.input(config.gpio_heat)==1
             GPIO.output(config.gpio_heat, GPIO.LOW)
             time.sleep(self.time_step * value)__

Max31855 calibration

Hi there. Great library. I built my own kiln and have been playing with this. I’ve run into a problem where my k type thermocouple is drastically under reporting the temperature. The end result is my metal clay that should be sintering at 1500f are turning into spheres of metal land I’m burning out heating elements. I’m going to get a new thermocouple but wondering how I can take some test voltages at known temperatures and integrate that into the max31855 code. I looked through max31855.py but not sure how I’d modify it for a calibration curve.

emergency_shutoff_temp doesn’t currently shut off heaters?

Amazing project! I'm thinking about implementing this for one of the kilns at our maker space.

I was browsing the code, and noticed that although there is a emergency_shutoff_temp wisely defined with a note that SSRs can fail closed, it looks like all this does when tripped is to reset the Pi, which if I understand correctly would leave heater energized via the failed SSR.

If this is indeed the case, what about adding a failsafe mechanical NO relay that is controlled from the RPi via a GPIO pin only enabled on successful startup?

If I'm missing something and this would be redundant let me know, otherwise I'm happy to submit a PR with the functionality if we implement it.

Thanks for sharing this great project!

Short to ground and VCC, stuck temperature

I'm having the problem that as the kiln temperature gets above 1000 deg F, I start to see intermittent thermocouple errors, initially with a short to ground, and then a short to VCC. The run continues until eventually there is a divide by zero and thereafter the temperature is "stuck" and does not change. The kiln keeps on firing as it thinks the temperature is not increasing per the profile. Last night I rebooted the Pi when this happened, and things started working properly again (with short to ground but not VCC errors) and I was able to complete the run.

I'm guessing this is a problem somewhere between the MAX31855, the thermocouple wiring and the thermocouple itself. In any event, the software runs out of ideas. Maybe it can handle the errors somehow? I did some googling, and it seems the short to ground problem is fairly common. Suggested remedies include grounding the MAX ground terminal, inserting capacitors across the thermocouple and power supply connections. Please let me have your ideas. I include a relevant part of the log below.

2021-04-21 20:03:21,072 ERROR oven: problem reading temp
Apr 21 20:03:21 KilnController python[428]: Traceback (most recent call last):
Apr 21 20:03:21 KilnController python[428]: File "/home/pi/kiln-controller/lib/oven.py", line 125, in run
Apr 21 20:03:21 KilnController python[428]: temp = self.thermocouple.get()
Apr 21 20:03:21 KilnController python[428]: File "/home/pi/kiln-controller/lib/max31855.py", line 42, in get
Apr 21 20:03:21 KilnController python[428]: self.checkErrors()
Apr 21 20:03:21 KilnController python[428]: File "/home/pi/kiln-controller/lib/max31855.py", line 82, in checkErrors
Apr 21 20:03:21 KilnController python[428]: raise MAX31855Error("Thermocouple short to VCC")
Apr 21 20:03:21 KilnController python[428]: max31855.MAX31855Error: 'Thermocouple short to VCC'
Apr 21 20:03:21 KilnController python[428]: 2021-04-21 20:03:21,474 ERROR oven: problem reading temp
Apr 21 20:03:21 KilnController python[428]: Traceback (most recent call last):
Apr 21 20:03:21 KilnController python[428]: File "/home/pi/kiln-controller/lib/oven.py", line 125, in run
Apr 21 20:03:21 KilnController python[428]: temp = self.thermocouple.get()
Apr 21 20:03:21 KilnController python[428]: File "/home/pi/kiln-controller/lib/max31855.py", line 42, in get
Apr 21 20:03:21 KilnController python[428]: self.checkErrors()
Apr 21 20:03:21 KilnController python[428]: File "/home/pi/kiln-controller/lib/max31855.py", line 80, in checkErrors
Apr 21 20:03:21 KilnController python[428]: raise MAX31855Error("Thermocouple short to ground")
Apr 21 20:03:21 KilnController python[428]: max31855.MAX31855Error: 'Thermocouple short to ground'
Apr 21 20:03:22 KilnController python[428]: Exception in thread Thread-1:
Apr 21 20:03:22 KilnController python[428]: Traceback (most recent call last):
Apr 21 20:03:22 KilnController python[428]: File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
Apr 21 20:03:22 KilnController python[428]: self.run()
Apr 21 20:03:22 KilnController python[428]: File "/home/pi/kiln-controller/lib/oven.py", line 130, in run
Apr 21 20:03:22 KilnController python[428]: self.temperature = sum(temps)/len(temps)
Apr 21 20:03:22 KilnController python[428]: ZeroDivisionError: division by zero
Apr 21 20:03:22 KilnController python[428]: 2021-04-21 20:03:22,189 INFO oven: temp=1520.5, target=1521.7, pid=1.000, heat_on=2.00, heat_off=0.00, run_time=23086, total_time=34500, time_left=11413
Apr 21 20:03:22 KilnController python[428]: 2021-04-21 20:03:22,190 INFO oven: pid percents pid=104.32 p=31.25 i=63.97 d=4.79
Apr 21 20:03:24 KilnController python[428]: 2021-04-21 20:03:24,192 INFO oven: temp=1520.5, target=1521.8, pid=1.000, heat_on=2.00, heat_off=0.00, run_time=23088, total_time=34500, time_left=11411
Apr 21 20:03:24 KilnController python[428]: 2021-04-21 20:03:24,193 INFO oven: pid percents pid=106.83 p=32.85 i=62.47 d=4.67
Apr 21 20:03:26 KilnController python[428]: 2021-04-21 20:03:26,196 INFO oven: temp=1520.5, target=1521.9, pid=1.000, heat_on=2.00, heat_off=0.00, run_time=23090, total_time=34500, time_left=11409
Apr 21 20:03:26 KilnController python[428]: 2021-04-21 20:03:26,196 INFO oven: pid percents pid=109.34 p=34.39 i=61.05 d=4.57
Apr 21 20:03:28 KilnController python[428]: 2021-04-21 20:03:28,199 INFO oven: temp=1520.5, target=1522.0, pid=1.000, heat_on=2.00, heat_off=0.00, run_time=23092, total_time=34500, time_left=11407
Apr 21 20:03:28 KilnController python[428]: 2021-04-21 20:03:28,200 INFO oven: pid percents pid=111.85 p=35.85 i=59.69 d=4.46
Apr 21 20:03:30 KilnController python[428]: 2021-04-21 20:03:30,202 INFO oven: temp=1520.5, target=1522.1, pid=1.000, heat_on=2.00, heat_off=0.00, run_time=23094, total_time=34500, time_left=11405

At this point the temperature does not change and the kiln keeps heating.

Proposal

Great project; my wife is enjoying it a lot with her glass kiln!

I made your project by following the instructions. However, I am not a true programmer. Now there is one wish from my wife. It would be great if a profile could have a command where the temperature drops untill it reaches a certain temperature and then would maintain that temperature for a certain time period. I.e. "upon reachint Target temp, maintain target temp for xxx minutes".
Now one has to guestimate how long it will take for the kiln to coold own to the target temp.
Thanks again for a truly useful project with a truly usable instruction file!

temp priority

Hi,

is there a setting to make it temp priority that I have missed?

At the moment if I set the temp increase above the rate of the kiln it will just jump to the next segment after the time. I'd like to be able to have it temperature set.

thanks

huge bug to fix - pid loop only active in a very small window

Turns out there has been a bug since I orginally forked this from picoreflow. Anyway, the pid loop is only active in a very small window. So small, that the system almost always acts as an on-off controller. This results in pretty good control, but it's not what I want. I want this system to be as accurate as possible. I'll get this fixed and posted after some tests in the next few days.

Query about pid tuning instructions

In the instructions it says:

  • If the temp is always below the set point, increase pid_ki.

But in the code/ config.py, it says:

Note that the integral pid_ki is inverted so that a smaller number means more integral action.

I am very new to PID, but are the tuning instructions correct that increasing pid_ki will help the below-set-point problem given it is inverted?

S thermocouple

Hi

I have an S thermocouple and when I run the tuning, the degrees are off my many degress.

is writes about 70degrees and was actually over 200.

Do I need to define the specific type somewhere or how does it work?

Thanks
Felix

Results of testing stop_integral_windup code

I've been testing the stop_integral_windup code. Summary: it works really well!

First of all -for comparison - I tested with it disabled at 500C:
disabled-500-550

Then I enabled it and tested at three temperature bands.
200/250C (this test was before I realised the kiln_must_catch_up_max_error was still in F on my config, which is why the ramp is slightly different)
fix-200-250

500/550C
fix-500-550

920C
fix-920

So, its very effective, many many thanks!

Run never starts

I've just installed the kiln controller, and everything seems ok. the logs show it as starting

May 18 07:23:32 raspberrypi python[298]: 2021-05-18 07:23:32,125 INFO kiln-controller: Received (control): {"cmd":"RUN","profile":{"data":[[0,200],[1740,200],[1800,250],[3600,250]],"type":"profile","name":"test-200-250"}}
May 18 07:23:32 raspberrypi python[298]: 2021-05-18 07:23:32,131 INFO kiln-controller: RUN command received
May 18 07:23:32 raspberrypi python[298]: 2021-05-18 07:23:32,134 INFO oven: Running schedule test-200-250
May 18 07:23:32 raspberrypi python[298]: 2021-05-18 07:23:32,136 INFO oven: Starting

However the "timer" never advances, so the target temp stays at 0 and the time next to the clock icon never changes.

zero degrees

Hi I would really like to get this working but I'm not getting any temperature reading
I can get the control panel up , have changed values in the config.py but the temperature always reads 0degC

pi3
max31856 with ktype sensor
wiring as per this post - #40
I would post a log but I dont know how to do that

hope you can help
Tx Lx

MAX31856 not starting

Hi,

when starting the application, I get the following error:

(venv) pi@raspberrypi:~/kiln-controller $ ./kiln-controller.py 
2021-06-10 22:08:38,200 INFO kiln-controller: Starting kiln controller
2021-06-10 22:08:38,202 INFO kiln-controller: this is a real kiln
2021-06-10 22:08:38,203 INFO oven: import MAX31856 
2021-06-10 22:08:38,203 INFO oven: init MAX31856
2021-06-10 22:08:38,204 INFO oven: {'cs': 27, 'clk': 22, 'do': 17, 'di': 10}
2021-06-10 22:08:38,219 INFO Adafruit_MAX31856.MAX31856: {'cs': 27, 'clk': 22, 'do': 17, 'di': 10}
Traceback (most recent call last):
  File "./kiln-controller.py", line 44, in <module>
    oven = RealOven()
  File "/home/pi/kiln-controller/lib/oven.py", line 383, in __init__
    self.board = Board()
  File "/home/pi/kiln-controller/lib/oven.py", line 49, in __init__
    self.create_temp_sensor()
  File "/home/pi/kiln-controller/lib/oven.py", line 77, in create_temp_sensor
    self.temp_sensor = TempSensorReal()
  File "/home/pi/kiln-controller/lib/oven.py", line 126, in __init__
    ac_freq_50hz = config.ac_freq_50hz,
  File "/home/pi/kiln-controller/lib/max31856.py", line 130, in __init__
    software_spi['do'], software_spi['cs'])
  File "/home/pi/kiln-controller/venv/lib/python3.7/site-packages/Adafruit_GPIO/SPI.py", line 167, in __init__
    gpio.setup(sclk, GPIO.OUT)
  File "/home/pi/kiln-controller/venv/lib/python3.7/site-packages/Adafruit_GPIO/GPIO.py", line 278, in setup
    pull_up_down=self._pud_mapping[pull_up_down])
TypeError: argument 1 must be str, not int

(I added a few logging statements to check what was passed as parameter in the software_spi struct.)

I've tried to interpret the error, but the only thing I could come up with is configuring the pins as 'GPIO0_22' instead of 22, which just gives me another error:

2021-06-10 22:07:48,578 INFO kiln-controller: Starting kiln controller
2021-06-10 22:07:48,580 INFO kiln-controller: this is a real kiln
2021-06-10 22:07:48,580 INFO oven: import MAX31856 
2021-06-10 22:07:48,580 INFO oven: init MAX31856
2021-06-10 22:07:48,581 INFO oven: {'cs': 'GPIO0_27', 'clk': 'GPIO0_22', 'do': 'GPIO0_17', 'di': 'GPIO0_10'}
2021-06-10 22:07:48,597 INFO Adafruit_MAX31856.MAX31856: {'cs': 'GPIO0_27', 'clk': 'GPIO0_22', 'do': 'GPIO0_17', 'di': 'GPIO0_10'}
Traceback (most recent call last):
  File "./kiln-controller.py", line 44, in <module>
    oven = RealOven()
  File "/home/pi/kiln-controller/lib/oven.py", line 383, in __init__
    self.board = Board()
  File "/home/pi/kiln-controller/lib/oven.py", line 49, in __init__
    self.create_temp_sensor()
  File "/home/pi/kiln-controller/lib/oven.py", line 77, in create_temp_sensor
    self.temp_sensor = TempSensorReal()
  File "/home/pi/kiln-controller/lib/oven.py", line 126, in __init__
    ac_freq_50hz = config.ac_freq_50hz,
  File "/home/pi/kiln-controller/lib/max31856.py", line 130, in __init__
    software_spi['do'], software_spi['cs'])
  File "/home/pi/kiln-controller/venv/lib/python3.7/site-packages/Adafruit_GPIO/SPI.py", line 167, in __init__
    gpio.setup(sclk, GPIO.OUT)
  File "/home/pi/kiln-controller/venv/lib/python3.7/site-packages/Adafruit_GPIO/GPIO.py", line 278, in setup
    pull_up_down=self._pud_mapping[pull_up_down])
SystemError: <built-in function setup> returned NULL without setting an error

Any idea what is wrong?

(I attached my config.py as well.)
config.py.txt

RPi.gpio depreciated

Screenshot_20211205-171019_VNC Viewer

I have had this issue since switching from stretch to bullseye. Using rpi 4 fresh install of bullseye. Has issues building gpio wheel when I get to $ pip3 install -r requirements.txt

how to add "Kiln logger tool"

hi all, i read about Kiln logger tool in the pull request section, to add this features have i just to change original files with the ones presents in the pull request section?

fix schematic pinouts

The pinouts are jacked. some bcm pin are listed as physical. the GPIO pin numbers are wrong.

Offset in the Config.py

My thermocouple is reading 10 degrees F low. Before I run out and buy another I would like to use the offset line in the Config.py. I have set this to 10 (actually to several positive and negative numbers) all without any impact the measured temp displayed in the sensor temp box.

Is there more to this than just changing the line I referred to or is this something not enabled.

cannot import config, service not starting

hi all, i'm sorry for the question, but i cannot start the kiln controller, i followed all steps but arrived to server startup (source venv/bin/activate; ./kiln-controller.py) it says cannot import config.py, may someone help me?
thank you
giorgio

Another Question about pid_tuning document

Hi, I think I may have spotted an issue with the PID tuning instructions (though I could very well be wrong!) .

From my other reading, the general concept is to disable the PID completely, turn the kiln on at full power, observe the kiln's behaviour for a while and then derive the Kp/Ki/Kd from the temperature profile.

In the instructions, I assume this is what the following is doing:

in config.py set the PID values like so...

    pid_kp = 1.0
    pid_ki = 0.0
    pid_kd = 0.0

Unfortunately recent changes to the codebase mean this is not in fact disabling the PID completely. If you look at the PID code, it does the following to calculate the power output out (with the above settings):

  1. Calculate error
  2. Multiply error by Kp == 1.0
  3. Clamp to the range 0 -> 100.
  4. Divide by 100 (the window_size).

So, say you're 42 degrees away from the target temperature. The above algorithm will calculate:

out = (42 * 1) / 100 == 0.42

So I think the PID is in fact actively affecting the power in the last 100 degrees stretch. You'd need to have a Kp of 100 to disable it completely. (technically that would still affect results where abs(error) < 1.0, but I think we can live with that :)

pip install gevent

pip install gevent latest stable release 21.12.0 crashes the deployment in production on the RasPi (at least ZeroW).
Error given is Illegal Instruction -> seems to not be built for the armv6 processor.

Solution: replace 21.12.0 with 21.8.0 and everything is up and running

SPI support for sensor

After not being able to get a temperature out of the sensor, I have switched over to SPI, through this I can confirm (simpletest.py) temp is being reported.

However, after changing the gpio defaults in the config.py to the new pins and starting to launch the interface I get two error messages (see below).

pi@raspberrypi:/kiln-controller $ virtualenv venv
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/pi/kiln-controller/venv/bin/python2
Not overwriting existing python script /home/pi/kiln-controller/venv/bin/python (you must use /home/pi/kiln-controller/venv/bin/python2)
Installing setuptools, pkg_resources, pip, wheel...done.
pi@raspberrypi:
/kiln-controller $ source venv/bin/activate
(venv) pi@raspberrypi:~/kiln-controller $ source venv/bin/activate; ./kiln-controller.py
2019-03-03 17:37:59,298 INFO kiln-controller: Starting kiln controller
2019-03-03 17:37:59,571 INFO oven: import MAX31855SPI

Traceback (most recent call last):
File "./kiln-controller.py", line 33, in
from oven import Oven, Profile
File "/home/pi/kiln-controller/lib/oven.py", line 24, in
if config.gpio_air in spi_reserved_gpio:
AttributeError: 'module' object has no attribute 'gpio_air'

(venv) pi@raspberrypi:~/kiln-controller $

Any insight would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.