MarkTilles Posted April 18, 2021 Report Share Posted April 18, 2021 33 minutes ago, leof said: It's installed in the wrong place. Try: $ cd kiln-controller $ virtualenv -p python3 venv $ source venv/bin/activate $ pip install RPi.GPIO Some progress! The service starts and my SSR is now cycling on and off repetitively, but I had to add a line to the oven.py for the pi MOSI to max31856 sensor SDI terminal: 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, 'di': config.gpio_sensor_di } self.thermocouple = MAX31856(tc_type=config.thermocouple_type, software_spi = software_s, units = config.temp_scale ) Here are my pinout definitions in config.py ### MARKS DATA RASPBERRY PI ZERO W gpio_sensor_cs = 29 gpio_sensor_clock = 23 gpio_sensor_data = 21 gpio_sensor_di = 19 and strangely enough, the server starts now without errors. However, the temperature bounces all over the place from minus to plus numbers ... and the test script that used to work and respond to warming the cooling of the thermocouple doesn't work anymore...? Traceback (most recent call last): File "../../max31856simpletest.py", line 4, in <module> import board ModuleNotFoundError: No module named 'board' Quote Link to comment Share on other sites More sharing options...
leof Posted April 18, 2021 Report Share Posted April 18, 2021 (edited) Where is the max31856simpletest.py from? Edit: I suggest you use John Robinson's testprogram test_max31856.py because it is his library @jbruce uses with the kiln-controller.py. Edited April 18, 2021 by leof Quote Link to comment Share on other sites More sharing options...
newps Posted April 18, 2021 Report Share Posted April 18, 2021 I used the following for my Max31856 https://github.com/steve71/MAX31856/blob/master/max31856.py to prove I could communicate with the Max31856, but I am on an old Model B Raspberry Pi, os the pins are slightly different. I found this worked standalone to check I could measure the temperatures, I then altered the old oven code to accept this module. I thought @jbrucewas going to use this when I sent him my modified code . Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 18, 2021 Report Share Posted April 18, 2021 Thanks a million to each an every one of you for your assistance, but I am just too much of an amateur to manage to handle this on my own. I am wracking my brain to understand, and I've learned plenty, but only enough to make a mess of things. I know a python programmer fellow here that hopefully will have time soon to grip on this with me. In the meanwhile I will focus on rearranging the kilns in my space, interlocking the SSR relay unit to power the heating elements, and get my controller box installed and ready to accept the Pi and 31856 sensor card combo. Mark Quote Link to comment Share on other sites More sharing options...
Bill Kielb Posted April 19, 2021 Report Share Posted April 19, 2021 3 hours ago, MarkTilles said: I am wracking my brain to understand, and I've learned plenty, but only enough to make a mess of things. Now I realize why I am a DDC / PLC guy. After reading through this, I am less inclined to learn PI / Arduino stuff. I’m sure you will get it soon ....... of course PLC stuff is awfully flexible ....... and web enabled ...... Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 19, 2021 Report Share Posted April 19, 2021 (edited) Gentlemen and all you lovely ladies, and especially @jbruce, @leof, @Bill Kielb, @newps and anyone else - if any are reading this: SUCCESS! After a calm-down of my thoughts and a collecting of my notes, using what I have learned and debugged in the Python code with my friend "Google's" help ... the system is up! Hurrah! Very pleased here! Now I just need to CLONE the simm card so I have a backup I will write up a document with all my notes of what I have done, my exact wiring layout on my Raspberry pi zero W, replicate it on another fresh simm card, then post it back here for someone to figure out how to adjust the code base properly. I'm soooooo happy! Thanks for all the guidance!!! HURRAH!!!!! Edited April 19, 2021 by MarkTilles Bill Kielb and leof 2 Quote Link to comment Share on other sites More sharing options...
leof Posted April 20, 2021 Report Share Posted April 20, 2021 Congratulations! Curious about what the culprit was. Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 20, 2021 Report Share Posted April 20, 2021 Just now, leof said: Congratulations! Curious about what the culprit was. The most obvious culprit was my using the wrong GPIO numbers (ha ha I was defining the pin numbers in config.py and not the GPIO numbers), but before I got there in order to get the kiln controller even up and running I also had to add a couple of variables into a pair of definition statements in oven.py - the values for “di” - the SDI pin on the max 31856, that was missing from the library calls. I will run a compare on the before and after to determine the exact changes I made, I will post this later. Quote Link to comment Share on other sites More sharing options...
newps Posted April 20, 2021 Report Share Posted April 20, 2021 That's 2 of us have got a Max31856 version of the code up and running in the last 24hours. Mine is based on a much older version of @jbrucecode, and in my case the culprit turned out to be a log.info statement added to track progress that was incorrect and prevented the oven code running, frustrating how long it took to track down as the error messages were suggesting the problem was with geventwebsocket, ERROR ovenWatcher: could not write to socket <geventwebsocket.websocket.WebSocket object at 0xb4c50880> @MarkTilleswhat type of Pi are you using? Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 20, 2021 Report Share Posted April 20, 2021 Just now, newps said: That's 2 of us have got a Max31856 version of the code up and running in the last 24hours. Mine is based on a much older version of @jbrucecode, and in my case the culprit turned out to be a log.info statement added to track progress that was incorrect and prevented the oven code running, frustrating how long it took to track down as the error messages were suggesting the problem was with geventwebsocket, ERROR ovenWatcher: could not write to socket <geventwebsocket.websocket.WebSocket object at 0xb4c50880> @MarkTilleswhat type of Pi are you using? The raspberry pi zero w with built-in wireless. Quote Link to comment Share on other sites More sharing options...
newps Posted April 20, 2021 Report Share Posted April 20, 2021 What is the range of the wifi like?, with my old Pi I am using a TP link to get the ethernet back to my wifi router, but then the kiln is in the garage at the end of the garden. Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 20, 2021 Report Share Posted April 20, 2021 1 minute ago, newps said: What is the range of the wifi like?, with my old Pi I am using a TP link to get the ethernet back to my wifi router, but then the kiln is in the garage at the end of the garden. Well it could be better, but I am running from my garage through two walls with only about 6 m between the buildings. However it is connecting to a repeater which really doesn’t give a good connection to anything outside the house. So it’s kind of hard to tell. But it has one available USB port, you could always add an external USB Wi-Fi card, I’ve tried that and that works a little better. Quote Link to comment Share on other sites More sharing options...
leof Posted April 20, 2021 Report Share Posted April 20, 2021 1 hour ago, MarkTilles said: I will run a compare on the before and after to determine the exact changes I made, I will post this later. Yes, that would be very nice. And let @jbruce change the oven.py and config.py to have his wonderful web-app working for everyone with a max31856! MarkTilles 1 Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 20, 2021 Report Share Posted April 20, 2021 (edited) 5 hours ago, leof said: Yes, that would be very nice. And let @jbruce change the oven.py and config.py to have his wonderful web-app working for everyone with a max31856! Well, in summary after reviewing it all, the only programming changes were a spelling correction and addition of some variables to system calls in oven.py and adding config variables accordingly to config.py. The rest of my problems were my hardware miss-wiring. Note: The following GPIO pinouts below are defined for my Raspberry Pi Zero W (and I left gpio.heat alone).Mark's config.py gpio_sensor_cs = 5 gpio_sensor_clock = 11 gpio_sensor_data = 9### MARK ADDED ### gpio_sensor_di = 10Original config.py gpio_sensor_cs = 27 gpio_sensor_clock = 22 gpio_sensor_data = 17 Here is the original oven.py section that needed changing: if config.max31856: log.info("init MAX31856") from max31856 import MAX31856 software_spi = { '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_spi, units = config.temp_scale ) And here is the corrected section: if config.max31856: log.info("init MAX31856") from max31856 import MAX31856 software_spi = { 'cs': config.gpio_sensor_cs, 'clk': config.gpio_sensor_clock, 'do': config.gpio_sensor_data, ### MARK TILLES ADDED 'di': config.gpio_sensor_di, 'gpio': config.gpio_heat } self.thermocouple = MAX31856(tc_type=config.thermocouple_type, software_spi = software_spi, units = config.temp_scale ) I began with the Raspberry Pi OS (32 bit) with desktop. Here are the steps I performed to install the software. I had no notable installation issues: sudo apt-get install python3-pip python3-virtualenv libevent-dev git virtualenv git clone https://github.com/jbruce12000/kiln-controller.git cd kiln-controller virtualenv -p python3 venv source venv/bin/activate pip install --upgrade setuptools pip install greenlet bottle gevent gevent-websocket pip install -r requirements.txt pip install adafruit-circuitpython-max31856 pip install adafruit-blinka Now, whether something I installed above might not have been needed, that I can't answer... I'm just glad the it worked! I have an added a photo of a marked-up drawing showing my GPIO connections. Note: the positions on the big connector are wrong! This picture is only for reference for the GPIO numbers. Edited April 20, 2021 by MarkTilles Bill Kielb 1 Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 20, 2021 Report Share Posted April 20, 2021 Here's a question: Reading about the max31856, it has built-in resistors ... is there any idea to add external ones? I don't see anyone using them in their wiring photos, and maybe this could generate problems as well. The data sheet talks about adding them if one might expect surges over 45V. It seems the max31855 didn't have these, not in the product description for them. ... MAX31855: This breakout does everything for you, and can be easily interfaced with any microcontroller, even one without an analog input. This breakout board has the chip itself, a 3.3V regulator and level shifting circuitry, all assembled and tested. Comes with a 2 pin terminal block (for connecting to the thermocouple) and pin header (to plug into any breadboard or perfboard). We even added inline resistors and a filter capacitor onboard for better stability, as recommended by Maxim. Goes great with our 1m K-type thermocouple or any other thermocouple, really! Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 21, 2021 Report Share Posted April 21, 2021 Did someone say it's POSSIBLE to have two controllers connected to the SAME thermocouple? If so, this would greatly simplify my needs to connect both my REX 100 PID as well as my Raspberry Pi to the kilns (I an using the PID for overheat protection to shut down the main relay). Quote Link to comment Share on other sites More sharing options...
Dick White Posted April 21, 2021 Report Share Posted April 21, 2021 26 minutes ago, MarkTilles said: Did someone say it's POSSIBLE to have two controllers connected to the SAME thermocouple? If so, this would greatly simplify my needs to connect both my REX 100 PID as well as my Raspberry Pi to the kilns (I an using the PID for overheat protection to shut down the main relay). As one wag said, anything is possible, but some things are not likely. My one attempt at that was not satisfactory. I connected a separate pyrometer to the same thermocouple as was being used by the kiln's Bartlett controller. The temperature readings went jittery and I couldn't tell what was going on. Haven't tried it since. neilestrick and MarkTilles 2 Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 21, 2021 Report Share Posted April 21, 2021 Just now, Dick White said: As one wag said, anything is possible, but some things are not likely. My one attempt at that was not satisfactory. I connected a separate pyrometer to the same thermocouple as was being used by the kiln's Bartlett controller. The temperature readings went jittery and I couldn't tell what was going on. Haven't tried it since. Good feedback, thanks. Quote Link to comment Share on other sites More sharing options...
neilestrick Posted April 21, 2021 Report Share Posted April 21, 2021 10 minutes ago, Dick White said: As one wag said, anything is possible, but some things are not likely. My one attempt at that was not satisfactory. I connected a separate pyrometer to the same thermocouple as was being used by the kiln's Bartlett controller. The temperature readings went jittery and I couldn't tell what was going on. Haven't tried it since. Did you have two sets of wires attached at the TC block? Not that I'm convinced it will work, but it would be interesting to see how they behaved in different configurations- two sets of wires vs a split somewhere closer to the controllers. Also interesting to see how they behave with wires of different lengths (one to kiln controller and one to farther away pyrometer) vs same lengths (controllers at same distance from kiln, sitting next to each other. Quote Link to comment Share on other sites More sharing options...
newps Posted April 21, 2021 Report Share Posted April 21, 2021 Thats essentially what I have, partly so that I can quickly restore the kiln and controller back to original. However my controller is a based on a device like that shown below, but calibrated to about 1400C with an S type thermocouple I am still using the contactor rather than a SSR. I am told its a no-no . Give me a bit of time and I will try and do some circuit diagrams and photos. for me there didn't seem to be any problems, but the old controller seemed to be about 40C between switch off and switch on. it may actually have been less than that . In my case the original controller is about 1m from the kiln, and then the wires to the Max31856 are about 300mm long screened cable attached onto the back of the original controller. Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 21, 2021 Report Share Posted April 21, 2021 (edited) 10 minutes ago, neilestrick said: Did you have two sets of wires attached at the TC block? Not that I'm convinced it will work, but it would be interesting to see how they behaved in different configurations- two sets of wires vs a split somewhere closer to the controllers. Also interesting to see how they behave with wires of different lengths (one to kiln controller and one to farther away pyrometer) vs same lengths (controllers at same distance from kiln, sitting next to each other. What I’m actually thinking about trying is having one thermocouple split at the controller box to two different control systems. The raspberry will control the heat, and the Rex C 100 will shut everything down if it notices it getting way too warm (or if the Raspberry might have hung up or otherwise misbehaves). I want to have a failsafe for that, or if the SSRs might’ve gotten stuck. That’s the plan. If it doesn’t work with one thermocouple, then I have extras and additional compensation cable. It’s just a lot more wire to run! Will have about 10-20 feet of wire between the kilns and controller. Edited April 21, 2021 by MarkTilles Quote Link to comment Share on other sites More sharing options...
neilestrick Posted April 21, 2021 Report Share Posted April 21, 2021 I've got a couple of pyrometers here. If I have time tomorrow I'll try splitting a TC wire in a terminal block close to them and see what happens. In theory it should work better than running two wires from the same TC where ones goes to a controller mounted on the kiln and another that's far away, as there would be a temperature difference and wire length difference in that setup. Not holding my breath for it to be good enough to do it for real, though. Quote Link to comment Share on other sites More sharing options...
MarkTilles Posted April 21, 2021 Report Share Posted April 21, 2021 I ran a small test. I powered up my Raspberry max31856 system with my S-type thermocouple and put the thermocouple in through the door of my toaster oven. I then sat the oven at approx 200C. Then I used alligator clips and attached the Rex C100 PID to the same cable ... made no difference at all, I see no temperature measurement change with the second device attached. Then I unplugged the max31856 from the cable ... no change on the PID temperature measurement either. This is good I think? Quote Link to comment Share on other sites More sharing options...
Bill Kielb Posted April 22, 2021 Report Share Posted April 22, 2021 (edited) 2 hours ago, MarkTilles said: I ran a small test. I powered up my Raspberry max31856 system with my S-type thermocouple and put the thermocouple in through the door of my toaster oven. I then sat the oven at approx 200C. You will probably get this to work, but by now if you have googled around the world you realize it is not the way to do this. Since this is going to be a safety device, I am going to do my very best at giving you some reasons it is not done: Most tcouple circuits contain an op amp circuit that also contains a cold junction reference to improve the measured accuracy. This circuit also generally contains a means to test for tcouple failure or burnout detection using pull up or down or both resistors. Finally this basic tcouple op amp is usually floating. Adding a second passive or active input is prone to: out and out error, drift, ground loop currents, and system noise. Doubling inputs, extra junctions etc..... are always discouraged and testing one case in one instance may or may not indicate this will provide acceptable readings over its lifetime. That all said, this often does work and I suspect you will initially make this operational. Since it is a safety circuit though I would encourage you to just convert this to current loop or other established methods that are approved the world over. A little reference on a common tcouple op amp, interesting reading but also shows how complicated things can become. https://www.ti.com/lit/an/sbaa274/sbaa274.pdf?ts=1619033246467&ref_url=https%3A%2F%2Fwww.google.com%2F Edited April 22, 2021 by Bill Kielb MarkTilles 1 Quote Link to comment Share on other sites More sharing options...
Dick White Posted April 22, 2021 Report Share Posted April 22, 2021 1 hour ago, neilestrick said: Did you have two sets of wires attached at the TC block? Not that I'm convinced it will work, but it would be interesting to see how they behaved in different configurations- two sets of wires vs a split somewhere closer to the controllers. Also interesting to see how they behave with wires of different lengths (one to kiln controller and one to farther away pyrometer) vs same lengths (controllers at same distance from kiln, sitting next to each other. What I was trying to do was use my logging pyrometer connected to the same thermocouple as the controller to keep track of what the controller was seeing/doing. I attached a separate wire directly at the thermocouple block. When I noticed the readings bouncing around, I gave the thermocouple back to the controller rather than have the kiln load bolloxed. Bill Kielb and MarkTilles 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.