Wood stove automation using the Raspberry Pi

  • Active since 1995, Hearth.com is THE place on the internet for free information and advice about wood stoves, pellet stoves and other energy saving equipment.

    We strive to provide opinions, articles, discussions and history related to Hearth Products and in a more general sense, energy issues.

    We promote the EFFICIENT, RESPONSIBLE, CLEAN and SAFE use of all fuels, whether renewable or fossil.

MisterFixIT

Member
Mar 10, 2016
61
Western Great Basin, USA
Happy New Year!

It has been a couple of years since I started working on my wood stove automation project. Its based on Python and currently runs on a Raspberry Pi3 Model B. I got quite far but until now I never documented any part of what I did. Took me about a week to take pictures and write up just the first phase. I don't think Ill ever be done so I'll just post this before I get lost in trying to make the doc perfect. Yes, it needs more pictures that I should be able to add soon. Feel free to use any part of this project for your own builds. I have learned a lot about thermocouples, analog signal digitizers, AC motor speed controllers, I2C databuses and how to drive LEDS off the Pi.

Here is the GitHub URL for the project:

https://github.com/yodagami/trainman

So far I have completed documenting phase1: Reading stove and pipe temperatures with Raspberry Pi

https://github.com/yodagami/trainman/tree/master/trainman1

Next phase: Reading room temperature from a 1-wire server and temperature sensor.

Cheers!
 

Attachments

  • trainman-01-p1thermoprototype.jpg
    trainman-01-p1thermoprototype.jpg
    216.6 KB · Views: 797
  • trainman-02-leddisplay.jpg
    trainman-02-leddisplay.jpg
    92.7 KB · Views: 834
  • trainman-03-hackedspeedcontroller.jpg
    trainman-03-hackedspeedcontroller.jpg
    133 KB · Views: 804
  • trainman-04-digitalspeedcontrol.jpg
    trainman-04-digitalspeedcontrol.jpg
    199.2 KB · Views: 725
I look forward to reading your sketch tomorrow, getting late for me tonight.
 
Nice. Last winter I modified a Python program for my RPi to read, display, and log data from multiple DS18B20 temperature sensors. Haven't done it yet, but hopefully this winter I will add a program to turn devices on/off based on temperature readings.
 
Nice. I'm jealous.

I like the stuff about alinco magnets being resistant to heat. I'm installing one of those Auber controllers to vary the fan speed, low or high, based on stove top temp. Do you think the extra mass of the magnet would affect the thermocouple readings? Cement will work on stove top, but not on side, I would think.

I'm not doing anything with the stack, but when I installed a thermocouple in the exhaust pipe of my VW TDI, it came with a hose clamp type of mount. You drill the hole, put the thermocouple with a cone shaped end into the hole and strap in on with the clamp. No threading required. Haven't seen anything like that for stoves. Not sure how they usually mount them.

I'd be interested in seeing how you control the air.

What I'd like to do also, if I had any talent, would be to replace the fan motor with an efficient and infinitely variable ecm motor and also have fine control of fan speed by your processor.
 
Curious which Auber controllers you used and which thermocouple you used for stovetop? I'd love to have some good suggestions on which to look at. I've checked out Omega suppliers but some of their thermocouplers are so damn expensive.
 
K-type thermocouples work well in high temp environments, and many digital temperature controllers as well as digital temperature panel meters accept K-type sensors. I have one in the stack of my boiler which shuts down the draft fan if stack temp gets too high. Neither the sensors nor the controllers are very expensive. The bottom right sensor in the picture is the stack temp readout which uses a K-type probe. The temp controller is separate and also uses a K-type probe.

upload_2018-1-2_11-2-58.jpeg
 
Very cool, reminds me of my electric brewery where I use K-Type thermo probes. The problem I'm findnig is that most of the probes are non-surface mount, and the surface mount ones are pretty pricey.
 
> Do you think the extra mass of the magnet would affect the thermocouple readings?

I don't think it will effect the reading very much. Pics attached. The thermocouple washer is directly contacting and flat to the top of the stove. The magnet is on top of that and fairly small. I was surpised to see how accurate the thermocouples were against shooting the surfaces with a Fluke IR reader. Much better than the coil type thermometers you see in the pics.

