Sunday, November 24, 2024

How to Build a Fort (Again!)

 In 2019 we moved to a new home and had to leave our old fort behind. There was nothing to do but start again! We got more ambitious this time around. 


We picked a location far enough from the main house to feel adventurous, but close enough that we could easily see the fort from the house and house from the fort. 

Fort Location

I did the initial design in SketchUp. With some help from my dad, I decided to use four 6"x6" posts as the main supports (upgrading from the 4"x4"s used in the previous fort). 

Fort Scale

Since we live in Minnesota, we had to dig down 4' for each of the four posts to avoid heaving risk in winter. 

Posts Poured

With help from the neighbors we set up the posts and braced them into position. 

I don't own a construction helmet, so I used a bike helmet

We notched out the posts to mount two 2"x8" ledger boards. 


We lag bolted the ledger boards to the posts, then hung 2"x6" joists between them. We used ledger strips, rather than joist hangers, to save money (the size difference between the ledger board and joists allow this approach). 



We put down plywood decking and decorated it.



We installed a temporary roof to keep rain from spoiling the plywood decking. 

Adding a temporary roof. Also shown, rails to keep people from falling out


 We used the fort as-is for quite a while, since it made a great place to see the yard and the kids enjoyed playing in it. 

The gully flowing, as seen from the fort

Eventually (a couple of years later!) we decided it was finally time to add some walls. My dad and I stick-built the walls from 2"x4"s and the kids helped with sheathing. 

Nailing on sheathing



Fort with sheathing and a hole cut for a window

We used house wrap left over from siding our main home, and some friends gave us a couple of old windows. 



My dad did the trim and siding on the front.


It was time to replace the temporary (now years old) roof with a real roof. We still plan to add a rooftop patio, so the real roof had to be a little shorter than the top of the 6"x6" posts. 



I managed to finish shingling the new roof just before winter in 2022. 



My dad built a beautiful custom front door.

Cedar siding and custom front door

I designed and build a custom electronic lock for the door.

Components of the custom lock

Which required a bit of welding to make a custom mounting bracket for the magnetic lock. 

Magnetic lock mounted with welded steel bracket

My dad and I have nearly finished the siding (different on every side, because we're reusing old material) 

Different siding on each side

I added some interior and exterior lights


Now we're working on the interior. Stay tuned!




Sunday, January 14, 2024

Thermostat Monitor System

 Summary

I was having trouble keeping track of which of my house's three heating zones was activating the boiler and pump at any given time. So I built a device to monitor which zone was calling for heat. 

Zone activation sensor system, with indicator lights

I used Prometheus to keep track of zone activation over time. 


Two days of zone activation lots via Prometheus. The temperature dropped over the last 8 hours, so you can see the upper floor is constantly active.

Build Process

My house has a hot-water heating system with three zones, each controlled by a valve like this one


Zone controller, photo via Amazon.com

There are three zones, each managed with one of these zone valves. Each zone valve is controlled by a thermostat.

Boiler and control valves 

These control values take a 24 Volt Alternating Current (VAC) input. When a thermostat calls for heat, it does so by sending 24 VAC to its control valve. The control valve opens the physical valve and sends 24 VAC to the boiler.


Diagram of power flow through the boiler system. The thermostat is effectively a switch that, when activated, closes the connection between the 24VAC transformer and the zone control valve.

The boiler system uses a transformer to convert the standard 120 VAC wall power to the 24 VAC used for the heating system. 

Each thermostat has its own settings for when to call for heat. The basic function of a thermostat is to track a set point (e.g., 68 degrees) and a current temperature (e..g, 70 degrees). If the current temperature is below the set point (in the case of a heating thermostat, e.g., 65 degrees) the thermostat will close the circuit from the transformer to the control valve. The control valve will open the pipe for hot water to the associated region of the house and will also close a circuit to provide 24 VAC to the boiler. This, in turn, causes the boiler to heat up and the water pump to turn on. 

Side note: newer thermostats like a Google Nest Thermostat require a "C-Wire." The C-Wire or "Common-Wire" is a neutral wire that allows the thermostat to use the 24 VAC supplied by the transformer. Without a C-Wire, the thermostat is just like a switch. 

Approach

I wanted to monitor which thermostat was calling for heat at what time and for how long. I also did not want to modify the heating system (I definitely don't want to break out boiler in the dead of winter!) To do this, I took advantage of a handy property of alternating current: you can indirectly measure it. Alternating current creates a magnetic field, which you can measure without directly touching the wires carrying that current. 

I purchased some of these clamp sensors (you can find them on eBay), which can measure alternating current on a wire when clamped around it. 

Clamp current sensor photo via eBay

I connected these to an Adafruit Metro ESP-32 S2, and used its analog ports to measure the voltage reported by each clamp sensor. 


Adafruit Metro ESP32-S2 via Adafruit


I found a prometheus exporter for CircuitPython on github. I had to make one modification to make it work with my board (my fork on GitHub).

I wrote a CircuitPython program to read the analog signals from the clamp sensors, then make that reading available to my prometheus server via a simple HTTP endpoint. Setting up CircuitPython took a bit of work, let me know in a comment if you would like a blog post about that process. 

The endpoint looks like this when viewed with a web browser:

Statistics reported by the thermostat monitor system

I configured my Prometheus server to scrape the thermostat statistics every 15 seconds. To generate a graph of when thermostats are active, I can use a query like:

environment_thermostat_upper_heat{job="thermostat"}

A query and associated results viewed in the Prometheus graph viewer

In this case we can see that the upper floor heat was active almost continuously over the past ten hours. This is not surprising, since an arctic vortex just arrived. 

Conclusion

CircuitPython is really handy for making Internet of Things (IoT) devices that work with an aggregator like Prometheus.