Jump to content

Geeks only - Raspberry PI controlled kiln


jbruce

Recommended Posts

56 minutes ago, Bill Kielb said:

Alpine used to do it, I don’t believe they do anymore and even in the day flipping that switch often cause full scale deflection of the giant (very high quality) analog high limit / operate switch to trip momentarily.

It was standard equipment on the digital controllers as well, at least until they sold the company in 2007-ish. Not sure what they're doing now. Their web site still shows the crappy touchscreen controller that was developed when I was there (total rush job), but I can't remember if it had dual TC inputs or not. As bad as it was, it was still better than the Chromalox controller they had been using for a while, which was a general purpose controller that had way too many parameters and required scrolling through something like 26 settings to get to the high limit shutoff setting.

Link to comment
Share on other sites

1 minute ago, Bill Kielb said:

You know for all its faults it was a decent workhorse simple kiln actually. Lots of them out and about.

They are awesome kilns, incredibly well built and durable and long lasting. I talked with many customers who had 40 year old kilns that were still in use. Alpine got a bad rap because updrafts are a little bit more difficult to fire, and they were a little late getting into the downdraft game. There was also a famous old-school potter and kiln guy who bad-mouthed them constantly on the ClayArt forum. Each Alpine updraft has its own personality, and once you get to know how it likes to fire it's very consistent and dependable. I have a friend with two Alpine updrafts at his school that that were delivered on the same day, sequential serial numbers, same models, sit right next to each other, and one fires an hour faster than the other.

Link to comment
Share on other sites

Looks like when the code was revised from the  original MAX31856 code I used @jbrucehas gone for consistent/better ways of returning error messages  from the T/C modules.

However the value for returning the error (MAX31856Error) has not been defined within the code max31856.

I think its an issue for @jbruceas he will know best which bits to tweek.

Link to comment
Share on other sites

Indeed it seems the oven.py just references the initialization of both libraries (max31855.py and max31856.py) in the same way. However they both differ in the arguments to use. I think a rework of this part of oven.py is necessary.

I don't have the max31856 so I cannot test any changes. Maybe you can use the test_MAX31856.py on the authors github-website (John Robinson) to see if this brings you any further.

Edited by leof
Link to comment
Share on other sites

15 minutes ago, leof said:

I don't have the max31856 so I cannot test any changes. Maybe you can use the test_MAX31856.py on the authors github-website (John Robinson) to see if this brings you any further.

https://learn.adafruit.com/thermocouple/arduino-code

Still not a PI guy, but this may help. Started reading about the 31855 and noticed a bunch of interesting info from reducing noise to available libraries. Looks like it ought to be easy to get readings from the board. As to variables in the code and their use and mapping I would just need to get an understanding of the code written and the hardware.

Some good stuff on thermocouples there though.

Link to comment
Share on other sites

6 hours ago, newps said:

Looks like when the code was revised from the  original MAX31856 code I used @jbrucehas gone for consistent/better ways of returning error messages  from the T/C modules.

However the value for returning the error (MAX31856Error) has not been defined within the code max31856.

I think its an issue for @jbruceas he will know best which bits to tweek.

I have followed the wiring diagram in jbruce's original docs for the 31855 ... I'm presuming the wiring for the 31856 follows the same convention? Or maybe that's my issue. When I copied the max31856.py library to the same folder as the test_MAX31856.py script I downloaded from the github site, the script ran but this was the output ... no connection to the hardware at all it seems. Maybe I need to wash my car today instead and wait until a python programmer buddy here has time to look at it:
 

test_MAX31856.py:39: RuntimeWarning: No channels have been set up yet - nothing to clean up!  Try cleaning up at the end of your program instead!
  GPIO.cleanup()
FFFF..
======================================================================
FAIL: test_get_internal_temperaure_reading (__main__.Adafruit_MAX31856)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_MAX31856.py", line 144, in test_get_internal_temperaure_reading
    self.assertTrue(False)
AssertionError: False is not true

======================================================================
FAIL: test_get_internal_temperaure_reading_k_type (__main__.Adafruit_MAX31856)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_MAX31856.py", line 161, in test_get_internal_temperaure_reading_k_type
    self.assertTrue(False)