> Curious which Auber controllers you used and which thermocouple you used for stovetop? I'd love to have some good suggestions on which to look at. I've checked out Omega suppliers but some of their thermocouplers are so damn expensive.

I don't use the Auber controller. I looked at them but they didn't have the flexibility and control I wanted. I do use the Auber thermocouples and other parts. They are just what I needed and I am so glad they sell them. I use Adafruit P1778 thermocouple amps and a Adafruit P1085 analog to digital digitizer that is read by the Raspberry Pi3. Parts list is in the trainman1 readme https://github.com/yodagami/trainman/blob/master/trainman1/README-trainman1.txt

T> he bottom right sensor in the picture is the stack temp readout which uses a K-type probe. The temp controller is separate and also uses a K-type probe.

Awesome! Yes, the stove pipe surface thermocouple is a derivative of what is actually going on inside the stack. A probe would be better but for now it gives me the burn rate data I will need for air control later. Its been interesting to watch how the two temps progress through a burn.
 

Attachments

  • trainman1-06.jpg
    trainman1-06.jpg
    110 KB · Views: 781
  • trainman1-07.jpg
    trainman1-07.jpg
    73 KB · Views: 862
  • trainman-06-jumbleofwires-makerproject.jpg
    trainman-06-jumbleofwires-makerproject.jpg
    269.7 KB · Views: 702
Very cool. Are you logging the temperature data, or just displaying it? If you're logging it, lets see some temperature profiles!
 
Curious which Auber controllers you used and which thermocouple you used for stovetop? I'd love to have some good suggestions on which to look at. I've checked out Omega suppliers but some of their thermocouplers are so damn expensive.
1 x 1/16 DIN PID Temperature Controller (For Relay) (SYL-2342) = $46.50
1 x K type Thermocouple, Washer Probe (TC-K-WS) = $13.95
Sensor Cable Length Option 6 ft Cable with spade connector
 
  • Like
Reactions: NoobTube
> Very cool. Are you logging the temperature data, or just displaying it? If you're logging it, lets see some temperature profiles!

Data is getting logged once per second to /var/tmp/trainman I have /var/tmp mounted on RAM so it doesn't burn out the flash disk with the constant writes. It does mean that the data goes poof when I reboot but I really don't care. I need to go make a program to go grab the data off the Pi and graph it automatically. Here is example log of phase#6 of this project from this mornings burn. Yes, I know there is no date/time stamp on the data. Im really lazy, so that part is missing as well, ha ha.

https://github.com/yodagami/trainman/blob/master/trainman6-log-20180102.txt

Right now in my phase#6 code the blower fan just uses the stove top temperature to set the fan speed. As the stove heats up the fan speed goes up up up and as it cools down it decreases the fan speed till it turns it off. Its a 9 speed fan (8 speeds + off). Fan profile sets the agressiveness of the fan. I tend to set an aggressive high fan profile when its really cold in the morning to blow the heat off the stove to get the room warmed up quickly. Later on I will turn the fan profile down if I want it to be quieter. I really like having the system micro-manage the fan speed for me while I macro-manage the fan profile depending on what I want.
 
Right now in my phase#6 code the blower fan just uses the stove top temperature to set the fan speed. As the stove heats up the fan speed goes up up up and as it cools down it decreases the fan speed till it turns it off. Its a 9 speed fan (8 speeds + off). Fan profile sets the agressiveness of the fan. I tend to set an aggressive high fan profile when its really cold in the morning to blow the heat off the stove to get the room warmed up quickly. Later on I will turn the fan profile down if I want it to be quieter. I really like having the system micro-manage the fan speed for me while I macro-manage the fan profile depending on what I want.
Did it come with a 9 speed fan? I'd be interested a few more details on the fan control, please.
 
1 x 1/16 DIN PID Temperature Controller (For Relay) (SYL-2342) = $46.50
1 x K type Thermocouple, Washer Probe (TC-K-WS) = $13.95
Sensor Cable Length Option 6 ft Cable with spade connector

