Ben's Blog

miscellaneous, self sustainability ben November 29, 2023

Protected: Winter Has Arrived

This content is password-protected. To view it, please enter the password below.

I.T., plotters, web development ben November 19, 2023

And Handwriting for All

I wrote something pretty neat for Plottybot, and for the longest time I thought I should make it available on its own, and detached from the project. Then the most excellent Stuff Made Here guy made a writing machine, and ran into all the issues I ran into which drove me to write my own algorithms for capturing and replaying handwriting. My stuff wasn’t online then and that’s a shame, it was only available by building a Plottybot, or at least using its Pi image. Oh well.

As is tradition, I captured my kids’ handwritings as I do every year some time in the Winter. But this time I made sure to have the new site ready before Thanksgiving so that people could use it as they went and met with loved ones.

So here, this site serves the purpose of capturing one’s handwriting. It supports cursive, character variations, saving, and finally exporting to SVG & GCode. Hopefully this means you can use it with your favorite craft machine for the coolest of personalized projects.

https://ben.akrin.com/plottytools/

I.T. ben November 07, 2023

Pi Zero W to Pi Pico W

We’re finally able to get our hands on some sweet Pis after a long shortage. I got a Pi Pico W because it’s just that cheap, why not? It’s the W that really makes the difference; years ago I went from full Pis to Pi Zeros because the Wifi capabilities meant I didn’t have to worry about USB dongles. Everything I do tends to be Wifi connected so not having it makes a board irrelevant. And so with a W next to the Pico’s name, I’m definitely interested. It’s pretty smart of the Raspberry Pi foundation to put in this functionality into a microcontroller, it’s just enough to get me curious in what I could actually do with it.

Now I have to get over the barrier of not having a fully fledged OS (and the sweet package managers with all the Debian packages that comes with it), but with Wifi I can definitely do some tasks with a Pico I’m usually doing with a Zero. So I figured I’d try replacing the house temperature sensor and see how that goes. I initially tried to use the Pico’s built in temperature sensor, but it’s terribly inaccurate so I did rewire the DS18B20 from the Zero to the Pico.

Brain transfer, The size gain is nice but not particularly significant

Coding was a breeze, there is isn’t much to say about that, but if you’re interested, here the code I’m running for a web server I can ask for current temperature. One thing I learned is that you need to make sure you have a “lib” directory with libraries you might need for your code.

import machine
import time
import network
import socket
from machine import ADC
import machine, onewire, ds18x20

html = """{\"house_temperature\":<TEMPERATURE>}"""

led = machine.Pin( "LED", machine.Pin.OUT )

ds_pin = machine.Pin( 17 )
ds_sensor = ds18x20.DS18X20( onewire.OneWire(ds_pin) )
roms = ds_sensor.scan()
print( "Found DS devices: ", roms )

ssid = "<redacted>"
password = "<redacted>"
wlan = network.WLAN( network.STA_IF )
wlan.active( True )
wlan.connect( ssid, password )

# wait for connect or fail
max_wait = 20
while max_wait>0:
    if wlan.status() < 0 or wlan.status() >= 3:
        break
    max_wait -= 1
    print( "waiting for connection..." )
    time.sleep( 1 )

# handle connection error
if wlan.status()!=3:
    raise RuntimeError( "network connection failed" )
else:
    print( "connected" )
    status = wlan.ifconfig()
    print( "ip = " + status[0] )

# open socket
addr = socket.getaddrinfo( "0.0.0.0", 80)[0][-1]
s = socket.socket()
s.bind( addr )
s.listen( 1 )
print( "web server listening on", addr )

# listen for connections
while True:
    try:
        cl, addr = s.accept()
        print( "client connected from", addr)

        request = cl.recv( 1024 )
        print( request )
        request = str( request )
        
        ds_sensor.convert_temp()
        time.sleep_ms(750)
        response = html.replace( "<TEMPERATURE>", str(ds_sensor.read_temp(roms[0])) ) 
        
        led.value( 1 )
        
        cl.send('HTTP/1.0 200 OK\r\nContent-type: application/json\r\n\r\n')
        led.value( 0 )
        cl.send(response)
        cl.close()
 
    except OSError as e:
        cl.close()
        print('connection closed')

I got the libraries online, but here they are in case it’s useful.

# 1-Wire driver for MicroPython
# MIT license; Copyright (c) 2016 Damien P. George