AssertionError: False is not true

======================================================================
FAIL: test_get_register_reading (__main__.Adafruit_MAX31856)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_MAX31856.py", line 95, in test_get_register_reading
    self.assertTrue(False)
AssertionError: False is not true

======================================================================
FAIL: test_get_temperaure_reading (__main__.Adafruit_MAX31856)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_MAX31856.py", line 127, in test_get_temperaure_reading
    self.assertTrue(False)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 6 tests in 0.293s

FAILED (failures=4)
 

 

Link to comment
Share on other sites

2 hours ago, MarkTilles said:

Thanks I’ll give it a look tonight!

I HAVE FUNCTIONAL HARDWARE!  THANK YOU LEOF!  Got a result back from the simple test script. Now, to be able to create a fresh and new install on another card so I have a clean system (I've been piddling with many items in the system) but it was the correct pinouts that make a difference! Thanks again! :D 

Link to comment
Share on other sites

Well done! So your hardware is OK. 

Now we need to find out, how the oven.py has to be altered to adapt to this library of the max31856. The test script has the basics on how to do that. But more might be needed. I will try to help you out. But maybe @jbruce will tune in as he's the expert.

Link to comment
Share on other sites

2 minutes ago, leof said:

Well done! So your hardware is OK. 

Now we need to find out, how the oven.py has to be altered to adapt to this library of the max31856. The test script has the basics on how to do that. But more might be needed. I will try to help you out. But maybe @jbruce will tune in as he's the expert.

Thank you but don't put any effort in yet, I need to rebuild a clean system. Then we can look into it. I'm just glad to see I can get feedback from the hardware  and test script (although it ppb assumes a K-type for the test and I have an S-type attached), but nevertheless, I'm able to see the hardware is reacting to warming and cooling of the thermocouple. 

Link to comment
Share on other sites

OK. Just a few points:

  • @jbruce has altered the max31856 library. He added some lines at the bottom which you need. So use the library of @jbruce, not John Robinson's.
  • one problem in oven.py, as you already found out, is the addition of "MAX31856Error" which is not present in the library. Alter line 107 to:  
    from max31856 import MAX31856   #, MAX31856Error
    Note the # to disable everything after it on this line.
  • The thermocouple-type is set in the config.py file:
    # see lib/max31856.py for other thermocouple_type, only applies to max31856
    thermocouple_type = MAX31856.MAX31856_S_TYPE

Good luck!

Link to comment
Share on other sites

12 hours ago, leof said:

OK. Just a few points:

  • @jbruce has altered the max31856 library. He added some lines at the bottom which you need. So use the library of @jbruce, not John Robinson's.
  • one problem in oven.py, as you already found out, is the addition of "MAX31856Error" which is not present in the library. Alter line 107 to:  
    
    
    from max31856 import MAX31856   #, MAX31856Error
    Note the # to disable everything after it on this line.
  • The thermocouple-type is set in the config.py file:
    
    
    # see lib/max31856.py for other thermocouple_type, only applies to max31856
    thermocouple_type = MAX31856.MAX31856_S_TYPE

Good luck!

Leof, you seem to be quite proficient with python, which I am not, if you are willing I could give you a login to my system and you could take a look around and maybe quickly figure out what is wrong. I’d really appreciate it!  I am so very close now. If so, email me at my email Markt3@tilles.net. Thanks!

Edited by MarkTilles
Link to comment
Share on other sites

Mark, do you have difficulty in editing the python files mentioned?
This can be done with any text editor. Nothing special here. Open the file, make the change and save it.

Do you use a Windows computer to connect to your Rpi, like WinSCP? Or do you have a display and keyboard/mouse directly connected to your RPi?

Leo

Edited by leof
Link to comment
Share on other sites

Just now, leof said:

Mark, do you have difficulty in editing the python files mentioned?
This can be done with any text editor. Nothing special here. Open the file, make the change and save it.

Do you use a Windows computer to connect to your Rpi, like WinSCP? Or do you have a display directly connected to your RPi?

Le

 

,I actually have a lot of computer experience but just not with python. Editing the files is not a problem, but those changes that you mentioned weren’t enough. I connect to the machine with SSH, after having set it up with a screen in my living room. I have port forwarding enabled on my router so I can access it from the outside.

Link to comment
Share on other sites

1 minute ago, leof said:

As the changes where not the solution, what errors do you get starting kiln-controller.py?

I’m out of the house for a few hours at the model airplane field,  when I get home I can paste the error, it has something to do with the software_SPI definition? Everything is being run in a virtual environment for the oven. (and running the test script only works in the virtual environment). 
 

Jason Bruce didn’t have the 31856 interface card when he wrote the additional code for it, so he wasn’t able to test it.

Link to comment
Share on other sites

2 hours ago, MarkTilles said:
2 hours ago, leof said:

As the changes where not the solution, what errors do you get starting kiln-controller.py?

Jason Bruce didn’t have the 31856 interface card when he wrote the additional code for it, so he wasn’t able to test it.

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

2021-04-18 13:58:04,515 INFO kiln-controller: Starting kiln controller

2021-04-18 13:58:04,562 INFO kiln-controller: this is a real kiln

2021-04-18 13:58:04,565 INFO oven: import MAX31856

2021-04-18 13:58:04,569 INFO oven: init MAX31856

Traceback (most recent call last):

  File "./kiln-controller.py", line 44, in <module>

    oven = RealOven()

  File "/home/pi/kiln-controller/lib/oven.py", line 317, in __init__

    self.board = Board()

  File "/home/pi/kiln-controller/lib/oven.py", line 46, in __init__

    self.create_temp_sensor()

  File "/home/pi/kiln-controller/lib/oven.py", line 74, in create_temp_sensor

    self.temp_sensor = TempSensorReal()

  File "/home/pi/kiln-controller/lib/oven.py", line 112, in __init__

    software_spi = sofware_spi,

NameError: name 'sofware_spi' is not defined

Link to comment
Share on other sites

software_spi = sofware_spi doesn't make much sense to me. Try removing it and let's see what error we get.
 

            self.thermocouple = MAX31856(tc_type=config.thermocouple_type,
                                         units = config.temp_scale
                                         )

It that brings nothing try setting it to 1: software_spi = 1,

Edited by leof
Link to comment
Share on other sites

        if config.max31856:
            log.info("init MAX31856")
            from max31856 import MAX31856   # CHANGED FROM  max31856 import MAX31856, MAX31856Error
            software_s = { 'cs': config.gpio_sensor_cs,
                             'clk': config.gpio_sensor_clock,
                             'do': config.gpio_sensor_data
                             
                             }
            self.thermocouple = MAX31856(tc_type=config.thermocouple_type,
                                         software_spi = sofware_s,
                                         units = config.temp_scale
                                         )

This is the right declaration I think.

Link to comment
Share on other sites

32 minutes ago, leof said:

        if config.max31856:
            log.info("init MAX31856")
            from max31856 import MAX31856   # CHANGED FROM  max31856 import MAX31856, MAX31856Error
            software_s = { 'cs': config.gpio_sensor_cs,
                             'clk': config.gpio_sensor_clock,
                             'do': config.gpio_sensor_data
                             
                             }
            self.thermocouple = MAX31856(tc_type=config.thermocouple_type,
                                         software_spi = sofware_s,
                                         units = config.temp_scale
                                         )

This is the right declaration I think.

With your first suggestion, the error shifts to:

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

2021-04-18 17:27:05,728 INFO kiln-controller: Starting kiln controller

2021-04-18 17:27:05,867 INFO kiln-controller: this is a real kiln

2021-04-18 17:27:05,879 INFO oven: import MAX31856

2021-04-18 17:27:05,882 INFO oven: init MAX31856

Traceback (most recent call last):

  File "../kiln-controller.py", line 44, in <module>

    oven = RealOven()

  File "/home/pi/kiln-controller/lib/oven.py", line 329, in __init__

    self.board = Board()

  File "/home/pi/kiln-controller/lib/oven.py", line 46, in __init__

    self.create_temp_sensor()

  File "/home/pi/kiln-controller/lib/oven.py", line 74, in create_temp_sensor

    self.temp_sensor = TempSensorReal()

  File "/home/pi/kiln-controller/lib/oven.py", line 125, in __init__

    units = config.temp_scale

  File "/home/pi/kiln-controller/lib/max31856.py", line 123, in __init__

    gpio = Adafruit_GPIO.get_platform_gpio()

  File "/home/pi/kiln-controller/venv/lib/python3.7/site-packages/Adafruit_GPIO/GPIO.py", line 417, in get_platform_gpio

    import RPi.GPIO

ModuleNotFoundError: No module named 'RPi'

------------------------------


With your second suggestion instead, 

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

2021-04-18 17:22:56,772 INFO kiln-controller: Starting kiln controller

2021-04-18 17:22:56,885 INFO kiln-controller: this is a real kiln

2021-04-18 17:22:56,894 INFO oven: import MAX31856

2021-04-18 17:22:56,900 INFO oven: init MAX31856

Traceback (most recent call last):

  File "../kiln-controller.py", line 44, in <module>

    oven = RealOven()

  File "/home/pi/kiln-controller/lib/oven.py", line 329, in __init__

    self.board = Board()

  File "/home/pi/kiln-controller/lib/oven.py", line 46, in __init__

    self.create_temp_sensor()

  File "/home/pi/kiln-controller/lib/oven.py", line 74, in create_temp_sensor

    self.temp_sensor = TempSensorReal()

  File "/home/pi/kiln-controller/lib/oven.py", line 114, in __init__

    software_spi = sofware_s,

NameError: name 'sofware_s' is not defined

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

Link to comment
Share on other sites

12 minutes ago, leof said:

You need to install the RPi.GPIO library. Then try the first option again. 

OK, I installed the library, here is the info:
 

(venv) pi@raspberrypi:~/kiln-controller $ sudo  apt-get install rpi.gpio

Reading package lists... Done

Building dependency tree       

Reading state information... Done

Note, selecting 'python-rpi.gpio-dbgsym' for regex 'rpi.gpio'

Note, selecting 'python3-rpi.gpio' for regex 'rpi.gpio'

Note, selecting 'rpi.gpio-common' for regex 'rpi.gpio'

Note, selecting 'python-rpi.gpio' for regex 'rpi.gpio'

Note, selecting 'python3-rpi.gpio-dbgsym' for regex 'rpi.gpio'

python-rpi.gpio is already the newest version (0.7.0-0.1~bpo10+4).

python3-rpi.gpio is already the newest version (0.7.0-0.1~bpo10+4).

rpi.gpio-common is already the newest version (0.7.0-0.1~bpo10+4).

rpi.gpio-common set to manually installed.

The following NEW packages will be installed:

  python-rpi.gpio-dbgsym python3-rpi.gpio-dbgsym

0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.

Need to get 88.2 kB of archives.

After this operation, 126 kB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://archive.raspberrypi.org/debian buster/main armhf python-rpi.gpio-dbgsym armhf 0.7.0-0.1~bpo10+4 [42.7 kB]

Get:2 http://archive.raspberrypi.org/debian buster/main armhf python3-rpi.gpio-dbgsym armhf 0.7.0-0.1~bpo10+4 [45.5 kB]

Fetched 88.2 kB in 0s (344 kB/s)              

Selecting previously unselected package python-rpi.gpio-dbgsym.

(Reading database ... 98720 files and directories currently installed.)

Preparing to unpack .../python-rpi.gpio-dbgsym_0.7.0-0.1~bpo10+4_armhf.deb ...

Unpacking python-rpi.gpio-dbgsym (0.7.0-0.1~bpo10+4) ...

Selecting previously unselected package python3-rpi.gpio-dbgsym.

Preparing to unpack .../python3-rpi.gpio-dbgsym_0.7.0-0.1~bpo10+4_armhf.deb ...

Unpacking python3-rpi.gpio-dbgsym (0.7.0-0.1~bpo10+4) ...

Setting up python3-rpi.gpio-dbgsym (0.7.0-0.1~bpo10+4) ...

Setting up python-rpi.gpio-dbgsym (0.7.0-0.1~bpo10+4) ...


--------------------------------

This is what I got for first option  (removing the line):

2021-04-18 17:49:43,819 INFO kiln-controller: Starting kiln controller

2021-04-18 17:49:43,954 INFO kiln-controller: this is a real kiln

2021-04-18 17:49:43,956 INFO oven: import MAX31856

2021-04-18 17:49:43,959 INFO oven: init MAX31856

Traceback (most recent call last):

  File "../kiln-controller.py", line 44, in <module>

    oven = RealOven()

  File "/home/pi/kiln-controller/lib/oven.py", line 317, in __init__

    self.board = Board()

  File "/home/pi/kiln-controller/lib/oven.py", line 46, in __init__

    self.create_temp_sensor()

  File "/home/pi/kiln-controller/lib/oven.py", line 74, in create_temp_sensor

    self.temp_sensor = TempSensorReal()

  File "/home/pi/kiln-controller/lib/oven.py", line 113, in __init__

    units = config.temp_scale

  File "/home/pi/kiln-controller/lib/max31856.py", line 128, in __init__

    'Must specify either spi for for hardware SPI or clk, cs, and do for softwrare SPI!')