Thanks! I figure I'll run the Fan to a outlet that is controlled by the PID. I use that same PID for my brewing setup. I might have to read a little bit more into it. I'd love to be able to program the PID to control fan speed via PID Power settings e.g @ 300*F Fan power level = 50%, 450=70%, 600 = 90%, 750= 100%. Although I don't think you can program in that many variables.
 
Thanks! I figure I'll run the Fan to a outlet that is controlled by the PID. I use that same PID for my brewing setup. I might have to read a little bit more into it. I'd love to be able to program the PID to control fan speed via PID Power settings e.g @ 300*F Fan power level = 50%, 450=70%, 600 = 90%, 750= 100%. Although I don't think you can program in that many variables.
No, not the one I got. It's relay only. My stove already has a snap switch on it, and my PID will kick it into high speed.
 
> Curious which Auber controllers you used and which thermocouple you used for stovetop? I'd love to have some good suggestions on which to look at. I've checked out Omega suppliers but some of their thermocouplers are so damn expensive.
>>1 x 1/16 DIN PID Temperature Controller (For Relay) (SYL-2342) = $46.50
>>1 x K type Thermocouple, Washer Probe (TC-K-WS) = $13.95
>>Sensor Cable Length Option 6 ft Cable with spade connector

I use the same Washer Probe model as velvetfoot except I got the ones with the mini-connector and the female mount connector
https://www.auberins.com/index.php?main_page=product_info&cPath=61_62&products_id=426

I plan to make a box for it someday and just have the thermocouples plug into the female mount connectors.
 

Attachments

  • trainman1-05.jpg
    trainman1-05.jpg
    385.6 KB · Views: 800
  • trainman1-04.jpg
    trainman1-04.jpg
    422.6 KB · Views: 511
> Did it come with a 9 speed fan? I'd be interested a few more details on the fan control, please.

Ummm, not really. My PE classic came with a blower fan with an on off switch on it along with a knob on the side to control the fan speed. Knowing nothing about AC fan speed control I thought I would just find a potentiometer that I could hack to make the various speeds I wanted. Instead I found that it had a whole circuit board that I had to figure out. I ended up buying an exact duplicate of the speed controller that the blower came with and then proceeded to remove the pot from the board and wire in a SainSmart 4 solid state relay. One relay does 120VAC on/off. The others provide the 8 different (2 to the power of 3) resistances required by the fan controller to get the 8 different on speeds.

I also left the existing manual speed control intact and replaced the On/Off switch on the side with a 3-position so now it does Manual-Off-Auto. I like options . :)
 

Attachments

  • trainman-03-hackedspeedcontroller.jpg
    trainman-03-hackedspeedcontroller.jpg
    133 KB · Views: 528
  • trainman-04-digitalspeedcontrol.jpg
    trainman-04-digitalspeedcontrol.jpg
    199.2 KB · Views: 559
  • trainman-05-controllerinblower.jpg
    trainman-05-controllerinblower.jpg
    159.2 KB · Views: 475
  • Like
Reactions: velvetfoot
TRAINMAN2

Phase II of this project has been posted to github: https://github.com/yodagami/trainman/tree/master/trainman2

Instead of doing the acquisition of temperature off a 1-wire thermometer I decided to add the LED displays for the 2nd phase.

The README describing the hardware build and how to get it runnig is at https://github.com/yodagami/trainman/blob/master/trainman2/README-trainman2.txt

Please excuse the poor pictures when the LEDs are turned on. Digital cameras have a difficult time taking good shots of the displays when lit up. When viewed in real life they are stunningly bright and colorful. I can easily read them 20-25 feet away.

For this phase I ended up simplifiying the display board wiring. The entire board runs off the 5 volt pins of the Pi3 but the voltage is immediately stepped down to 3.3 volts using a Buck Converter to drive the displays. https://www.adafruit.com/product/2745

On the PiHat board I I take a shortcut and just reuse the 4 pins on the and of the ADC header. I soldered a 4 pin terminal block right next to the ADC headers GND,5V,SCL,SDA pins, saving space and 4 extra wires. I should probably rework this board so the ADC header is at the opposite end. I don't like how long the SCL,SDA wires are. Oh well, that's for a future date.

