Home automation

I added some temperature sensors around my house.

 Temperature sensor, $4/ea on aliexpress
Temperature sensor, $4/ea on aliexpress

The sensors run on AAA battery, and periodically transmit the temperature on zigbee, a radio protocol in similar frequencies as Wifi. The signals get received by a USB dongle designed to receive and transmit zigbee.

 A raspberry pi listens to zigbee using a USB dongle
A raspberry pi listens to zigbee using a USB dongle

This is connected to a raspberry pi running zigbee2mqtt. The messages get sent to an mqtt broker via wifi. mqtt is a pub/sub protocol that runs over the internet. Any computer on my LAN can then be notified of temperature updates, by asking the mqtt broker to send them updates.

I wrote a small server which stays on all the time, listening to updates and recording changes to a database. It also generates reports periodically.

I think my database format is mildly interesting, in that it's designed to use a fixed amount of space. Anyone who wants to see the technical details, can check the github repo, specifically this file.

Temperatures can be seen in celsius or fahrenheit online. An example in Fahrenheit is below.

    Current Temperature
    last updated: 2024-11-07 8:34pm

    Sensor                        Temperature  Humidity    Last update
    Outside - Front                51.51°F      69.86%     1 minutes ago
    Outside - Back                 64.26°F      99.99%     22 hours, 49 min ago
    Upstairs - Dining Room         69.67°F      53.24%     0 minutes ago
    Upstairs - Bedroom - Za3k      71.35°F      60.15%     21 minutes ago
    Upstairs - Bedroom - Master    68.90°F      58.11%     4 minutes ago
    Upstairs - Kitchen             71.20°F      50.50%     6 minutes ago
    Upstairs - Garage              65.55°F      60.65%     2 minutes ago
    Basement - HVAC/Server         68.02°F      51.27%     3 minutes ago
    Basement - Workshop            67.10°F      52.91%     14 minutes ago

    -------------

    Hourly Temperature
    last updated: 2024-11-07 8:34pm

                    outside    inside     
    2024-11-07  8am    54.49°F    69.44°F   
    2024-11-07  9am    53.81°F    69.04°F   
    [...]
    2024-11-07  6pm    56.11°F    69.86°F   
    2024-11-07  7pm    53.53°F    69.65°F   

    -------------

    Historical highs and lows
    last updated: 2024-11-07 8:34pm

                outside             inside              
    2024-11-07    51.51 -  64.15°F    67.06 -  81.54°F   
    2024-11-06    61.21 -  71.24°F    68.36 -  81.18°F   
    [...]
    2024-10-10    49.39 -  60.89°F    67.59 -  77.49°F   

    -------------

    Code: https://github.com/za3k/temp-monitor

Having tested out zigbee and mqtt, I felt ready for my actual use case -- curtains. I live across the street from a major parking lot, and they have floodlights on all night. To sleep, I need blackout curtains. The problem is, it's pretty hard to wake up with blackout curtains drawn.

My solution was to get some smart curtains, and have them automatically go down at the end of the day, and go up in the morning.

 Smart curtains from IKEA
Smart curtains from IKEA

This worked fine, after I got the curtains set up. I've completely forgotten about them, which is exactly how I like my home automation--I want to never think about it. For more about how to set up IKEA smart curtains, see my notes. It comes with 6 manuals.

blinds controls my blinds via the computer, and mqtt2mqtt allows my IKEA remote to control them too. cron and heliocron automatically open and close the curtains on a timer.


I worked on monitoring power usage via my circuit breaker with current transformers and the circuitsetup ESP32 energy meter but it's currently stalled. The main problem is that I can't fit the CTs into my circuit breaker. If I get it working, I'll post an update.

Tagged ,

Hack-a-Day, Day 05: Milling an Aluminium Soma Cube (FAILED)

As on day 02, I tried to make a soma cube, this time milling it out of aluminium on a milling machine.

 The Soma Cube is a 3D, tetris-like puzzle -- picture credit 2ndlook.nl
The Soma Cube is a 3D, tetris-like puzzle -- picture credit 2ndlook.nl