ValueError: Must specify either spi for for hardware SPI or clk, cs, and do for softwrare SPI!

----------------------

What I got with the second option, setting =1:
 

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

2021-04-18 17:52:26,286 INFO kiln-controller: Starting kiln controller

2021-04-18 17:52:26,423 INFO kiln-controller: this is a real kiln

2021-04-18 17:52:26,430 INFO oven: import MAX31856

2021-04-18 17:52:26,432 INFO oven: init MAX31856

Traceback (most recent call last):

  File "../kiln-controller.py", line 44, in <module>

    oven = RealOven()

  File "/home/pi/kiln-controller/lib/oven.py", line 317, in __init__

    self.board = Board()

  File "/home/pi/kiln-controller/lib/oven.py", line 46, in __init__

    self.create_temp_sensor()

  File "/home/pi/kiln-controller/lib/oven.py", line 74, in create_temp_sensor

    self.temp_sensor = TempSensorReal()

  File "/home/pi/kiln-controller/lib/oven.py", line 113, in __init__

    units = config.temp_scale

  File "/home/pi/kiln-controller/lib/max31856.py", line 123, in __init__

    gpio = Adafruit_GPIO.get_platform_gpio()

  File "/home/pi/kiln-controller/venv/lib/python3.7/site-packages/Adafruit_GPIO/GPIO.py", line 417, in get_platform_gpio

    import RPi.GPIO

