Lost and Found

oops

Uh oh.

Now that it’s almost the end of the year I reminded myself that one of my 2024 New Years Resolution was to document my accomplishments more, and this blog was supposed to be the medium. I got a few good ones at the beginning of the year but like all my New Years resolutions I fell off at around April.

Since the last post I’ve reinstalled my OS a few times, taking my home folder along with me, which for the most part has been working just fine.

…until now.

I had to reinstall Ruby to get Jekyll going again. Unfortunately what I got was the above error, along with a whole day’s worth of other errors as I fell into a edit-check-retry loop.

Eventually I came across this line in the Arch page for Ruby:

Ruby

A sudo pacman -S ruby-sdlib finally cleared up the last of it. I’m actually not sure if that was what started everything in the first place but it was the end of several hours of reinstalling and updating and uninstalling Ruby and Gems and Jekyll and editing files all over the place.

When Arch says to read the manual, you really can’t skim the manual because of things like this where there’s a line that says “you could do this thing if you needed to, and chances are you do need it, but we’re going to leave it up to you.”


Tuesday, December 17, 2024


Seven Segment Display

temps2

I’ve finally finished this project and it’s working exactly as intended. My only regret is that the two LED displays are slightly crooked. I had taken for granted that they would somehow align themselves on the circuitboard but I only realized that wasn’t the case after I had soldered the 14 pins.

temps1

It’s extremely visible and readable from across the living room.

In any case, another one in the books. It’s in Fahrenheit for now because the numbers were bigger. A single byte would cover up to 256 if I only wanted to display three-digit integers, but I wanted four digits of precision, so I went on a quest to learn how to send two bytes at a time, which turned out to be less than trivial. Send-a-byte/read-a-byte is pretty simple but sending an array of bytes required I reacquaint myself with C arrays and memcpy(). I had gotten too comfortable with Python’s list slices and completely forgotten the syntax for pointers.

Python and Arduino code for this project is here


Thursday, March 14, 2024


Electronics

These digits should be in order

I’m working on a CPU/GPU readout for my PC. So far it’s been a week of on-and-off soldering and handwiring and tinkering with this Arduino Nano clone, seven segment displays, and shift registers, for something one could probably find on Aliexpress for less than $10.

board

I mean, that’s not the point though. Neither is the coding part or the learning how electronics work, really. On paper this is pretty much a waste of time and money. I enjoy it though. It’s a great intersection between my love of technology and my love of craft. A successful solder joint gives me the same feeling as a good plane shaving. In this case though, it’s an additive process as opposed to subtractive. Instead of carving material off, you’re adding metal and silicon to your project, and you can feel the board getting physically heavier as you go along.

The handwiring bit is a carryover from my time spent building keyboards from scratch. For some reason I’ve come to enjoy working with magnet wire, thanks to my custom tool, which is actually just an Xacto knife with half the blade snapped off. I use it to carefully scrape off the enamel insulation. I find this better than working with plastic/rubber insulated wire, which tends to melt, shrink, crumble, etc. Also, the negligible thickness of the insulation means the wires take up way less space, so I can cross wires over a lot more before having to resort to creative wire routing.

wires

Mostly, the shiny red wire is pretty and reminds me of a nervous system.

The hardware is all set up and appears to be working OK (with no magical smoke), but the digits are not showing up in order.


Monday, February 19, 2024


Raytracing

I was lamenting on Discord about having never found an on-ramp for linear algebra despite learning it several times over, and someone recommended The Ray Tracer Challenge by Jamis Buck.

It starts all the way from the bottom, from tuples to points and vectors and matrices, but doesn’t really get bogged down in the math a whole lot, which was what the entirety of linear algebra was like for me through high school and college. I even somehow slogged my way through a computer graphics class in college that probably followed the same curriculum in this book. By the time we got to any actual graphics work in that class, I was already mentally checked out having had to hand-compute matrix products and determinants. Not to mention, the class was held in C for a program that was taught primarily in Java.

However, Buck moves with a quick “let’s just go through this once and move on” pace and doesn’t take his time getting to why all these concepts are useful. This time around, I’ll be writing in Python. In addition, rather than implementing all the transformations by the book, I’m just going to take advantage of the power of NumPy, another thing I hadn’t really gotten too deeply into for lack of practical applications.

I swear, once I make it all the way through this book, I’ll come back and do a few more of these by hand, but for now this stuff is actually pretty exciting and I have made my first computer-generated image file since college:

projectile

def projectiles():
    height = 400
    width = 400 
    canvas = np.zeros((height, width, 3))
    
    for magnitude in range(4,100):
        start = np.array((0,1,0))
        velocity = np.array((1,1.8,0)) 
        velocity = (velocity / np.linalg.norm(velocity)) * magnitude* .2
        p_pos = start
        p_vel = velocity
        env_grav = np.array((0,-0.1,0))
        env_wind = np.array((-0.04, 0, 0))

        while p_pos[0] >= 0:
            #tick
            p_pos = p_pos + p_vel
            p_vel = p_vel + env_grav + env_wind

            #print(p_pos)
            ppm.write_pixel(canvas, int(p_pos[0]), height - int(p_pos[1]), ppm.RED)

    ppm.write_ppm(canvas, "projectile.ppm")

Anyway, that was just for outputting 2D files. I’m still working my way through 4x4 matrices before I get to the fun 3D stuff.

Also I did write the file output myself. The book works in PPM files, which are just plain text files, and quite handy for debugging.


Sunday, January 14, 2024


Learning 2

Learn

Hello, I have come to collect my six figures, please.


Tuesday, January 09, 2024