kiln-controller-max31856/README.md

178 wiersze
10 KiB
Markdown
Czysty Zwykły widok Historia

Kiln Controller
2013-11-23 19:09:06 +00:00
==========
2018-12-17 02:39:28 +00:00
Turns a Raspberry Pi into an inexpensive, web-enabled kiln controller.
2018-11-26 18:06:29 +00:00
## Features
2024-07-25 18:28:15 +00:00
* supports [many boards](https://github.com/jbruce12000/kiln-controller/blob/main/docs/supported-boards.md) into addition to raspberry pi
* supports Adafruit MAX31856 and MAX31855 thermocouple boards
2022-10-31 19:27:42 +00:00
* support for K, J, N, R, S, T, E, or B type thermocouples
2018-11-26 18:06:29 +00:00
* 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
2022-10-13 16:57:41 +00:00
* real-time firing cost estimate
2023-01-02 18:15:24 +00:00
* real-time heating rate displayed in degrees per hour
2018-11-27 16:21:33 +00:00
* supports PID parameters you tune to your kiln
2018-11-30 13:40:09 +00:00
* monitors temperature in kiln after schedule has ended
2019-01-15 23:57:17 +00:00
* api for starting and stopping at any point in a schedule
2021-03-15 01:43:14 +00:00
* accurate simulation
* support for shifting schedule when kiln cannot heat quickly enough
2023-01-02 20:41:52 +00:00
* support for skipping first part of profile to match current kiln temperature
2022-06-19 20:25:03 +00:00
* prevents integral wind-up when temperatures not near the set point
* automatic restarts if there is a power outage or other event
2022-11-04 17:46:33 +00:00
* support for a watcher to page you via slack if you kiln is out of whack
* easy scheduling of future kiln runs
2013-11-23 19:12:51 +00:00
2018-11-28 13:38:36 +00:00
**Run Kiln Schedule**
![Image](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/kiln-running.png)
2014-02-08 12:23:39 +00:00
2018-11-28 13:38:36 +00:00
**Edit Kiln Schedule**
![Image](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/kiln-schedule.png)
## Hardware
### Parts
2018-11-28 18:22:21 +00:00
| Image | Hardware | Description |
| ------| -------- | ----------- |
| ![Image](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/rpi.png) | [Raspberry Pi](https://www.adafruit.com/category/105) | Virtually any Raspberry Pi will work since only a few GPIO pins are being used. Any board supported by [blinka](https://circuitpython.org/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](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/max31855.png) | [Adafruit MAX31855](https://www.adafruit.com/product/269) or [Adafruit MAX31856](https://www.adafruit.com/product/3263) | Thermocouple breakout board |
| ![Image](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/k-type-thermocouple.png) | [Thermocouple](https://www.auberins.com/index.php?main_page=product_info&cPath=20_3&products_id=39) | 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](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/breadboard.png) | Breadboard | breadboard, ribbon cable, connector for pi's gpio pins & connecting wires |
| ![Image](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/ssr.png) | 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](https://www.auberins.com/index.php?main_page=product_info&cPath=2_30&products_id=331). It's like having 3 SSRs in one. Relays this big always require a heat sink. |
| ![Image](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/ks-1018.png) | 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. |
2018-11-28 18:22:21 +00:00
### 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](https://github.com/jbruce12000/kiln-controller/blob/main/config.py) file for gpio pin configuration.
2019-01-04 19:54:34 +00:00
My controller plugs into the wall, and the kiln plugs into the controller.
2018-12-09 19:46:51 +00:00
2019-01-10 14:20:18 +00:00
**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.
2024-08-21 04:34:29 +00:00
**Note:** The GPIO configuration in this schematic does not match the defaults, check [config](https://github.com/jbruce12000/kiln-controller/blob/main/config.py) and make sure the gpio pin configuration aligns with your actual connections.
![Image](https://github.com/jbruce12000/kiln-controller/blob/main/public/assets/images/schematic.png)
2018-11-28 18:22:21 +00:00
2019-01-04 19:54:34 +00:00
*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.*
2018-12-09 20:02:37 +00:00
## Software
2021-06-01 19:23:45 +00:00
### Raspberry PI OS
2013-11-23 23:02:24 +00:00
2021-06-01 19:23:45 +00:00
Download [Raspberry PI OS](https://www.raspberrypi.org/software/). Use Rasberry PI Imaging tool to install the OS on an SD card. Boot the OS, open a terminal and...
2013-11-23 23:02:24 +00:00
2021-06-01 19:23:45 +00:00
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get install python3-dev
2021-06-01 19:23:45 +00:00
$ git clone https://github.com/jbruce12000/kiln-controller
2018-11-27 16:18:40 +00:00
$ cd kiln-controller
2022-11-16 23:51:50 +00:00
$ python3 -m venv venv
2018-11-27 16:18:40 +00:00
$ source venv/bin/activate
2022-11-16 23:51:50 +00:00
$ pip install -r requirements.txt
*Note: The above steps work on ubuntu if you prefer*
2018-11-27 16:18:40 +00:00
### Raspberry PI deployment
2022-05-19 15:38:49 +00:00
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:
2022-11-03 14:22:52 +00:00
$ sudo raspi-config
2022-11-03 14:25:58 +00:00
interfacing options -> SPI -> Select Yes to enable
2022-11-03 14:22:52 +00:00
select reboot
## Configuration
Before you begin, make sure to copy the default settings:
$cp config-default.py config.py
2022-11-04 02:51:15 +00:00
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:
2022-11-04 02:48:53 +00:00
| 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 |
2022-11-04 02:51:15 +00:00
| pid parameters | | Used to tune your kiln. See PID Tuning. |
2022-11-04 02:48:53 +00:00
| simulate | True | Simulate a kiln. Used to test the software by new users so they can check out the features. |
2022-11-03 17:57:58 +00:00
2022-11-03 14:22:52 +00:00
## 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
2022-11-03 17:57:58 +00:00
## PID Tuning
Run the [autotuner](https://github.com/jbruce12000/kiln-controller/blob/main/docs/ziegler_tuning.md). 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](https://github.com/jbruce12000/kiln-controller/blob/main/docs/pid_tuning.md) if you end up having to manually tune.
2022-11-03 17:57:58 +00:00
2024-08-03 15:17:55 +00:00
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
2018-11-28 13:38:36 +00:00
$ source venv/bin/activate; ./kiln-controller.py
### Autostart Server onBoot
2021-03-15 01:48:41 +00:00
If you want the server to autostart on boot, run the following command:
2018-11-27 16:18:40 +00:00
$ /home/pi/kiln-controller/start-on-boot
### Client Access
2018-11-30 13:40:09 +00:00
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).
2018-11-26 16:10:22 +00:00
### Simulation
In config.py, set **simulate=True**. Start the server and select a profile and click Start. Simulations run at near real time.
2018-11-26 16:10:22 +00:00
2022-11-04 17:39:58 +00:00
### Scheduling a Kiln run
If you want to schedule a kiln run to start in the future. Here are [examples](https://github.com/jbruce12000/kiln-controller/blob/main/docs/scheduling.md).
2022-11-04 17:39:58 +00:00
2022-05-22 20:10:45 +00:00
### 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](https://github.com/jbruce12000/kiln-controller/blob/main/docs/watcher.md).
2022-05-22 20:10:45 +00:00
## 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](https://github.com/jbruce12000/kiln-controller/blob/main/docs/troubleshooting.md) I created for testing RPi gpio pins.
2018-12-25 00:48:50 +00:00
## Origin
This project was originally forked from https://github.com/apollo-ng/picoReflow but has diverged a large amount.