ModuleNotFoundError: No module named 'RPi'

-------------------

And third option, once I noticed and replaced the missing "t" in sofware,
 

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

2021-04-18 17:54:45,567 INFO kiln-controller: Starting kiln controller

2021-04-18 17:54:45,631 INFO kiln-controller: this is a real kiln

2021-04-18 17:54:45,633 INFO oven: import MAX31856

2021-04-18 17:54:45,635 INFO oven: init MAX31856

Traceback (most recent call last):

  File "../kiln-controller.py", line 44, in <module>

    oven = RealOven()

  File "/home/pi/kiln-controller/lib/oven.py", line 330, in __init__

    self.board = Board()

  File "/home/pi/kiln-controller/lib/oven.py", line 46, in __init__

    self.create_temp_sensor()

  File "/home/pi/kiln-controller/lib/oven.py", line 74, in create_temp_sensor

    self.temp_sensor = TempSensorReal()

  File "/home/pi/kiln-controller/lib/oven.py", line 115, in __init__

    units = config.temp_scale

  File "/home/pi/kiln-controller/lib/max31856.py", line 123, in __init__

    gpio = Adafruit_GPIO.get_platform_gpio()

  File "/home/pi/kiln-controller/venv/lib/python3.7/site-packages/Adafruit_GPIO/GPIO.py", line 417, in get_platform_gpio

    import RPi.GPIO

ModuleNotFoundError: No module named 'RPi'

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.