import _onewire as _ow


class OneWireError(Exception):
    pass


class OneWire:
    SEARCH_ROM = 0xF0
    MATCH_ROM = 0x55
    SKIP_ROM = 0xCC

    def __init__(self, pin):
        self.pin = pin
        self.pin.init(pin.OPEN_DRAIN, pin.PULL_UP)

    def reset(self, required=False):
        reset = _ow.reset(self.pin)
        if required and not reset:
            raise OneWireError
        return reset

    def readbit(self):
        return _ow.readbit(self.pin)

    def readbyte(self):
        return _ow.readbyte(self.pin)

    def readinto(self, buf):
        for i in range(len(buf)):
            buf[i] = _ow.readbyte(self.pin)

    def writebit(self, value):
        return _ow.writebit(self.pin, value)

    def writebyte(self, value):
        return _ow.writebyte(self.pin, value)

    def write(self, buf):
        for b in buf:
            _ow.writebyte(self.pin, b)

    def select_rom(self, rom):
        self.reset()
        self.writebyte(self.MATCH_ROM)
        self.write(rom)

    def scan(self):
        devices = []
        diff = 65
        rom = False
        for i in range(0xFF):
            rom, diff = self._search_rom(rom, diff)
            if rom:
                devices += [rom]
            if diff == 0:
                break
        return devices

    def _search_rom(self, l_rom, diff):
        if not self.reset():
            return None, 0
        self.writebyte(self.SEARCH_ROM)
        if not l_rom:
            l_rom = bytearray(8)
        rom = bytearray(8)
        next_diff = 0
        i = 64
        for byte in range(8):
            r_b = 0
            for bit in range(8):
                b = self.readbit()
                if self.readbit():
                    if b:  # there are no devices or there is an error on the bus
                        return None, 0
                else:
                    if not b:  # collision, two devices with different bit meaning
                        if diff > i or ((l_rom[byte] & (1 << bit)) and diff != i):
                            b = 1
                            next_diff = i
                self.writebit(b)
                if b:
                    r_b |= 1 << bit
                i -= 1
            rom[byte] = r_b
        return rom, next_diff

    def crc8(self, data):
        return _ow.crc8(data)
# DS18x20 temperature sensor driver for MicroPython.
# MIT license; Copyright (c) 2016 Damien P. George

from micropython import const

_CONVERT = const(0x44)
_RD_SCRATCH = const(0xBE)
_WR_SCRATCH = const(0x4E)


class DS18X20:
    def __init__(self, onewire):
        self.ow = onewire
        self.buf = bytearray(9)

    def scan(self):
        return [rom for rom in self.ow.scan() if rom[0] in (0x10, 0x22, 0x28)]

    def convert_temp(self):
        self.ow.reset(True)
        self.ow.writebyte(self.ow.SKIP_ROM)
        self.ow.writebyte(_CONVERT)

    def read_scratch(self, rom):
        self.ow.reset(True)
        self.ow.select_rom(rom)
        self.ow.writebyte(_RD_SCRATCH)
        self.ow.readinto(self.buf)
        if self.ow.crc8(self.buf):
            raise Exception("CRC error")
        return self.buf

    def write_scratch(self, rom, buf):
        self.ow.reset(True)
        self.ow.select_rom(rom)
        self.ow.writebyte(_WR_SCRATCH)
        self.ow.write(buf)

    def read_temp(self, rom):
        buf = self.read_scratch(rom)
        if rom[0] == 0x10:
            if buf[1]:
                t = buf[0] >> 1 | 0x80
                t = -((~t + 1) & 0xFF)
            else:
                t = buf[0] >> 1
            return t - 0.25 + (buf[7] - buf[6]) / buf[7]
        else:
            t = buf[1] << 8 | buf[0]
            if t & 0x8000:  # sign bit set
                t = -((t ^ 0xFFFF) + 1)
            return t / 16

Half the amp draw from a Zero

That’s it!

agriculture, self sustainability ben October 24, 2023

Twice Borne

At some point every July we say goodbye to raspberries until next year. It’s a little sad because they hit first and they’re the best, but we’ve got other berries to keep us happy.

This year some of the plants decided to bear twice! We seem to recall some had this in their description, and I guess the season’s been long enough this year that they went for it. It’s a bit surreal to be brought back to the joys of early Summer at the very end of the season when everything is done and being put the bed for Winter. They taste just as good too.