The pictures show a 6 display setup using the full sized perma-proto board. https://www.adafruit.com/product/1606
The wiring is fairly modular so it would be easy to make a 2, 3 or 4 display setup by removing wires and components and maybe downsizing to a half or quarter size perma-proto board. There are a maximum of 8 I2C addresses for the displays so that is the upper limit for this product.

https://www.adafruit.com/product/1911
https://www.adafruit.com/product/2158
https://www.adafruit.com/product/2160
https://www.adafruit.com/product/1912
https://www.adafruit.com/product/2157
https://www.adafruit.com/product/2159

The trainman2.py code is pretty simple to understand. The thermocouples are read and then just displayed on the AlphaNumeric LEDs in a loop.

Brightness can be altered and balanced between the displays inside the python code. I really don't like the Blue display. I find it impossible to read from across the room so its usefulness is limited. Yellow-Green is dim. White is distracting and harsh to have running as a display all the time. I use two of each of Red/Yellow/Green for my 6 display setup. For a 4 LED display I would probably use Yellow-Green as the 4th color. Most of the time I run the system with the lowest brightness profile and its easy to compensate for the dimness of Yellow-Green by boosting up just that one color in the brightnessprofile array.
 

Attachments

  • trainman2-RYGleddisplay.jpg
    trainman2-RYGleddisplay.jpg
    92.7 KB · Views: 393
  • trainman2-RYGBWyGleddisplay.jpg
    trainman2-RYGBWyGleddisplay.jpg
    189 KB · Views: 414
  • trainman2-displayoff.jpg
    trainman2-displayoff.jpg
    173.8 KB · Views: 548
  • trainman2-displayboardfront.jpg
    trainman2-displayboardfront.jpg
    209.2 KB · Views: 390
  • trainman2-displayboardback.jpg
    trainman2-displayboardback.jpg
    171.4 KB · Views: 426
  • trainman2-pihatdisplayterminalblock.jpg
    trainman2-pihatdisplayterminalblock.jpg
    231.5 KB · Views: 523
  • Like
Reactions: begreen
TRAINMAN3

Phase III of this project is adding in Automatic Fan Speed control.

WARNING: Attempting this will void your blower fan warranty, obliterate its UL listing and is electrically dangerous because it involves modifications to wires that carry 120 Volts AC. If you don't know how safely deal with 120VAC just don't do it. Remember to unplug the blower fan and keep it unplugged while messing around with an open blower fan. Using GFI outlet while messing around with it is a very good idea.

Being able to have the system automatically turn on and vary the blower fan has been really great. I don't have to stop what I am doing and turn on the fan when the stove gets up to temperature. If it gets really hot the the blower will go on full speed and let me know that the air control might need to be quenched off a bit. When the burn is done, the speed is slowed down and then turned off. I'm not wasting power running a fan that has been forgotten about. I'm not blowing air off a cold stove creating a draft in the room. Minimal power, Minimal noise, Minimal fuss.

My stove is a Pacific Energy Classic. The blower is nice and quiet on moderate speed, they cost about 300$. There is a simple On/Off switch on the side with the speed control potentiometer and the stove comes with a snap switch that doesn't do what I want when I want. Im not a EE so I haven't studied anything remotely close to a variable speed AC fan controller so when I busted open the blower in the back I was surprised to find this ...

Speed Control KB Electronics Model KBMS-13BV
http://www.kb-controls.com/product.sc?productId=158

Inside the plastic box is a small circuit board which has a bunch of compoenents soldered onto it as well as the and the large speed control potentiomter with a small trim speed potentiometer.

At first I thought I was done ... there is no easy way to automatically vary the fan speed. After a bit of reasearch I discovered that the circuit board is a DIAC/TRIAC (Thyristor) circuit and they have been around for quite some time. Instead of the potentiometer reducing the voltage to the fan motor, browning it out (which would be bad), the Thyristor chops the AC waveform so peak voltages are maintained but the time that the motor sees voltage is reduced.

Basically, the fan speed is controlled by the triggering of the TRIAC. The potentiometer varies the resistance that controls the triggering. Higher resistance slows the fan. Lower resistance speeds up the fan.

Awesome! Wanting to do more experimentation but not wanting to wreck what I have, I bought a replacement speed control and using a soldering iron and solder vacumm I removed both the big potentiometer and the small blue trim pot and in thier place attached red+orange lead wires. I could then (with a great deal of care) play around with various resistors and vary the speed of the fan.

That's great but how does one automatically vary the resistance via a Raspberry Pi? It might be possible to integrate a digital potentiometer into the circuit but I would still have to deal with turning the fan on/off, so instead I chose a 4 channel solid state relay board for this purpose.

https://www.sainsmart.com/products/4-channel-5v-solid-state-relay-module

This board is nice because it is optically isolated 5Volt active high which is perfect for integrating 120VAC with the Pi. Also the current capacity of the solid state relay (0.1 to 2 AMP) will handle the limited amperage of the blower fan. So I used one relay to turn the fan on/off and the other 3 to vary the resistances to the speed controller.

Which resistances to use?

Simple answer.
- Figure out the resitance of the slowest desired fan speed (For me it was about 90K Ohms).
- Select 3 available resistors that add up to this resistance that are roughly multiples of 1x,2x,4x (For me these ended up being 12K,27K,47K). When wired in series the resistances are additive: 12K + 27K + 47K = 86KOhms

Once that is figured out, 3 sainsmart relays are used to individually short out these 3 separate resistors. When a resistor is shorted its resitance is removed from the series. Using various combinations of On/Off for the relays allows for 8 different resistance and 8 different fan speeds when the on/off relay is triggered on. Its easier to figure this out looking at the following table. The first relay simply turns the 120 VAC power to the motor on/off. Remember! don't stick your fingers in it when plugged in. ZAP!

FanSpeed Relay Resistances Total Speed
=====================================================
0 0,0,0,0 Blower Motor Off Off
1 1,0,0,0 12K + 27K + 47K = 86K Slowest
2 1,1,0,0 0K + 27K + 47K = 74K ^
3 1,0,1,0 12K + 0K + 47K = 59K |
4 1,1,1,0 0K + 0K + 47K = 47K |
5 1,0,0,1 12K + 27K + 0K = 39K |
6 1,1,0,1 0K + 27K + 0K = 27K |
7 1,0,1,1 12K + 0K + 0K = 12K V
8 1,1,1,1 0 + 0K + 0K = 0K Maximum

I was kind of stunned to see it actually work in the end. I cleaned up the install by replacing the 2 way On/Of switch with a 3 way switch that turns the fan Manual/Off/Auto.
The wiring is basically: 120VAC Hot/BlackWire ---> Switch ---> Speed Control ----> Fan Motor ----> 120VAC Neutral/WhiteWire.
The Manual versus Auto setting selects which speed control is active. (Manual for the original Speed Controller, Auto goes to the Sainsmart+Hacked Speed Controller).

4 GPIO pins on the Pi control the SainSmart relay board. I feed it 5VDC as well as GND so it uses a 6 wire harness to connect to a 6 pin terminal block on the trainman perma proto board.

I should have the trainman3.py code posted up soon.

https://github.com/yodagami/trainman/tree/master/trainman3
 

Attachments

  • trainman3-SpeedControlSchematic.jpg
    trainman3-SpeedControlSchematic.jpg
    123.5 KB · Views: 351
  • trainman3-TRIACWaveForm.jpg
    trainman3-TRIACWaveForm.jpg
    83.6 KB · Views: 365
  • trainman3-HackedControllerSide.jpg
    trainman3-HackedControllerSide.jpg
    104.4 KB · Views: 427
  • trainman3-DigitalSpeedControl.jpg
    trainman3-DigitalSpeedControl.jpg
    199.2 KB · Views: 369
  • trainman3-InstalledControllerAndRelay.jpg
    trainman3-InstalledControllerAndRelay.jpg
    53.4 KB · Views: 397
  • kbmc_kbms_data_sheet.pdf
    5.5 MB · Views: 1,729
  • trainman3-ThreeWaySwitchWire.jpg
    trainman3-ThreeWaySwitchWire.jpg
    187.6 KB · Views: 375
  • Like
Reactions: jetsam
Very interesting project! Wouldn't it be better with DC motors and PWM? Or maybe I'm a bit biased. I've done a lot of PWM stuff on DC motors.