I picked up some aluminium from a local supplier, and headed to Hive13, the local hackerspace, to use their milling machine.

 The Hive13 metal mill
The Hive13 metal mill

After about 7 hours, despite hard work, I had almost finished cutting the blanks, and that was it. Milling is no joke, especially for a beginner!

 correctly sized blanks to make the pieces
correctly sized blanks to make the pieces

And had to call it a night, both because I was tired and because the weekly meeting was starting. I was feeling pretty rough after this one -- three, nearly four failed projects in a row is not a great start to a hackathon.

Tagged ,

Hack-a-Day, Day 04: Project L.E.M.B.A.S. (FAILED)

Today's project was to make a healthy, shelf-stable food that I could eat every day, and take care of meals for the rest of the month. In the process, I realized my initial goals didn't quite make sense, and I also (again!) ran out of time. But I made a little progress.

First, I spent a couple hours researching foods like what I wanted to make. I started with "survival" foods -- hard tack, military rations, disaster food, pemmican and wasna. Commons themes I saw were:

  • The foods lasted a long time
  • They were cheap to make (then, not now)
  • They were dense (physically compact) and could stand being thrown around
  • They were high-calorie.
  • They didn't need cooking, and often you could get by with no heat or utensils if needed.
  • They were something people would eat (and often, the bare minimum standard)
  • They contained some reasonable macronutrient balance, although usually not an ideal one
  • They were often meat-heavy

Then I branched out a little to other calorie-dense foods:

  • Trail mix
  • Fudge
  • Energy bars, meal squares, and granola bars
  • Biscotti

I started realizing my goals didn't quite align with what I was seeing. I didn't really need my food to last years -- one month outside a fridge would be fine. I cared a lot more about taste. And eating calorie dense food was not really a great idea, as someone mostly sitting in a chair rather than than hauling gear cross-country all day.

I did a circuit of local stores -- a grocery store, a restaurant supply store, an indian grocer's. I also picked up enough frozen food at Trader Joe's to last me most of the month, rather defeating the point. Oops!

I came home with a lot of flours and flour-adjacent things. Very carb-heavy. I had several flours: corn, chickpea, and wheat. I ground up a few more.

 grinding dried peas into flour
grinding dried peas into flour
 one jar of peas makes one jar of flour
one jar of peas makes one jar of flour
 completed flours. quinoa, chickpea, corn, green pea, oats, lentil, pigeon pea
completed flours. quinoa, chickpea, corn, green pea, oats, lentil, pigeon pea
 chocolate chips, coconut, cheese, sausage, flax, sunflower seeds, sugar, shortening, and boullion
chocolate chips, coconut, cheese, sausage, flax, sunflower seeds, sugar, shortening, and boullion

At this point, I had a wide variety of cheap ingredients. I went to the USDA food database and wrote some notes about macronutrient balance, and did the math on how much things cost.

Then, I started experimenting. I had previously made hard tack, which I found kept forever and I liked pretty well. So I started by experimenting with hard tack, using non-wheat flour recipes. I was worried (rightly so) that non-wheat flours would not hold together as well.

 experimenting with non-wheat flour ratios
experimenting with non-wheat flour ratios

I tried ratios of quinoa and wheat flour, and also tried adding a few ingredients. I found that 1 part in 3 of wheat flour was plenty to hold things together--it just wouldn't be puffy any more. That seemed fine. I also discovered that it was really important to aim for a consistent thickness, because some of the pieces ended up soft and some hard or burnt. Luckily, non-wheat flours are a lot springier, so this was easier in the second batch.

 experimenting with ingredients -- 23 tests total
experimenting with ingredients -- 23 tests total

In the second batch, I kept the same 1:2 ratio, but tried a wide variety of flours, as well as the rest of the additives.

