hestia/README.md

7.6 KiB

Hestia

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 directory
cd /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

Current Schematic

The End Goal

Future Schematic

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

  1. Launch app, check startup messages, check that it idles and pauses properly.
  2. Provide ignite command, observe if the igniter, blower, and auger get turned on. Make sure the igniter turns off after the pre-set time.
  3. Test that the following conditions cause a shutdown:
    • Proof of Fire Switch OPEN after igniter shutoff.
    • Vacuum Switch OPEN after igniter start.
  4. Test manipulation of feed rates.
  5. Test shutdown sequence.

SQLite Database Tables

status

Field Type Null Key Default Extra
id int(10) No PRI NULL auto_increment
key varchar(100) No
value varchar(1000) No
id key value
0 igniter 0
1 blower 0
2 auger 0
3 igniter_finished false
4 shutdown_initiated 0
5 vacuum 0
6 proof_of_fire 0
7 shutdown_next_cycle 0

timestamps

Field Type Null Key Default Extra
id int(10) No PRI NULL auto_increment
key varchar(100) No
value varchar(1000) No
id key value
0 process_start 0
1 blower_on 0
2 blower_off 0
3 igniter_on 0
4 igniter_off 0

intervals

Field Type Null Key Default Extra
id int(10) No PRI NULL auto_increment
key varchar(100) No
value varchar(1000) No
id key value
0 auger_on 600
1 auger_off 1400
2 pause 5000
3 igniter_start 420000
4 blower_stop 600000