I was thinking of doing a similar project with a blaze king. Since the stove has a built in thermostat, you should be able to set it and forget it. The house temperature controller would vary the speed of the fans on the stove. If they sped up, the thermostat on the stove should compensate for the BTUs removed and open the damper slightly. If the fans are running too much, just turn up the thermostat on the stove. If they're too slow turn it down.

Still trying to find a programmable thermostat capable of customizable PID parameters and PWM output.

If done right the temperature of the house should be rock stable, programmable, and you would use less wood.
 
Yeah DC Fans have alot of advantages. I think they are quieter and if the power goes out you can run them on a car battery alot easier.

Truth be told, im lazy. I just hacked the AC fan motor speed controller because that's what the stove came with. Everything appears like unmodified stock PE stove until you look under the hood.

I have started to work with the PWM pins on the Raspberry Pi. I think one of them in BCM pin #18. Downside is that its only 3.3VDC with limited amperage. Maybe a solid state relay would switch fast enough to be able to translate the PWM square wave into 12volts for fans??? Haven't PWM'd anything high current so I don't know .... yet! :)

I like the programability of the Pi but that's just my bias doing a bunch of Python programming on them and the expansion modules you can get for them. I also like the eMMC memory that you can get with the ODROID, much better for small monitors that collect data when the memory chip doesn't wear out.
http://www.hardkernel.com/main/products/prdt_info.php?g_code=G145457216438

Next up is the 1-wire room temperature sensor, buttons for controlling the program and Stepper Motor for controlling the air supply lever in bottom front.

If the blaze king has room on the stove thermostat shaft for a timing pully gear or something similar...

https://www.adafruit.com/product/1253

... having stove thermostat controlled by room temperator sensor and stepper motor would be the ultimate. Then you could set the fan to whatever you want. High for quick heat, low for a quiet room. Gets pretty close to a pellet stove with thermostat at that point.
 
trainman3.py has been posted to GITHUB along with the README and some pics of the reworked board (before and after I added the fan+button teriminal blocks).

https://github.com/yodagami/trainman/tree/master/trainman3

I really like the way the blue and purple wires are shortened up a bunch on the reworked board. They would otherwise in the way when wiring up the fan and button terminal blocks.

The code include fan profiles and the handling of a button to control which fan profile is active. The fan speed controller has an anti-flap mechanism built into it. This is good because when a fan is ramped up both the stove and pipe temperatures dip slightly with the greater air flow. Same deal on the way back down. The temps will spike slightly with less airflow. The anti-flap mechanism ignores these small dips and spikes. Without it the fan speed would ramp up/down repeatedly when transitioning through a temperature threshold, which would be quite annoying.

# Increase or Decrease fan speed depending on stovetop temperature
fanprofile=fanprofiles[fanpro]
maxfan=len(fanprofile)-1

if fanspeed < maxfan and stovetemp >= fanprofile[fanspeed+1]:
fanspeed += 1
print 'Increasing Fan To',fanspeed
set_fan_speed(fanspeed)
elif fanspeed > 0 and stovetemp <= fanprofile[fanspeed-1]:
fanspeed -= 1
print 'Decreasing Fan To',fanspeed
set_fan_speed(fanspeed)
 

Attachments

  • trainman2-pihatboardtop.jpg
    trainman2-pihatboardtop.jpg
    200.8 KB · Views: 315
  • trainman2-pihatboardbottom.jpg
    trainman2-pihatboardbottom.jpg
    199.2 KB · Views: 364
  • trainman3-pihatboardtop.jpg
    trainman3-pihatboardtop.jpg
    184.5 KB · Views: 303
  • trainman3-pihatboardbottom.jpg
    trainman3-pihatboardbottom.jpg
    201.1 KB · Views: 345
Thanks for the links! That's great info and advise.... just use PWM fans with the control already built into them.

Ill have to do this for my Heat N Glo gas fireplace. The AC fan it comes with is horrendiously noisy compared to my PE wood stove fan and its maybe a 1/4 the BTU. I don't need the powerful airflow for the fireplace and I end up hardly ever using it due to the noise with the fan and the lack of immediate heat getting into the room without the fan. Again, like the original wood stove ... it comes with a stupid snap switch to turn the fan on/off. Blah.

Ill have to make a PWM version of the code, should be easy.