June 10th 2020

I’ve been working on a Raspberry Pi system to shoot a year long timelapse of the garden.

I did a couple of 24 hour test timelapses. The first trial was super simple, I had the camera shoot a photo once a minute. I discovered that the Rasberry Pi camera’s auto exposure didn’t work well at night. The night photos were completely dark so I cut most of them out.

For the second trial I wrote some python to check if the auto exposure gave a correctly exposed result, and if not the program would increase the exposure until it hit the camera’s maximum of 6 seconds at 800 iso. (I was also experimenting with HDR which is why this clip looks particularly bad.)

raspberry pi timelapse camera in eaves of shed

After getting things working more or less I built a basic enclosure for the camera and Rasberry Pi out of a take-out soup container. I spray painted the whole container to protect it from UV, and then cut the bottom off and siliconed a lens filter onto the bottom of the container. This all got jammed under the eave on the shed.

Right now the camera shoots a photo every 20 minutes night and day. Which doesn’t sound like a lot until you think about 3 shots an hour, 24 hours a day time 365 days or 26,280 photos. Each photo is about 5.3mb, so a year of photos will take up about 140gb. I’m guessing that processing the photos will take 2-4 times as much space since there will be several intermediate processing steps.

At this point I have a couple of weeks of photos. Processing the images to make a pleasing result is hard. The images during the day flicker like crazy from the sun going behind clouds, and the night photos are super dark until a car headlight shines into the yard or the moon comes out. The camera shifts very slightly too, I assume the plastic of the container is changing size slightly in response to temperature changes, or maybe the shed is wiggling slightly in the wind.

This is my current processing pipeline:

  1. ImageMagick command takes each frame, and tries to smash it’s histogram into a theoretically correct exposure, but it’s super harsh, so I average the original image with the corrected image:
    convert input.jpg ( +clone -equalize ) -average output.tif
  2. Then I run each frame through Fred’s ImageMagick script removecolorcast. This gives everything a flat blueish tone, but the images are much more consistent:
    removecolorcast input.tif output.tif
  3. I run all the frames through After Effects’ stabilize motion.
  4. To deal with the remaining flickering I average the images. I’m currently averaging batches of 12 images, so images 1-12 get averaged, then images 2-13, 3-14, 4-15, and so on:
    convert 0000.tif 0001.tif 0002.tif 0003.tif 0004.tif 0005.tif 0006.tif 0007.tif 0008.tif 0009.tif 0010.tif 0011.tif -average final_0000.tif
  5. All of the images get tweaked with Adobe Camera Raw. I’m cropping, resizing, fixing the color, sharpening, etc.
  6. Finally frames are made into a video with FFmpeg:
    ffmpeg -i %04d.tif -crf 15 final_video.mp4

This is the full set of timelapse photos processed into a video:

I like where this video is going, but I find the changes from day to night to be kind of off putting after a while. Also, the strobing effect of the light moving across the yard is pretty neat the first couple of times, but gets hard to watch.

I wrote some code to select a few photos from each day about 90 minutes before solar noon and then ran the same processing pipeline. It worked okay, but the light still changed more than I liked. The clip is about a second long, so it might look better when I have more photos.

So, I wrote some code that picked images that were relatively low contrast and really close to the same medium brightness. This cut my images down from ~1500 to ~250. I then ran the same processing pipeline on it, and got this result:

I’m pleased with this, but it still needs some refinement. Once I have a few months of photos I think I’ll have a much better handle on what the final product will look like in a year.


May 14th 2020

I read all the Oatly patents (Sarah translated the Swedish one) and watched videos and read the whole Oatly website. The key piece of information missing from the previous recipe I made is that Oatly uses a couple of enzymes to convert starch in oats to sugars.

home made oatmilk in coffee

All of this oat research excited Sarah and we’ve been working together to design the perfect oatmilk. We want something slightly sweet, with the thickness of whole milk or cream, and it has to be great in coffee — no splitting!