AI, I.T., miscellaneous ben October 04, 2023

Stable Diffusion

I’ve played with Stable Diffusion a few months back, but the learning curve is steep, and easy access to DallE & MidJourney made it not worth it to press on. Until… I got excited about a super cool extension:

https://huggingface.co/monster-labs/control_v1p_sd15_qrcode_monster

I just love the idea of having the same image have one analog meaning to a human and discrete meaning to a machine. And the same extension can be used for general masking other than just QR codes.

Without further ado, here’s the eye candy:

A benign QR code

General masking for an almost subliminal effect

There’s much to be refined in my incantation, but I really like how the mask isn’t just overlayed on top of a drawing in a subtle way, rather it’s the basis for growth of AI hallucinations.

miscellaneous ben October 04, 2023

Of the Past?

Robin found it in a local river bed. It’s still fairly sharp and surprisingly light and well balanced. I have no idea if it is a real Native American artifact or not. For the stories of the past we like to entertain considering its origin, I hope the person who crafted it paused a minute to think of the stories of the future and who would find it. I hope some of the stuff I leave behind make a little boy’s day some time.

agriculture, self sustainability ben October 03, 2023

Keeping Up with the Harvesting

There’s so much harvesting to do in the Fall. Nicole dug up a ton of potatoes while I was making cider.

Then I walked past the orchard and saw a whole bunch of hazelnuts ready to be picked, crap, I don’t even know what to do with them.

I’ll just grab a basket and figure it out later.

nature encounters ben October 03, 2023

Baby Coyote

There’s a couple of baby coyotes hanging out all the time on the upper field. They take off whenever we show up.

Not to ruin a happy baby story, I think they are abandoned, have mange, and I’ve only seen one of them for the last few days :|.

It’s a bummer they’re having a hard time, I’ve rarely seen coyotes even though we hear them all the time, and I was happy to have a few encounters.

apple, self sustainability ben October 03, 2023

Protected: Apple Convoy

This content is password-protected. To view it, please enter the password below.

Lego / Duplo, plotters ben September 07, 2023

Protected: Mindstorm Gondola Plotter

This content is password-protected. To view it, please enter the password below.

apple, self sustainability ben September 05, 2023

Protected: Apple Cider Day

This content is password-protected. To view it, please enter the password below.

miscellaneous ben August 31, 2023

We Fell for the Bubbles

But there was no way we would pay $25 per refill. After some apprehension (I don’t like things pressurized), I got a 10lb tank of CO2 and a gizmo to refill the original cylinders. Works like a charm and promises to be far cheaper per bubble. This might stir me to try carbonating cider, we’ve got a decent apple year ahead.

nature encounters, poultry, self sustainability ben August 18, 2023

Grrrrrr

It’s the second time we have a bear rip open the chicken coop and decimate the flock.

agriculture, self sustainability ben August 04, 2023

Protected: Garlic Out of the Ground

This content is password-protected. To view it, please enter the password below.

aesthetics, plots ben August 04, 2023

For the Sake of Completeness

It finished, 5 days total, looks awesome. Now I need to figure out what to do with such a big canvas, I don’t have a wall big enough for it at home.

With this successful test behind, I pause for a bit until the place becomes busier in the fall. I’ll try various experiments then.

plots ben July 29, 2023

Finish Line in Sight

3 Days of uninterrupted work, it probably needs 2 more. Things have been going well so far, I’m starting to believe it’ll finish without a hitch. I’m swapping pens strategically so they don’t run out.

The cool software I used for this one yields cool artifacts when it renders.

I.T., plotters ben July 28, 2023

Warming Up

I’ve recently gotten the ok to deploy a large gondola plotter in a public place. Theoretically, there is not limit to how large a gondola plotter can be. Practically, there are considerations to how large they get. I’ve been working on solving the various issues that arise from having a 10′ deployment. Of course with the ~20% margin to avoid extreme positions, it’s not 10’^2 drawable. Still though, there are many challenges due to the scale. Finding paper big enough is a challenge, so is moving it without damaging it. I figured out other quirks, it’s boring, let’s skip to the eye candy:

I have several public facing experiments lined up for it over the next few months or years. I’m not in a hurry. This is just a warm up to figure out what it means to deploy it in a public spot. What’s fairly clear though, is that there isn’t much I can do to make this better, and so this may be the culmination of a 5 years development effort.