My findings, and my ending point for the night:

  • A 1:2 ratio of wheat flour to another flour seems to consistently hold together well. The amount of water needed varies just a little. The squares cook with 20 minutes per side.
  • Quinoa, green pea, oat, and chickpea flours are neutral to good. Corn and wheat flours are excellent. Lentil flour smells too strongly. I forgot to test pigeon pea or make rice flour.
  • Coconut (un-powdered) is also excellent. I like the smell and a little fat. Shortening was not as good, and I didn't test other fats.
  • Adding extra salt didn't change the flavor.
  • Adding fat (via coconut or shortening) makes the wafers a little messier.
  • Sugar is great. Whether a dusting on top, a little added, or chocolate chips, it's a definite winner. Sugar mixed in should improve shelf life.

I was originally trying to invent a single food I could eat every day, which if you know me was a very stupid mistake. Instead, I'm going to have the final version be something more like my experiments--a wide variety to pick from.

If I continue another day (and I likely will), I'm going to further optimize taste. The most compelling result of all is that I didn't eat the leftovers--I went for frozen food instead.

Tagged ,

Meal Squares 1.0 Recipe

I like a meal substitute called Meal Squares. The company recently switched from version 1.0 to version 2.0. They're basically different products in terms of taste and texture, although they're both trying to be complete, whole-food squares.

 Meal Squares 1.0 on the left, and 2.0 on the right
Meal Squares 1.0 on the left, and 2.0 on the right

1.0 are bready, don't keep as well, and aren't as appetizing. 2.0 has more of a snacky, fruit-leather feel more typical of meal replacement bars. Personally, I prefer the 1.0 version (snackable is a negative for me).

The CEO, Romeo Stevens mentioned during the new product launch:

We'll be open sourcing the 1.0 recipe for those who want to bake them at home.

After emailing him a reminder that it wasn't posted anywhere, he kindly emailed me the recipe back. I'm posting it online for anyone else that wants it in the meantime. Thanks, Romeo!

Meal Squares 1.0 Recipe (.txt version)

Makes: 24 squares ( 4-square silicone mold available from Michael's )

Date syrup

  • 225g Date paste
  • 120g Vegetable glycerin
  • Small amount of water if needed for consistency

Liquid:

  • 5 eggs
  • 1.5oz Orange juice concentrate
  • 2 cups Evaporated milk
  • 100g Applesauce (unsweetened)
  • 100g Pumpkin puree
  • 135g Coconut oil
  • 77g Olive oil

Dry:

  • 500g Oat flour
  • 300g Whey protein concentrate (unflavored)
  • 200g Chocolate chips
  • 160g Sunflower seeds
  • 135g Rice bran
  • 85g Carrot powder
  • 20g Garbanzo bean flour
  • 25g Iodized salt
  • 5g Sunflower lecithin
  • 5g Pumpkin spice
  • 2g Baking soda or 8g Baking powder (warning! Baking sodas vary quite a bit by brand and whether it includes aluminum, we used the less potent aluminum free baking soda for mealsquares, experimentation needed for small batches.)

Optional:

  • 15g Potassium citrate (can be omitted for small hit to potassium content)
  • D3+K2 drops (varies by brand, add enough for ~500% your DRI since this is about 5 days of Mealsquares)
  • Liquid calcium folinate (same as above)
  • Niacinamide (same as above)
  • Lactase (added to condensed milk if lactose intolerant)
  1. Over low heat, combine date syrup ingredients. Stir until homogenous.
  2. Mix liquid ingredients, including date syrup.
  3. Mix dry ingredients.
  4. Combine wet and dry ingredients. Consistency should be like peanut butter or slightly thicker. Add (small amounts) liquid water if too thick.
  5. Bake at 350, time varies wildly by oven design, and edges may overcook while centers undercook. You will likely need to pull them out of the oven at the 2/3 baking point and flip the molds around to avoid this and get even results.
  6. Packaging: remove as much air as possible to avoid them going stale in the fridge.

Notes:

This recipe could likely be optimized with the substitutions of some milk protein powder for condensed milk and some tapioca syrup for vegetable glycerin. These optimizations were only discovered as we were moving towards production of Mealsquares 2.0 so were never implemented in 1.0. Would require experimentation for water content and baking times etc.

Tagged

Hack-a-Day, Day 02: Acrylic Soma Cube (FAILED)

 The Soma Cube is a 3D, tetris-like puzzle -- picture credit 2ndlook.nl
The Soma Cube is a 3D, tetris-like puzzle -- picture credit 2ndlook.nl

Today I tried to design a laser-cut set of Soma cube pieces. The pieces (shown above) are (conceptually, and sometimes actually) made of 3D blocks glued together.

I've seen a particular style of joinery for acryllic, called finger joints. Those looked easy to cut and easy to put together (if hard to design).

 Acrylic box made with finger joints -- photo credit txoof
Acrylic box made with finger joints -- photo credit txoof

I wrote a python script that takes a description of a piece, like this:

Piece E
xx x-
x- --
-- --

And draws all the flat faces I need to cut.

 Flat faces for the soma cube
Flat faces for the soma cube

I was already running far behind, time-wise. I ran out of time before I could get the joinery working. Honestly, I don't think I'm very close, either.

 Finger joins drawn incorrectly with turtle graphics
Finger joins drawn incorrectly with turtle graphics

How to do a three-piece corner join was especially confusing me.

Tagged

Hack-a-Day, Day 01: #ircpuzzles player

I wrote a player for #ircpuzzles, a yearly puzzle hunt hosted on IRC. Many people who might like to try the puzzles don't know how to use IRC. So, now you can replay past years online.

I didn't have time to finish this one. It only has one year, and is missing a little polish. I'd call it about 80% done. It worked as a warmup for hack-a-day, my yearly project to complete one project a day in November.

Demo is here. Source is on github.

Tagged ,

Making a decorative scroll

Ingredients needed:

  • Foam paintbrush (Home depot, $0.80)
  • Black tea (I used Meijer brand, 100 bags for $2.50)
  • White flour (for multiple-page scrolls)
  • At least one cookie-baking sheet

Optional extras:

  • Gold washi tape, or other decorative tape ($8)
  • Ribbon ($15 for 36 colors) to tie the scrolls shut
  • Wax ($10), and a seal ($8), to add seals to the scroll
  • Lathe, hand saw, dowel rods ($5 for 1" x 4ft / 25mm x 1.3m), paintbrush ($3 for 20), stain ($8) and varnish ($17) to make your own holding rods. If you don't have a lathe, see other suggestions.
  • String ($3-7 for 500ft / 200m) or steel rope ($43 for crimping tool, $13 for cutting pliers, $22 for 1/16 inch x 300ft / 1.5mm x 100m rope) to hang the scroll
  • Paintbrush ($3 for 20) and stencil ($7-$15) for decorating the back

First, I aged the individual sheets.

  1. Soak 8 black tea bags in 2 pints boiling water. Let it sit at least 10 minutes.
  2. Print the paper you want to stain.
  3. Dip the foam paintbrush into the tea. Let large, splashy drops fall onto each piece of paper. Cover 30-50% of the paper. Leave it out until dried (several hours). This is the slowest step, but yields a pleasant, uneven look. For an even better look, place a teabag on the paper repeatedly, then let it dry, then repeat again in the empty spaces and let it dry again.
  4. Take each dried sheet, and place it on a cookie tray. Again dipping the brush in tea, paint over it several times, making sure to cover the whole sheet. Use varied directions for brushstrokes. You may not be able to see any visible stain. You don't need to soak it fully, but you can.
  5. Take the cookie sheets, and place them in the oven. I baked them for 250°F for 6 minutes. This was just enough so the sheets were dry to the touch. This not only dries the sheets faster, but activates the tea and makes it take on a much darker tone.
  6. If desired, you can paint a second pass on the back--the tea will only stain one side at a time deeply. I recommend doing the back second, because each bake makes it a little darker.
  7. Press sheets flat under a large, heavy book.

In theory I think you can iron the sheets flat. If I did this project again, I would try it. It's hard to line up and glue wavy sheets.


I tried painting on the back, using a paint I made myself. I wanted something subtle, like the faint patterning on decorative paper. I tried tempura paint, using coffee in place of water, and flour-based tea paints. I got something that looked how I wanted.

 a tea-based painting
a tea-based painting

I liked the effect, but I had a hard time reproducing the paint the next day. If you want to experiment, my recipe used something like 1 bag of tea, one cup of water, and about 2 Tbsp flour.

 a tea-based paint with 8 bags of tea
a tea-based paint with 8 bags of tea

Next, I glued together the sheets to make a continuous scroll. For reasons you'll see later, I needed an extra strong glue. So as my first step, I made wheatpaste glue, which is very strong.

  1. Combine in a paper bowl:
    • 25g flour
    • 75g water
  2. Stir thoroughly with a fork.
  3. Microwave for 1 minute, then stir again. Repeat.
  4. Once it's thick enough you have a harder time moving a fork through (2-3 minutes with my microwave), let it cool.
     wheatpaste glue. cooking it too long made it rubbery and lumpy.
    wheatpaste glue. cooking it too long made it rubbery and lumpy.

I glued together the sheets with wheatpaste. For some projects, it's easier and better to apply warm. But my paper was already fragile from the aging process, so I found it worked better all the way cooled.

I took a fingertip of glue, spread it evenly on the bottom of the page. Repeating, I covered the whole bottom. Then, I placed the next sheet over it, and laid them down so they matched. Since the aging process warps the paper, you may not get a perfect fit.

Then, use the pad your your thumb to press the sheets together firmly. Make sure to use rolling motions, don't drag your finger along. That can tear the paper.

 gluing two pages at a time
 assembled 6-page scrolls

My research suggested Zip Dry paper glue might also work.

As a fun fact, real scrolls were made by gluing together sheets, and they actually used wheatpaste glue! Scrolls were often glued left-to-right (volumen) instead of top-to-bottom (rotulus), but I thought the fantasy stereotype was more fun.


After the glue hardened, I cleaned off both sides and trimmed the edges to match exactly. Then I applied a gold tape on the edges. I had decorative borders printed already, so it was relatively easy to get tape pieces to match. I found the key was to go slow, and use many pieces of tape. After laying one down, I pressed it smooth with the back of a fingernail, flipped it, and did the same of the back. The washi tape I'm using is relative easy to remove again, but also shows defects pretty clearly.

 applying gold washi tape
applying gold washi tape

I turned dowel rods to hold the scroll on my lathe. The middle segment is the width of a piece of paper. Then I added as much decoration as I could on each end, but my lathe is very small, so not much fit.

 dowels turned on a lathe

Then I stained and finished the dowel rods.

 applying stain to turned dowels

If like most people you don't have a lathe, you could glue something decorative on the ends of dowel rod pieces, cut bamboo segments, or decorate a paper towel roll.

It's also totally fine to just roll up the scroll and tie it closed with string or ribbon. No holders are really needed.


I made another batch of wheatpaste (much better this time).

I glued the scroll onto the dowel on the two ends.

 gluing with a full wrap
gluing with a full wrap
 finished glue with a half wrap
finished glue with a half wrap

The glue was very strong, but the ends only look okay. I trimmed the last couple inches of washi tape so the glue would stick.

If I did the project again, I'd try to keep the sheets flattened (wrinkly sheets after aging causes all kinds of problems). I'd also leave a little blank space on the top and bottom for attaching them to the rods.


 an example loop end
an example loop end

I picked up some stranded steel rope, which I turned into a line with two loops at the end.

I looped them over the holes in the dowel. Voila! Now you can hang the scroll on the wall.

It's possible to make the wire hangers secure, but removable. For the first couple I made they're just secure--those suckers aren't coming off.


I dripped wax on the scroll and pressed down a seal I got on Amazon. It matches the theme of my D&D game very well, I was happy with how it looks.


The final scroll looks amazing.

 one wire hangs the whole scroll
one wire hangs the whole scroll

One one hanger, it takes up the wall.

Between 6 pages and a dowel rod, that's why the glue between pages needed to be so strong!


 two wires show parts of the scroll
two wires show parts of the scroll

By using two sets of hanging wires, you can show part of the scroll without taking up the whole wall. Here I'm showing the top of the scroll.

You can roll one dowel as you unroll the other, to show any part of the scroll. That's why long scrolls have two rods. It's also where the term "scrolling" up and down on a computer comes from.


I let each player pick the color of the wax for the seal and decorative ribbons. They didn't know exactly what they were giving me colors for.

I'm sure my players will love them!

By the way, if you're curious about the contents, this is a prophecy the players found in parts around the world. Underneath each of the 50 lines, are their player notes about where they found each piece. It's a souvenir for a campaign which ran for about 2 years, and is finally wrapping up.

Tagged , ,

Making my own scratch-off cards

My family and I have been playing Curse of the Dark, an "escape-room" style board game. We recently reached the halfway point, where they recommend taking a break--it's supposed to be two 90-minute play sessions (spoiler: we are on month 6).

Included with the box is an answer sheet, which include scratch-off hints. (You might also be familiar with them from lottery tickets.) You scratch off the grey stuff with a penny, and underneath is the hint. I idly wondered if you could do that yourself.

 scratch-off hintbook
scratch-off hintbook

I found several people online repeating this recipe:

  • 2 parts silver acrylic paint (I used 5 parts white, 1 part black)
  • 1 part dish soap
 measuring homemade scratch-off paint

They recommended 2-4 layers to make it opaque. I gave it a try.

 paint does not scratch off from paper
paint does not scratch off from paper

So visually it looked pretty good. But scratchable, not so much. It was hard to get off, and the paper tore when I scratched harder.

Randomona did some experimentation, and had better luck with all types of paint. Turns out it works way better if you add a layer of plastic, such as tape, rather than applying to paint directly to paper or cardstock. This makes sense since the stickers are basically a thin layer of something on tape. And sure enough, when I looked at the 2-3 other tutorials I read, they all said to apply tape first. Whoops!

I would discover this only later, pictures are later in the post


I decided to give "the reveal" a try with small square post-it notes (50x50 mm, about 2x2 inch).

 random chores and rewards for doing them
random chores and rewards for doing them

These were okay. But

  • not many fit on a page
  • post-its aren't very fun to take off
  • sometimes I had to use two notes, or you could see through
  • my local store doesn't sell the full-sticky post-its, so you can peek if you really wanted. (I'm not sure if they still make full-sticky, and I don't think they ever did in mini size)

By the way, you can print your own using my bad generator. If you want less than 15, just leave some boxes blank and don't cover them with a post-it.

Next up, I bought some! They sell premade scratch-off stickers. They are available in 50x50 mm, but I went half that size--I'd rather have more on a page.

Mine came in a roll of 1000 stickers for $10 (that's 1 cent per sticker). You can get circles or squares--I picked squares.

 scratch-off with storebought stickers
scratch-off with storebought stickers

Here you can see my scratch-off chores card. It was a lot more fun. I wrote a better second generator you can use to print your own. Up to 88 can fit on a page, and it will shrink the grid if you have less.


Finally, I tried the homemade acrylic paint method a try, with tape this time.

 comparing all the tests
comparing all the tests

I'd say the stickers scratch off best, followed by the recipe mentioned on tape. I tried more dish soap and no dish soap, and they were both worse. I suspect less dish soap would work better.

You can write on the stickers fine, or the acrylic, but the dish soap recipes scratch off if you try to use a pen on top.

Tagged

Word Sequences

What's the longest sequence of words you can make, beginning with any word and adding one letter at a time, if each step must also be a word?

If you can add them only at the end, a computer search outputs the dubious:

co
com
comp
compo
compos
compose
composer
composers

Adding letters only at the beginning I get the equally doubtful:

es
hes
shes
ashes
lashes
plashes
splashes

If you add can add letters on either end, I found this valid 10-letter sequence:

I
in
tin
ting
sting
siting
sitting
slitting
splitting
splittings

My personal favorite, allowing rearranging letters, yields this whopping 15-letter series:

I
it
tie
rite
irate
attire
cattier
interact
intricate
recitation
ratiocinate
ratiocinated
accreditation
contraindicate
contraindicated

The above answers found using a python, and the GNU aspell dictionary. Words containing ', -, or capital letters were removed.

Tagged