The American Oatly patent has a sample recipe with huge quantities — in summary:

  1. Steam dehulled oats.
  2. Wet grind the oats at 129F (54C).
  3. Add water plus alpha amylase, beta amylase, and protein-glutaminase enzymes.
  4. Cook at 133F (56C) for 2 hours.
  5. Heat to 203F (95C) to deactivate enzymes.
  6. Cool to room temperature and decant.
  7. Dilute with water, then add oil, vitamins, salt, and various calciums.
  8. Pasteurize and package.

With the ingredients list from my previous trials and the patents we started to design a recipe.

We looked at using enzymes directly, but decided to try using malted barley. Malting grains make alpha and beta amylase. Plus malt is easy to get from brewing suppliers. (We do have some enzymes on order for testing too!)

Data from brewing charts suggests that we do a one hour cook at 148F (64C) for the beta-amylase, a second cook at 158F (70C) for the alpha-amylase, and at the end we bump the temperature up to 197F (92C) which denatures the enzymes. (We are using 197F/92C because that’s the max temperature of the immersion circulator we own.)

After a few trials we had a breakthrough when we found out about toasting the oats before processing them. It really lowers the oat smell and gives the resulting oat milk a light pleasant roasted flavor.

Our Current Recipe

This recipe compares favorably to Oatly, and is better than the other commercial oat milks that we have tried. We met all of our oat milk goals, but it could always be better, so we’re still experimenting. Watch out for updates.

This recipe makes a batch of about 17oz (500ml) after filtering and takes approximately 3 hours (which sounds long, but it’s mostly waiting).

Malted Barley6
Canola/Rapeseed Oil18
  1. Pre-heat the immersion circulator bath to 148F (64C).
  2. Toast oats in the oven at 250F (121C) for 8 minutes.*
  3. Add oats and malted barley to water.
  4. Blend until fine; add mixture to a 1 quart (~1 liter) Mason jar.
  5. Put the jar in the water bath at 148F (64C) for 1 hour; shake the jar every 15 minutes.
  6. Increase the water bath temperature to 158F (70C) and cook the oat mixture for an additional 1 hour; shake the jar every 15 minutes.
  7. Increase the water bath temperature to 197F (92C). Once the water bath reaches temperature, wait 10 minutes to ensure that the oat mixture has come up to temperature too.
  8. Remove the jar from water bath and allow to cool to ~110F (43C). Temperature isn’t critical here, cool enough so you don’t burn yourself.
  9. Filter the oat mixture through a mesh kitchen strainer, and then through a reusable gold coffee filter.?
  10. Blend the salt and oil into the filtered oat mixture. If you see oil floating on top of your oat mixture blend more.
  11. Chill & drink!

weighing barley and oats
oat milk sample with cups

*Depending on the kind of oats the toasting time might be different. We suggest doing a test toast of the oats that you’re using. Preheat your oven to 250F (121C), put some oats on a cookie sheet, and set a timer for 4 minutes. At 4 minutes open the oven grab a few oats, close the oven, and set your timer for another 4 minutes. Taste the oats; when they’re done they will have a hint of roastiness with no bitter/burnt flavor. Repeat until you figure out the perfect roasting time. Different brands of oats have required between 4 and 12 minutes. Instant oats seem to need longer, while fancier non-instant oats need shorter times.

?This filter combination seems to be sufficient; it doesn’t leave sediment in the oat milk and is much faster than paper coffee filters or kitchen towels. Protip: for faster filtering slowly run a spoon over the inside of the gold coffee filter move the filtered material out of the way.


May 6th 2020

My mom showed me how to make biscuits many years ago, and I’ve been trying to get better at it. This is my current recipe– it’s based on the Alton Brown recipe with some tweaks:

4teaspoonsBaking Powder
1/4teaspoonBaking Soda
1/3teaspoonCitric Acid or Other Acid
bisciuts and honey and butter

Mix the flour, baking powder, baking soda, and salt very thoroughly. The leavening agents need to be evenly distributed.

