Node.js Raspberry Pi Pellet Stove Controller, named after the Greek virgin goddess of the hearth.
About
This project seeks to replace the OEM control panel on a Lennox Winslow PS40 pellet stove with a Raspberry Pi. I am utilizing a Raspberry Pi 3 Model B+, relays, and temperature snap switches installed on the pellet stove. I chose a Pi 3 for its wireless connectivity and familiarity with the platform. I had previously used an Arduino Nano for a much more rudimentary version of this project and found great difficulty in making adjustments to the code. Additionally the Raspberry Pi platform will allow for expansion in the future to include IoT controls and logging of usage utilizing networked databases. The project will be written using Node.js to handle high-level logic and communications, calling Python scripts to handle interacting with GPIO. I'm now in the process of rewriting this project to a more modern v2. Previously I had settled on using deprecated versions of Node.js to maintain compatibility with various Pi GPIO modules, now I've decided to split the GPIO controls off to a small Python interface script.
Setting Up the Pi
# Update and upgrade the system
sudo apt update && sudo apt upgrade -y
# Install dependencies and other useful utilities
sudo apt install nodejs npm python3 python3-pip neofetch btop fish -y
# Install PM2 to manage the Node.js process
sudo npm install -g pm2
# Set up a new user to run the process
sudo useradd -m -s /usr/bin/fish hestia
# Set hestia home to /srv/hestia
sudo usermod -d /home/hestia hestia
# Create a runners group
sudo groupadd runners
# Add the new user to the runners group
sudo usermod -aG runners hestia
# Add hestia to the gpio group
sudo usermod -aG gpio hestia
# Give hestia ownership of the home directory
sudo chown hestia:runners /home/hestia -R
# Set permissions on the home directory
sudo chmod 775 /home/hestia -R
# Create a directory for the project
sudo mkdir /srv/hestia
# Change ownership of the directory to the new user
sudo chown hestia:runners /srv/hestia -R
# Set permissions on the directory
sudo chmod 775 /srv/hestia -R
# Change to the new user
sudo su hestia
# Pull the project
git clone https://git.vfsh.dev/voidf1sh/hestia.git /srv/hestia
# Change to the project directorycd /srv/hestia
# Checkout the backend branch
git checkout v2-back
# Install the project dependencies
npm install
# Test run
node src/main.js
# Start with PM2
pm2 start src/main.js --name hestia
# Save the process list
pm2 save
# Setup PM2 daemon
pm2 startup
Logic Flow
Boot
Server starts
Call python to check pin states and reset them
Establish connection to MQTT
Listen for messages published to MQTT
Auto-Start
Check pin states for safety
Power on igniter, 30 second pre-heat
Power on exhaust
Power on auger
Wait X minutes
Check Proof of Fire switch
No Fire:
Shutdown
Alert
Fire:
*Power off igniter
Shutdown
Check pin states
Power off auger
Wait X minutes
Check Proof of Fire switch
No Fire:
Wait X minutes
Power off exhaust
Fire:
Wait X minutes
Repeat PoF switch check
GPIO
Three GPIO pins are used along with a common ground to control three relays, supplying 120VAC power to the igniter and combustion blower when appropriate, and supplying power to the auger motor in pulses. Two more GPIO pins are used to detect open/closed status of a temperature-controlled snap switch and a vacuum switch. Another temperature-controlled snap switch is used to supply power to the convection motor when the pellet stove has reached a suitable temperature. A final temperature-controlled snap switch us used to interrupt the circuit for the auger motor to shut the stove off when an over-temperature condition is met. I will be utilizing a OneWire DS18B20 temperature sensor to detect the temperature of air exiting the stove vents.
Board Pin
BCM Pin
Function
Direction
Wire Color
7
4
Auger Relay
Out
Or/W
13
27
Igniter Relay
Out
Orange
15
22
Exhaust Relay
Out
Gr/W
16
23
Proof of Fire Switch
In
Blue
18
24
OneWire Temp Sensor
In
Blue/W
22
25
Vacuum Switch
In
Green
4
N/A
+5VDC for Switches
N/A
Br/W
6
N/A
GND for Relays
N/A
Brown
Dev Board Guide
8-Pin DIP:
1: Exhaust
2: Igniter
3: Auger
4: N/A
5: Vacuum
6: PoF
7: Passthrough to 220 Ohm DIP; 7-seg common cathode
8: Passthrough to 220 Ohm DIP; 7-seg common cathode
Schematics
The Current Setup
The End Goal
Oddities
For ease of adaption, connection, and prototyping I've decided to use Cat 5 ethernet cabling and RJ45 connectors to connect the Raspberry Pi to the stove, and to a breadboard mockup of the sensors and switches for testing.
Environment Variables
ONTIME - How long to turn the auger on, in milliseconds.
OFFTIME - How long to wait between turning the auger on, in milliseconds.
PAUSETIME - How long to pause when a pause file is detected, in milliseconds.
DEBUG - Displays extra log information when set to true
Controls
Run with node main.js > log.txt & to launch it in the background, piping output to a file log.txt which can be read from later.
Pause the script by creating a file named pause in the root directory.
Reload the environment variables by creating a file named reload in the root directory.
Quit the script by creating a file named quit in the root directory.
Roadmap
v0.1 - Get the pellet stove operating at a basic level. Only implements the auger relay and no safeties.
v0.2 - Implement safety switches and put the igniter and combustion blowers on relays controlled by the Pi.
v0.3 - Implement the HTTP module to allow controlling the stove from the LAN.
v0.4 - Implement usage logging with a SQL database.
Testing Procedure
Launch app, check startup messages, check that it idles and pauses properly.
Provide ignite command, observe if the igniter, blower, and auger get turned on. Make sure the igniter turns off after the pre-set time.
Test that the following conditions cause a shutdown: