Wednesday, March 09, 2022

Curse you, munmap_chunk()!

 I still haven't spotted a working solutionto the problem where weather station programs in Python on Raspberry Pi fail, with no traceback details, after a couple of days.

I think it must be some resource in either the operating system, or the Python interpreter, running out, with very poor error reporting. I will leave it to people more familiar with the OS and interpreter to find out what it is, and fix it, in the fairly certain knowledge that everyone who could fix it has better things to do.

I found out that a Python program can actually restart itself, and changed mine to restart once a day. If that doesn't fix it, I'll let you know...

#RaspberryPi #Python 

My Stack Overflow comment on this.

Wednesday, March 02, 2022

Tofu squeezing

Tofu - a thing you need to know...

I tried cooking tofu several times, and was often very disappointed by the way it just broke up, and fell apart, when I tried. The results I got were nothing like the lovely illustrations people put by their recipes. Instead of pert, bouncy cubes of tofu, all I got was mush...


It tasted fine, sure, but something was wrong...


There's something they don't tell you in those recipes, and it's this. Tofu is basically ground up soybeans, and water. Actually, quite an astonishing amount of water! There are several grades of tofu, and the ones labelled "extra firm" have less water. Less, sure, but still a lot. You want to know how much? Look!

I treated myself to a tofu press from eBay, ignoring the ones with a wimpy little spring to do the pressing. It came with a piece of cheesecloth to wrap the tofu block in, which I did, but I had to find a usable weight. I did try balancing cans on top of the press, but eventually, I found my wife already had a suitable weight for the job...

Tofu in a press with a 6Kg weight on it and a jug with the water that squeezed out of the block.
Those standard size boxes of tofu contain over 175ml of water! Get it out, and you can cut the tofu into cubes, marinate it in something tasty, which will soak right into where the water used to be, and fry them without them falling apart. Instead, they crisp up nicely on the outside, and more importantly, they stay together as cubes.


Feel free to thank me...


Duck and Mushroom ramen.

 

Duck and fancy mushroom ramen

Well, it's what I made from the remains of the Sunday dinner duck, with the addition of some fancy mushrooms, home-made naruto and more.

There's no helpful tip, or anything like that, with this post, so you really shouldn't


Monday, February 28, 2022

Can you cook Whitebait in an air fryer?

Can you cook Whitebait in an air fryer?

I just asked Google for the answer to this, and was annoyed to find that not only did there not seem to be an online answer, but there were an irritatingly large number of websites that posed the question, and then answered an entirely different one.

I gave up looking, and instead carried out a scientific experiment...

Some frozen whitebait

Here are some frozen little fishes...

Basically, I just heated the air fryer to its maximum, nominally 200°C, and threw the fishes in.

Five minutes seemed like a good guess for a cooking time. They were a bit underdone.

I set the timer for another five minutes, but pulled the fish out after four minutes, as I could hear some of them popping!






Cooked Whitebait fresh from the air fryer
Here are five of them, nice and crispy on the outside, just before I ate them with tartare sauce. 

So, now you know...

You CAN cook whitebait in an air fryer.






Was this useful?

Wednesday, June 02, 2021

Greenhouse computer improvement

New sensor!

I was using an MHT22, hanging on wires outside the case, for temperature readings on my greenhouse computer. I wasn't happy with it, as it isn't really compatible with the connections on the Raspberry Pi, and it has a habit of giving occasional absurd readings for no obvious reason.








So, I got myself a Microdia TEMPer-2, from PiHut, which plugs into a USB port. It has a fancy button on it, which activates the sending of text messages or emails, which I shall never be using. It also has an external plug in sensor, which is waterproof, a handy thing in a greenhouse!

It comes with a software mini-disc, which may possibly be useful if you're using it on a PC, whatever they are. (Kidding. I'm writing this on my PC.) There are several web sites that tell you how to program Python to read from it, and it didn't take me long to install the appropriate library on the greenhouse computer, and run the test command, sudo temper-poll. That worked, but then I ran into one of those programming blockages that can send you crazy. None of the various pieces of example code would work, mostly due to my inability to get the necessary permissions set correctly. It didn't matter, I realised, after a lot of head scratching. Instead, I just used Python's subprocess library to run the command that worked...

import subprocess

rv = str(subprocess.check_output("sudo temper-poll", shell=True))
# Split the string, keep fourth block, chop last five characters, make float.
temperature = float(rv.split()[4][:-5])

I'm hoping I won't need to write any more software for the greenhouse for a while. The Raspberry Pi now monitors the temperature, switching the fan heater on if the temperature is below 5°C, uses its fish-eye camera to take pictures at set times for a time-lapse series, and takes a picture if it spots movement. Eventual improvements under consideration are a soil moisture detection sensor, automated watering... Nothing's ever really finished, is it?