Cut the butter into about 10 pieces, drop it into the flour, and use a pastry cutter to cut the butter into pea-sized pieces. Then rub the butter/flour mixture between your hands, start with your palms together and swipe one hand’s palm down towards the other hand’s fingertips. Picture a motion like you’re trying to get something really sticky off of your hands. Do this until most of the pea sized pieces of butter are flattened.

biscit cut in half reavling crumb

Mix the citric acid into the milk. The milk should immediately feel a bit thicker and coat a spoon.

Pour the milk into the butter/flour mixture, and mix as little as possible to incorporate most of the dry ingredients into the wet. It’s much better to have some dry left in the bowl than it is to overmix.

Dump the dough out onto a lightly floured countertop, sprinkle a bit of flour on top of the dough, and pat the dough to 3/4″ thick. I use an Aeropress to cut my biscuits, but you could also use a 2″ or so biscuit cutter or a cup with straight sides.

When you’ve cut as many whole biscuits out as you can, reform the dough and repeat. Try to work the dough as little as possible. Any manipulation will make the biscuits tougher.

Transfer your cut biscuits to a cookie sheet or baking stone and bake for about 15 minutes at 425F. Watch for the top of the biscuits to go golden all over with a bit of golden brown.

Reverse Engineering Oatly

April 25th 2020

I’ve really come to love the Oatly Barista Edition Oat Drink. Since I’m stuck at home and I’ve run out of Oatly, I’m working on replicating it. I started by doing a review of oat milk recipes online to figure out the oat to water ratio. The average is close to 1:4. Interestingly, the ingredients on the international Oatly website give the oat ratio at 1:10

Unfortunately the recipes procedures don’t match up as well. Some recipes suggested soaking the oats; others said that would make the oat milk slimy. Some said that rising the oats after soaking would make the oat milk not slimy. Other said that overblending would make the oat milk slimy. I guess the takeaway is that sometimes oat milk is slimy.

Armed with the ratio, I made a batch of oat milk for my morning coffee. It was underwhelming. It broke apart and looked a bit like miso soup, which Oatly never does.

I reviewed the Oatly recipe, and saw the second ingredient was rapeseed oil (aka canola). I used the same ratio of oats, but added some canola. The canola helped the mouthfeel, and tamped down the oaty flavor somewhat. Two pinches of sugar in my coffee mug with the coffee and the oat milk wasn’t bad. Though it wasn’t as good as Oatly.

I really needed to figure out what Oatly is doing. I turned to the ingredients list and nutrition facts. With some detective work I should be able to determine what the recipe ratios are. I think my ratios for oats, water and canola are pretty close. I’m pretty certain that Oatly needs Dipotassium Phosphate. I’ve made a guess on the amount based on the nutritional facts showing potassium and phosphorus.

I’m currently sourcing food grade Dipotassium Phosphate for my next experiments. I also wonder if there’s a secret processing step that Oatly has up their sleeve.

Ingredients by Weight for 100ml
Ingredient Amount Units Purpose
Water 87.1 gr ingredient
Oats 10 gr ingredient
Rapeseed Oil 2.3 gr ingredient
Dipotassium Phosphate 0.5 gr ingredient
Calcium Carbonate     vitamin
Calcium Phosphates     vitamin
Iodised Salt 0.1 gr ingredient
D2     vitamin
Riboflavin     vitamin
B12     vitamin

I’ve noted which ingredients I think make functional changes to the recipe and which I think are added just as vitamins.

Update: Don’t miss part two of the project!

Adaptoid n64

April 17th 2020

I bought an Adaptoid in about 2003. It’s a really great n64 to usb adapter for playing emulated n64 games. For some reason there are a couple of of these on Ebay for $600-700; the folks on Ebay talk about reverse engineering.

I’m going to look into reading the code off of the microcontroller, but for the time being here are some photos of the device disassembled.

It looks like the Wish Technologies website went down around 2009. I did find this website which seems to have some code available for interfacing with the Adaptoid.

Next Page