That’s 3 days of the machine working non-stop, I’m watching the ink level closely and hope it’ll be done in a couple more days.

agriculture, self sustainability ben July 28, 2023

Absurd Amount of Berries

It’s that time of the year we go raid the orchard every day for desert. We could sell some, especially since the price of berries in stores is insane, but that’d be work so we’d rather gift them to friends. It gives them excuses to come over :).

I had never eaten berries until I just couldn’t, it’s so nice to enjoy them without restraint. They also taste much better fresh off the plant. As with maple syrup, producing large quantities of something drastically changes the way you get to enjoy it. I’m not worried about there not being enough for others, or thinking about the expense of it. You can just chug down as many as is enjoyable without afterthought. I’m more worried about making sure the excess doesn’t go to waste.

The chickens clean up the berries that fell on the ground. Sometimes they pick direct from the plants, but not enough to make a dent.

miscellaneous ben July 23, 2023

Protected: Flowered

This content is password-protected. To view it, please enter the password below.

poultry, self sustainability ben July 18, 2023

Integrated with the Flock

We integrated mama chicken and her chicks with the rest of the flock. It went extremely well, I’m not sure what’s different from last time.

aesthetics, plots ben July 15, 2023

42 hour Moth

Some of the mechanical imprecisions of the machine come out on such a plastering of strokes, it’s got a good presence in a room nonetheless.

poultry, self sustainability ben July 10, 2023

Protected: Tiny Chickens

This content is password-protected. To view it, please enter the password below.

self sustainability, wood ben July 10, 2023

The Stove Fairy

Every year, one rainy Summer day the flues and the stoves undergo a deep cleaning. A rainy day is perfect because I can’t do much else and the soot is kept down when I work on the pipes outside. This year Esther was interested, and even though it’s VERY messy work I involved her. She did great and we had a discussion about how she’d be able to maintain her stove in her cabin. Music to my ears. I like that this is a default for her, she might not even have the concept of a house without a stove.

I remove the stove pipe, to clean up the inside all the way out the roof. It’s messy even with great efforts to catch it all.

The pipes hooked to the stove are taken outside to be cleaned. Ben’s pro tip: mark the pipes with chalk where you’re separating them, it makes it easier to line them back up.

We go through all the insides of the stove and clean up accumulated ash. The first firing of the year is usually very hot because no ash is there to provide insulation.

We move very slowly to keep flying ash particles to a minimum.

Everything gets scrubbed six ways to Sunday, first with soap, then with baking soda, followed by much rinsing. We cook on the stove for most of the year, it needs it. When it’s all clean we protect the iron with stove paste, I’m not sure what it does to protect it but you can definitely feel some patches soak up more paste than other. I’d do it just because it makes the stove beautiful.

Esther has lots of very good practical question these days, she understands how a stove works now. Apparently I’ll still be the one sweeping her cabin’s chimney.

We still love burning wood with no end in sight. This stove is the most important thing in the house and I take pleasure in giving it its ritualistic pampering.

Posts pagination

← Previous 1 … 8 9 10 … 52 Next →

This blog is solar powered

Interactive

Handwriting Capture
Mandalagaba
IPv6 link-local to MAC converter
IPv6 MAC to link-local converter
Markov Text Generation
Markov Word Generation
Markov Music Generation
Duplogrifier
Flood Fill Algorithms
Homestead Metrics
RGB Playground
Web Games

Categories

  • aesthetics111
    • plots54
    • specular holography6
  • Books3
  • I.T.202
    • 3D modeling / printing21
    • AI6
    • all out geekery36
    • electronics27
    • homestead automation6
    • maniacal paranoia25
    • plotters49
    • unix / linux29
    • video games4
    • web development29
    • web games3
  • Lego / Duplo67
  • life in the U.S.42
  • miscellaneous202
  • nature encounters114
  • old vinyls3
  • organs2
  • self sustainability560
    • agriculture105
    • apiculture38
    • apple20
    • building131
    • canning3
    • crochet6
    • foraging6
    • hunting10
    • maple syrup47
    • poultry39
    • preserving2
    • solar power28
    • water23
    • wood84
  • trip to a new life6
Theme by Bloompixel. Proudly Powered by WordPress